aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2012-04-23 23:38:48 +0800
committerChong Yidong2012-04-23 23:38:48 +0800
commit46c71e2314b443fbc0c50132afc4f3368e6b52e3 (patch)
tree038552d04c7fffccf23f98136c2dd39c8235b7c2
parent922d37d3e83008260a9d6eabc1bee6973ed3c6b8 (diff)
downloademacs-46c71e2314b443fbc0c50132afc4f3368e6b52e3.tar.gz
emacs-46c71e2314b443fbc0c50132afc4f3368e6b52e3.zip
Use proper faces in apropos.el.
* lisp/apropos.el (apropos-symbol, apropos-keybinding, apropos-label) (apropos-property, apropos-function-button) (apropos-variable-button, apropos-misc-button): New faces. (apropos-symbol-face, apropos-keybinding-face) (apropos-label-face, apropos-property-face, apropos-match-face): Variables removed. (apropos-library-button, apropos-format-plist, apropos-print) (apropos-print-doc, apropos-describe-plist): Callers changed. Fixes: debbugs:8396
-rw-r--r--etc/NEWS9
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/apropos.el95
3 files changed, 66 insertions, 46 deletions
diff --git a/etc/NEWS b/etc/NEWS
index c4f89ab4a3b..fcf9fc9397e 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -74,6 +74,15 @@ character when doing minibuffer filename prompts.
74 74
75* Changes in Specialized Modes and Packages in Emacs 24.2 75* Changes in Specialized Modes and Packages in Emacs 24.2
76 76
77** Apropos
78
79*** The faces used by Apropos are now directly customizable.
80These faces are named `apropos-symbol', `apropos-keybinding', and so on;
81see the `apropos' Custom group for details.
82
83**** The old options whose values specified faces to use were removed
84(i.e. `apropos-symbol-face', `apropos-keybinding-face', etc.).
85
77** Customize 86** Customize
78 87
79*** `custom-reset-button-menu' now defaults to t. 88*** `custom-reset-button-menu' now defaults to t.
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 2bef7214456..173b2345c58 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -9,6 +9,14 @@
9 9
10 * apropos.el (apropos-read-pattern): Make prompt less cryptic. 10 * apropos.el (apropos-read-pattern): Make prompt less cryptic.
11 Fix word list splitting (Bug#11132). 11 Fix word list splitting (Bug#11132).
12 (apropos-symbol, apropos-keybinding, apropos-label)
13 (apropos-property, apropos-function-button)
14 (apropos-variable-button, apropos-misc-button): New faces.
15 (apropos-symbol-face, apropos-keybinding-face)
16 (apropos-label-face, apropos-property-face, apropos-match-face):
17 Variables removed (Bug#8396).
18 (apropos-library-button, apropos-format-plist, apropos-print)
19 (apropos-print-doc, apropos-describe-plist): Callers changed.
12 20
132012-04-23 Michael Albinus <michael.albinus@gmx.de> 212012-04-23 Michael Albinus <michael.albinus@gmx.de>
14 22
diff --git a/lisp/apropos.el b/lisp/apropos.el
index 25163dcab99..f5373b38682 100644
--- a/lisp/apropos.el
+++ b/lisp/apropos.el
@@ -85,35 +85,48 @@ include key-binding information in its output."
85 :group 'apropos 85 :group 'apropos
86 :type 'boolean) 86 :type 'boolean)
87 87
88(defface apropos-symbol
89 '((t (:inherit bold)))
90 "Face for the symbol name in Apropos output."
91 :group 'apropos
92 :version "24.2")
88 93
89(defcustom apropos-symbol-face 'bold 94(defface apropos-keybinding
90 "Face for symbol name in Apropos output, or nil for none." 95 '((t (:inherit underline)))
96 "Face for lists of keybinding in Apropos output."
91 :group 'apropos 97 :group 'apropos
92 :type 'face) 98 :version "24.2")
93 99
94(defcustom apropos-keybinding-face 'underline 100(defface apropos-property
95 "Face for lists of keybinding in Apropos output, or nil for none." 101 '((t (:inherit font-lock-builtin-face)))
102 "Face for property name in apropos output, or nil for none."
96 :group 'apropos 103 :group 'apropos
97 :type 'face) 104 :version "24.2")
98 105
99(defcustom apropos-label-face '(italic) 106(defface apropos-function-button
100 "Face for label (`Command', `Variable' ...) in Apropos output. 107 '((t (:inherit (font-lock-function-name-face button))))
101A value of nil means don't use any special font for them, and also 108 "Button face indicating a function, macro, or command in Apropos."
102turns off mouse highlighting."
103 :group 'apropos 109 :group 'apropos
104 :type 'face) 110 :version "24.2")
105 111
106(defcustom apropos-property-face 'bold-italic 112(defface apropos-variable-button
107 "Face for property name in apropos output, or nil for none." 113 '((t (:inherit (font-lock-variable-name-face button))))
114 "Button face indicating a variable in Apropos."
108 :group 'apropos 115 :group 'apropos
109 :type 'face) 116 :version "24.2")
117
118(defface apropos-misc-button
119 '((t (:inherit (font-lock-constant-face button))))
120 "Button face indicating a miscellaneous object type in Apropos."
121 :group 'apropos
122 :version "24.2")
110 123
111(defcustom apropos-match-face 'match 124(defcustom apropos-match-face 'match
112 "Face for matching text in Apropos documentation/value, or nil for none. 125 "Face for matching text in Apropos documentation/value, or nil for none.
113This applies when you look for matches in the documentation or variable value 126This applies when you look for matches in the documentation or variable value
114for the pattern; the part that matches gets displayed in this font." 127for the pattern; the part that matches gets displayed in this font."
115 :group 'apropos 128 :group 'apropos
116 :type 'face) 129 :version "24.2")
117 130
118(defcustom apropos-sort-by-scores nil 131(defcustom apropos-sort-by-scores nil
119 "Non-nil means sort matches by scores; best match is shown first. 132 "Non-nil means sort matches by scores; best match is shown first.
@@ -196,7 +209,7 @@ term, and the rest of the words are alternative terms.")
196;;; Button types used by apropos 209;;; Button types used by apropos
197 210
198(define-button-type 'apropos-symbol 211(define-button-type 'apropos-symbol
199 'face apropos-symbol-face 212 'face 'apropos-symbol
200 'help-echo "mouse-2, RET: Display more help on this symbol" 213 'help-echo "mouse-2, RET: Display more help on this symbol"
201 'follow-link t 214 'follow-link t
202 'action #'apropos-symbol-button-display-help) 215 'action #'apropos-symbol-button-display-help)
@@ -210,7 +223,7 @@ term, and the rest of the words are alternative terms.")
210(define-button-type 'apropos-function 223(define-button-type 'apropos-function
211 'apropos-label "Function" 224 'apropos-label "Function"
212 'apropos-short-label "f" 225 'apropos-short-label "f"
213 'face '(font-lock-function-name-face button) 226 'face 'apropos-function-button
214 'help-echo "mouse-2, RET: Display more help on this function" 227 'help-echo "mouse-2, RET: Display more help on this function"
215 'follow-link t 228 'follow-link t
216 'action (lambda (button) 229 'action (lambda (button)
@@ -219,7 +232,7 @@ term, and the rest of the words are alternative terms.")
219(define-button-type 'apropos-macro 232(define-button-type 'apropos-macro
220 'apropos-label "Macro" 233 'apropos-label "Macro"
221 'apropos-short-label "m" 234 'apropos-short-label "m"
222 'face '(font-lock-function-name-face button) 235 'face 'apropos-function-button
223 'help-echo "mouse-2, RET: Display more help on this macro" 236 'help-echo "mouse-2, RET: Display more help on this macro"
224 'follow-link t 237 'follow-link t
225 'action (lambda (button) 238 'action (lambda (button)
@@ -228,7 +241,7 @@ term, and the rest of the words are alternative terms.")
228(define-button-type 'apropos-command 241(define-button-type 'apropos-command
229 'apropos-label "Command" 242 'apropos-label "Command"
230 'apropos-short-label "c" 243 'apropos-short-label "c"
231 'face '(font-lock-function-name-face button) 244 'face 'apropos-function-button
232 'help-echo "mouse-2, RET: Display more help on this command" 245 'help-echo "mouse-2, RET: Display more help on this command"
233 'follow-link t 246 'follow-link t
234 'action (lambda (button) 247 'action (lambda (button)
@@ -242,7 +255,7 @@ term, and the rest of the words are alternative terms.")
242(define-button-type 'apropos-variable 255(define-button-type 'apropos-variable
243 'apropos-label "Variable" 256 'apropos-label "Variable"
244 'apropos-short-label "v" 257 'apropos-short-label "v"
245 'face '(font-lock-variable-name-face button) 258 'face 'apropos-variable-button
246 'help-echo "mouse-2, RET: Display more help on this variable" 259 'help-echo "mouse-2, RET: Display more help on this variable"
247 'follow-link t 260 'follow-link t
248 'action (lambda (button) 261 'action (lambda (button)
@@ -260,7 +273,7 @@ term, and the rest of the words are alternative terms.")
260(define-button-type 'apropos-group 273(define-button-type 'apropos-group
261 'apropos-label "Group" 274 'apropos-label "Group"
262 'apropos-short-label "g" 275 'apropos-short-label "g"
263 'face '(font-lock-builtin-face button) 276 'face 'apropos-misc-button
264 'help-echo "mouse-2, RET: Display more help on this group" 277 'help-echo "mouse-2, RET: Display more help on this group"
265 'follow-link t 278 'follow-link t
266 'action (lambda (button) 279 'action (lambda (button)
@@ -270,7 +283,7 @@ term, and the rest of the words are alternative terms.")
270(define-button-type 'apropos-widget 283(define-button-type 'apropos-widget
271 'apropos-label "Widget" 284 'apropos-label "Widget"
272 'apropos-short-label "w" 285 'apropos-short-label "w"
273 'face '(font-lock-builtin-face button) 286 'face 'apropos-misc-button
274 'help-echo "mouse-2, RET: Display more help on this widget" 287 'help-echo "mouse-2, RET: Display more help on this widget"
275 'follow-link t 288 'follow-link t
276 'action (lambda (button) 289 'action (lambda (button)
@@ -279,7 +292,7 @@ term, and the rest of the words are alternative terms.")
279(define-button-type 'apropos-plist 292(define-button-type 'apropos-plist
280 'apropos-label "Properties" 293 'apropos-label "Properties"
281 'apropos-short-label "p" 294 'apropos-short-label "p"
282 'face '(font-lock-keyword-face button) 295 'face 'apropos-misc-button
283 'help-echo "mouse-2, RET: Display more help on this plist" 296 'help-echo "mouse-2, RET: Display more help on this plist"
284 'follow-link t 297 'follow-link t
285 'action (lambda (button) 298 'action (lambda (button)
@@ -587,7 +600,7 @@ Returns list of symbols and documentation found."
587 (let ((name (copy-sequence (symbol-name sym)))) 600 (let ((name (copy-sequence (symbol-name sym))))
588 (make-text-button name nil 601 (make-text-button name nil
589 'type 'apropos-library 602 'type 'apropos-library
590 'face apropos-symbol-face 603 'face 'apropos-symbol
591 'apropos-symbol name) 604 'apropos-symbol name)
592 name))) 605 name)))
593 606
@@ -837,9 +850,8 @@ Returns list of symbols and documentation found."
837 (while pl 850 (while pl
838 (setq p (format "%s %S" (car pl) (nth 1 pl))) 851 (setq p (format "%s %S" (car pl) (nth 1 pl)))
839 (if (or (not compare) (string-match apropos-regexp p)) 852 (if (or (not compare) (string-match apropos-regexp p))
840 (if apropos-property-face 853 (put-text-property 0 (length (symbol-name (car pl)))
841 (put-text-property 0 (length (symbol-name (car pl))) 854 'face 'apropos-property p)
842 'face apropos-property-face p))
843 (setq p nil)) 855 (setq p nil))
844 (if p 856 (if p
845 (progn 857 (progn
@@ -1031,10 +1043,7 @@ If non-nil TEXT is a string that will be printed as a heading."
1031 (insert-text-button (symbol-name symbol) 1043 (insert-text-button (symbol-name symbol)
1032 'type 'apropos-symbol 1044 'type 'apropos-symbol
1033 'skip apropos-multi-type 1045 'skip apropos-multi-type
1034 ;; Can't use default, since user may have 1046 'face 'apropos-symbol)
1035 ;; changed the variable!
1036 ;; Just say `no' to variables containing faces!
1037 'face apropos-symbol-face)
1038 (if (and (eq apropos-sort-by-scores 'verbose) 1047 (if (and (eq apropos-sort-by-scores 'verbose)
1039 (cadr apropos-item)) 1048 (cadr apropos-item))
1040 (insert " (" (number-to-string (cadr apropos-item)) ") ")) 1049 (insert " (" (number-to-string (cadr apropos-item)) ") "))
@@ -1072,18 +1081,16 @@ If non-nil TEXT is a string that will be printed as a heading."
1072 (setq key (condition-case () 1081 (setq key (condition-case ()
1073 (key-description key) 1082 (key-description key)
1074 (error))) 1083 (error)))
1075 (if apropos-keybinding-face 1084 (put-text-property 0 (length key)
1076 (put-text-property 0 (length key) 1085 'face 'apropos-keybinding
1077 'face apropos-keybinding-face 1086 key)
1078 key))
1079 key) 1087 key)
1080 item ", ")) 1088 item ", "))
1081 (insert "M-x ... RET") 1089 (insert "M-x ... RET")
1082 (when apropos-keybinding-face 1090 (put-text-property (- (point) 11) (- (point) 8)
1083 (put-text-property (- (point) 11) (- (point) 8) 1091 'face 'apropos-keybinding)
1084 'face apropos-keybinding-face) 1092 (put-text-property (- (point) 3) (point)
1085 (put-text-property (- (point) 3) (point) 1093 'face 'apropos-keybinding)))
1086 'face apropos-keybinding-face))))
1087 (terpri)) 1094 (terpri))
1088 (apropos-print-doc 2 1095 (apropos-print-doc 2
1089 (if (commandp symbol) 1096 (if (commandp symbol)
@@ -1128,9 +1135,6 @@ If non-nil TEXT is a string that will be printed as a heading."
1128 (format "<%s>" (button-type-get type 'apropos-short-label)) 1135 (format "<%s>" (button-type-get type 'apropos-short-label))
1129 (button-type-get type 'apropos-label)) 1136 (button-type-get type 'apropos-label))
1130 'type type 1137 'type type
1131 ;; Can't use the default button face, since user may have changed the
1132 ;; variable! Just say `no' to variables containing faces!
1133 'face (append button-face apropos-label-face)
1134 'apropos-symbol (car apropos-item)) 1138 'apropos-symbol (car apropos-item))
1135 (insert (if apropos-compact-layout " " ": "))) 1139 (insert (if apropos-compact-layout " " ": ")))
1136 1140
@@ -1177,9 +1181,8 @@ If non-nil TEXT is a string that will be printed as a heading."
1177 (princ "Symbol ") 1181 (princ "Symbol ")
1178 (prin1 symbol) 1182 (prin1 symbol)
1179 (princ "'s plist is\n (") 1183 (princ "'s plist is\n (")
1180 (if apropos-symbol-face 1184 (put-text-property (+ (point-min) 7) (- (point) 14)
1181 (put-text-property (+ (point-min) 7) (- (point) 14) 1185 'face 'apropos-symbol)
1182 'face apropos-symbol-face))
1183 (insert (apropos-format-plist symbol "\n ")) 1186 (insert (apropos-format-plist symbol "\n "))
1184 (princ ")"))) 1187 (princ ")")))
1185 1188