Mercurial > emacs
comparison lisp/facemenu.el @ 17505:c2640d101ca9
(facemenu-update): Don't make global bindings here.
Make them at top level.
(facemenu-key): Variable deleted.
(facemenu-keybindings, facemenu-new-faces-at-end)
(facemenu-unlisted-faces, facemenu-remove-face-function): Doc fixes.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Fri, 18 Apr 1997 02:53:46 +0000 |
parents | 5e66b1087c94 |
children | 6e2928cff18e |
comparison
equal
deleted
inserted
replaced
17504:7dbdf39d9a28 | 17505:c2640d101ca9 |
---|---|
63 ;; '((default . [?\H-d]) | 63 ;; '((default . [?\H-d]) |
64 ;; (bold . [?\H-b]) | 64 ;; (bold . [?\H-b]) |
65 ;; (italic . [?\H-i]) | 65 ;; (italic . [?\H-i]) |
66 ;; (bold-italic . [?\H-l]) | 66 ;; (bold-italic . [?\H-l]) |
67 ;; (underline . [?\H-u]))) | 67 ;; (underline . [?\H-u]))) |
68 ;; (facemenu-update) | |
68 ;; (setq facemenu-keymap global-map) | 69 ;; (setq facemenu-keymap global-map) |
69 ;; (setq facemenu-key nil) | |
70 ;; (define-key global-map [?\H-c] 'facemenu-set-foreground) ; set fg color | 70 ;; (define-key global-map [?\H-c] 'facemenu-set-foreground) ; set fg color |
71 ;; (define-key global-map [?\H-C] 'facemenu-set-background) ; set bg color | 71 ;; (define-key global-map [?\H-C] 'facemenu-set-background) ; set bg color |
72 ;; (require 'facemenu) | |
73 ;; | 72 ;; |
74 ;; The order of the faces that appear in the menu and their keybindings can be | 73 ;; The order of the faces that appear in the menu and their keybindings can be |
75 ;; controlled by setting the variables `facemenu-keybindings' and | 74 ;; controlled by setting the variables `facemenu-keybindings' and |
76 ;; `facemenu-new-faces-at-end'. List faces that you don't use in documents | 75 ;; `facemenu-new-faces-at-end'. List faces that you don't use in documents |
77 ;; (eg, `region') in `facemenu-unlisted-faces'. | 76 ;; (eg, `region') in `facemenu-unlisted-faces'. |
96 (provide 'facemenu) | 95 (provide 'facemenu) |
97 | 96 |
98 ;;; Provide some binding for startup: | 97 ;;; Provide some binding for startup: |
99 ;;;###autoload (define-key global-map "\M-g" 'facemenu-keymap) | 98 ;;;###autoload (define-key global-map "\M-g" 'facemenu-keymap) |
100 ;;;###autoload (autoload 'facemenu-keymap "facemenu" "Keymap for face-changing commands." t 'keymap) | 99 ;;;###autoload (autoload 'facemenu-keymap "facemenu" "Keymap for face-changing commands." t 'keymap) |
101 | 100 |
102 (defvar facemenu-key "\M-g" | 101 ;; Global bindings: |
103 "Prefix key to use for facemenu commands.") | 102 (define-key global-map [C-down-mouse-2] 'facemenu-menu) |
103 (define-key global-map "\M-g" 'facemenu-keymap) | |
104 | 104 |
105 (defvar facemenu-keybindings | 105 (defvar facemenu-keybindings |
106 '((default . "d") | 106 '((default . "d") |
107 (bold . "b") | 107 (bold . "b") |
108 (italic . "i") | 108 (italic . "i") |
109 (bold-italic . "l") ; {bold} intersect {italic} = {l} | 109 (bold-italic . "l") ; {bold} intersect {italic} = {l} |
110 (underline . "u")) | 110 (underline . "u")) |
111 "Alist of interesting faces and keybindings. | 111 "Alist of interesting faces and keybindings. |
112 Each element is itself a list: the car is the name of the face, | 112 Each element is itself a list: the car is the name of the face, |
113 the next element is the key to use as a keyboard equivalent of the menu item; | 113 the next element is the key to use as a keyboard equivalent of the menu item; |
114 the binding is made in facemenu-keymap. | 114 the binding is made in `facemenu-keymap'. |
115 | 115 |
116 The faces specifically mentioned in this list are put at the top of | 116 The faces specifically mentioned in this list are put at the top of |
117 the menu, in the order specified. All other faces which are defined, | 117 the menu, in the order specified. All other faces which are defined, |
118 except for those in `facemenu-unlisted-faces', are listed after them, | 118 except for those in `facemenu-unlisted-faces', are listed after them, |
119 but get no keyboard equivalents. | 119 but get no keyboard equivalents. |
120 | 120 |
121 If you change this variable after loading facemenu.el, you will need to call | 121 If you change this variable after loading facemenu.el, you will need to call |
122 `facemenu-update' to make it take effect.") | 122 `facemenu-update' to make it take effect.") |
123 | 123 |
124 (defvar facemenu-new-faces-at-end t | 124 (defvar facemenu-new-faces-at-end t |
125 "Where in the menu to insert newly-created faces. | 125 "*Where in the menu to insert newly-created faces. |
126 This should be nil to put them at the top of the menu, or t to put them | 126 This should be nil to put them at the top of the menu, or t to put them |
127 just before \"Other\" at the end.") | 127 just before \"Other\" at the end.") |
128 | 128 |
129 (defvar facemenu-unlisted-faces | 129 (defvar facemenu-unlisted-faces |
130 '(modeline region secondary-selection highlight scratch-face) | 130 '(modeline region secondary-selection highlight scratch-face) |
131 "List of faces not to include in the Face menu. | 131 "*List of faces not to include in the Face menu. |
132 You can set this list before loading facemenu.el, or add a face to it before | 132 You can set this list before loading facemenu.el, or add a face to it before |
133 creating that face if you do not want it to be listed. If you change the | 133 creating that face if you do not want it to be listed. If you change the |
134 variable so as to eliminate faces that have already been added to the menu, | 134 variable so as to eliminate faces that have already been added to the menu, |
135 call `facemenu-update' to recalculate the menu contents. | 135 call `facemenu-update' to recalculate the menu contents. |
136 | 136 |
251 "String to insert or function called at end of text to change or `nil'. | 251 "String to insert or function called at end of text to change or `nil'. |
252 This function is passed the FACE to set, and must return a string which is | 252 This function is passed the FACE to set, and must return a string which is |
253 inserted.") | 253 inserted.") |
254 | 254 |
255 (defvar facemenu-remove-face-function nil | 255 (defvar facemenu-remove-face-function nil |
256 "When non-`nil' function called to remove faces. | 256 "When non-nil, this is a function called to remove faces. |
257 This function is passed the START and END of text to change. | 257 This function is passed the START and END of text to change. |
258 May also be `t' meaning to use `facemenu-add-face-function'.") | 258 May also be `t' meaning to use `facemenu-add-face-function'.") |
259 | 259 |
260 ;;; Internal Variables | 260 ;;; Internal Variables |
261 | 261 |
267 (defun facemenu-update () | 267 (defun facemenu-update () |
268 "Add or update the \"Face\" menu in the menu bar. | 268 "Add or update the \"Face\" menu in the menu bar. |
269 You can call this to update things if you change any of the menu configuration | 269 You can call this to update things if you change any of the menu configuration |
270 variables." | 270 variables." |
271 (interactive) | 271 (interactive) |
272 | |
273 ;; Global bindings: | |
274 (define-key global-map [C-down-mouse-2] 'facemenu-menu) | |
275 (if facemenu-key (define-key global-map facemenu-key 'facemenu-keymap)) | |
276 | 272 |
277 ;; Add each defined face to the menu. | 273 ;; Add each defined face to the menu. |
278 (facemenu-iterate 'facemenu-add-new-face | 274 (facemenu-iterate 'facemenu-add-new-face |
279 (facemenu-complete-face-list facemenu-keybindings))) | 275 (facemenu-complete-face-list facemenu-keybindings))) |
280 | 276 |