aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2006-07-03 14:31:35 +0000
committerChong Yidong2006-07-03 14:31:35 +0000
commitb6a675073037e81f781db98e0210f8cc58de8227 (patch)
treed87364c26b0c5d5b66e6bc1c50c03467601d44e3
parent00c8c617aad02d60098805d9480b083d92632ebc (diff)
downloademacs-b6a675073037e81f781db98e0210f8cc58de8227.tar.gz
emacs-b6a675073037e81f781db98e0210f8cc58de8227.zip
* facemenu.el (facemenu-listed-faces): New var.
(facemenu-unlisted-faces): Variable deleted. (facemenu-add-new-face): Use facemenu-listed-faces.
-rw-r--r--lisp/ChangeLog9
-rw-r--r--lisp/facemenu.el71
2 files changed, 39 insertions, 41 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 0011e5300f0..e6df1f0d806 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,12 @@
12006-07-03 Chong Yidong <cyd@stupidchicken.com>
2
3 * facemenu.el (facemenu-listed-faces): New var.
4 (facemenu-unlisted-faces): Variable deleted.
5 (facemenu-add-new-face): Use facemenu-listed-faces.
6
7 * emulation/viper-init.el, calendar/calendar.el:
8 * progmodes/make-mode.el: Delete calls to facemenu-unlisted-faces.
9
12006-07-03 Carsten Dominik <dominik@science.uva.nl> 102006-07-03 Carsten Dominik <dominik@science.uva.nl>
2 11
3 * textmodes/org.el (org-mode): Removed no invalid settings for 12 * textmodes/org.el (org-mode): Removed no invalid settings for
diff --git a/lisp/facemenu.el b/lisp/facemenu.el
index 5478cf12b8c..a8d8ea9a4b5 100644
--- a/lisp/facemenu.el
+++ b/lisp/facemenu.el
@@ -67,8 +67,8 @@
67;; 67;;
68;; The order of the faces that appear in the menu and their keybindings can be 68;; The order of the faces that appear in the menu and their keybindings can be
69;; controlled by setting the variables `facemenu-keybindings' and 69;; controlled by setting the variables `facemenu-keybindings' and
70;; `facemenu-new-faces-at-end'. List faces that you don't use in documents 70;; `facemenu-new-faces-at-end'. List faces that you want to use in documents
71;; (eg, `region') in `facemenu-unlisted-faces'. 71;; in `facemenu-listed-faces'.
72 72
73;;; Known Problems: 73;;; Known Problems:
74;; Bold and Italic do not combine to create bold-italic if you select them 74;; Bold and Italic do not combine to create bold-italic if you select them
@@ -116,9 +116,9 @@ the next element is the key to use as a keyboard equivalent of the menu item;
116the binding is made in `facemenu-keymap'. 116the binding is made in `facemenu-keymap'.
117 117
118The faces specifically mentioned in this list are put at the top of 118The faces specifically mentioned in this list are put at the top of
119the menu, in the order specified. All other faces which are defined, 119the menu, in the order specified. All other faces which are defined
120except for those in `facemenu-unlisted-faces', are listed after them, 120in `facemenu-listed-faces' are listed after them, but get no
121but get no keyboard equivalents. 121keyboard equivalents.
122 122
123If you change this variable after loading facemenu.el, you will need to call 123If you change this variable after loading facemenu.el, you will need to call
124`facemenu-update' to make it take effect." 124`facemenu-update' to make it take effect."
@@ -132,28 +132,25 @@ just before \"Other\" at the end."
132 :type 'boolean 132 :type 'boolean
133 :group 'facemenu) 133 :group 'facemenu)
134 134
135(defcustom facemenu-unlisted-faces 135(defcustom facemenu-listed-faces nil
136 `(modeline region secondary-selection highlight scratch-face 136 "*List of faces to include in the Face menu.
137 ,(purecopy "^font-lock-") ,(purecopy "^gnus-") ,(purecopy "^message-") 137Each element should be a symbol, which is the name of a face.
138 ,(purecopy "^ediff-") ,(purecopy "^term-") ,(purecopy "^vc-") 138The \"basic \" faces in `facemenu-keybindings' are automatically
139 ,(purecopy "^widget-") ,(purecopy "^custom-") ,(purecopy "^vm-")) 139added to the Face menu, and are not included in this list.
140 "*List of faces not to include in the Face menu.
141Each element may be either a symbol, which is the name of a face, or a string,
142which is a regular expression to be matched against face names. Matching
143faces will not be added to the menu.
144 140
145You can set this list before loading facemenu.el, or add a face to it before 141You can set this list before loading facemenu.el, or add a face to it before
146creating that face if you do not want it to be listed. If you change the 142creating that face if you want it to be listed. If you change the
147variable so as to eliminate faces that have already been added to the menu, 143variable so as to eliminate faces that have already been added to the menu,
148call `facemenu-update' to recalculate the menu contents. 144call `facemenu-update' to recalculate the menu contents.
149 145
150If this variable is t, no faces will be added to the menu. This is useful for 146If this variable is t, all faces will be added to the menu. This
151temporarily turning off the feature that automatically adds faces to the menu 147is useful for setting temporarily if you want to add faces to the
152when they are created." 148menu when they are created."
153 :type '(choice (const :tag "Don't add faces" t) 149 :type '(choice (const :tag "List all faces" t)
154 (const :tag "None (do add any face)" nil) 150 (const :tag "None" nil)
155 (repeat (choice symbol regexp))) 151 (repeat symbol))
156 :group 'facemenu) 152 :group 'facemenu
153 :version "22.1")
157 154
158;;;###autoload 155;;;###autoload
159(defvar facemenu-face-menu 156(defvar facemenu-face-menu
@@ -675,18 +672,13 @@ This is called whenever you create a new face."
675 (setq docstring 672 (setq docstring
676 (format "Select face `%s' for subsequent insertion." 673 (format "Select face `%s' for subsequent insertion."
677 name)) 674 name))
678 (cond ((eq t facemenu-unlisted-faces)) 675 (cond ((facemenu-iterate ; check if equivalent face is already in the menu
679 ((memq symbol facemenu-unlisted-faces)) 676 (lambda (m) (and (listp m)
680 ;; test against regexps in facemenu-unlisted-faces 677 (symbolp (car m))
681 ((let ((unlisted facemenu-unlisted-faces) 678 (face-equal (car m) symbol)))
682 (matched nil)) 679 (cdr (symbol-function menu))))
683 (while (and unlisted (not matched)) 680 ;; Faces with a keyboard equivalent. These go at the front.
684 (if (and (stringp (car unlisted)) 681 (key
685 (string-match (car unlisted) name))
686 (setq matched t)
687 (setq unlisted (cdr unlisted))))
688 matched))
689 (key ; has a keyboard equivalent. These go at the front.
690 (setq function (intern (concat "facemenu-set-" name))) 682 (setq function (intern (concat "facemenu-set-" name)))
691 (fset function 683 (fset function
692 `(lambda () 684 `(lambda ()
@@ -700,17 +692,14 @@ This is called whenever you create a new face."
700 (region-end))))) 692 (region-end)))))
701 (define-key 'facemenu-keymap key (cons name function)) 693 (define-key 'facemenu-keymap key (cons name function))
702 (define-key menu key (cons name function))) 694 (define-key menu key (cons name function)))
703 ((facemenu-iterate ; check if equivalent face is already in the menu 695 ;; Faces with no keyboard equivalent. Figure out where to put it:
704 (lambda (m) (and (listp m) 696 ((or (eq t facemenu-listed-faces)
705 (symbolp (car m)) 697 (memq symbol facemenu-listed-faces))
706 (face-equal (car m) symbol)))
707 (cdr (symbol-function menu))))
708 (t ; No keyboard equivalent. Figure out where to put it:
709 (setq key (vector symbol) 698 (setq key (vector symbol)
710 function 'facemenu-set-face-from-menu 699 function 'facemenu-set-face-from-menu
711 menu-val (symbol-function menu)) 700 menu-val (symbol-function menu))
712 (if (and facemenu-new-faces-at-end 701 (if (and facemenu-new-faces-at-end
713 (> (length menu-val) 3)) 702 (> (length menu-val) 3))
714 (define-key-after menu-val key (cons name function) 703 (define-key-after menu-val key (cons name function)
715 (car (nth (- (length menu-val) 3) menu-val))) 704 (car (nth (- (length menu-val) 3) menu-val)))
716 (define-key menu key (cons name function)))))) 705 (define-key menu key (cons name function))))))