From b6a675073037e81f781db98e0210f8cc58de8227 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Mon, 3 Jul 2006 14:31:35 +0000 Subject: [PATCH] * facemenu.el (facemenu-listed-faces): New var. (facemenu-unlisted-faces): Variable deleted. (facemenu-add-new-face): Use facemenu-listed-faces. --- lisp/ChangeLog | 9 ++++++ lisp/facemenu.el | 71 ++++++++++++++++++++---------------------------- 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 @@ +2006-07-03 Chong Yidong + + * facemenu.el (facemenu-listed-faces): New var. + (facemenu-unlisted-faces): Variable deleted. + (facemenu-add-new-face): Use facemenu-listed-faces. + + * emulation/viper-init.el, calendar/calendar.el: + * progmodes/make-mode.el: Delete calls to facemenu-unlisted-faces. + 2006-07-03 Carsten Dominik * 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 @@ ;; ;; The order of the faces that appear in the menu and their keybindings can be ;; controlled by setting the variables `facemenu-keybindings' and -;; `facemenu-new-faces-at-end'. List faces that you don't use in documents -;; (eg, `region') in `facemenu-unlisted-faces'. +;; `facemenu-new-faces-at-end'. List faces that you want to use in documents +;; in `facemenu-listed-faces'. ;;; Known Problems: ;; 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; the binding is made in `facemenu-keymap'. The faces specifically mentioned in this list are put at the top of -the menu, in the order specified. All other faces which are defined, -except for those in `facemenu-unlisted-faces', are listed after them, -but get no keyboard equivalents. +the menu, in the order specified. All other faces which are defined +in `facemenu-listed-faces' are listed after them, but get no +keyboard equivalents. If you change this variable after loading facemenu.el, you will need to call `facemenu-update' to make it take effect." @@ -132,28 +132,25 @@ just before \"Other\" at the end." :type 'boolean :group 'facemenu) -(defcustom facemenu-unlisted-faces - `(modeline region secondary-selection highlight scratch-face - ,(purecopy "^font-lock-") ,(purecopy "^gnus-") ,(purecopy "^message-") - ,(purecopy "^ediff-") ,(purecopy "^term-") ,(purecopy "^vc-") - ,(purecopy "^widget-") ,(purecopy "^custom-") ,(purecopy "^vm-")) - "*List of faces not to include in the Face menu. -Each element may be either a symbol, which is the name of a face, or a string, -which is a regular expression to be matched against face names. Matching -faces will not be added to the menu. +(defcustom facemenu-listed-faces nil + "*List of faces to include in the Face menu. +Each element should be a symbol, which is the name of a face. +The \"basic \" faces in `facemenu-keybindings' are automatically +added to the Face menu, and are not included in this list. You can set this list before loading facemenu.el, or add a face to it before -creating that face if you do not want it to be listed. If you change the +creating that face if you want it to be listed. If you change the variable so as to eliminate faces that have already been added to the menu, call `facemenu-update' to recalculate the menu contents. -If this variable is t, no faces will be added to the menu. This is useful for -temporarily turning off the feature that automatically adds faces to the menu -when they are created." - :type '(choice (const :tag "Don't add faces" t) - (const :tag "None (do add any face)" nil) - (repeat (choice symbol regexp))) - :group 'facemenu) +If this variable is t, all faces will be added to the menu. This +is useful for setting temporarily if you want to add faces to the +menu when they are created." + :type '(choice (const :tag "List all faces" t) + (const :tag "None" nil) + (repeat symbol)) + :group 'facemenu + :version "22.1") ;;;###autoload (defvar facemenu-face-menu @@ -675,18 +672,13 @@ This is called whenever you create a new face." (setq docstring (format "Select face `%s' for subsequent insertion." name)) - (cond ((eq t facemenu-unlisted-faces)) - ((memq symbol facemenu-unlisted-faces)) - ;; test against regexps in facemenu-unlisted-faces - ((let ((unlisted facemenu-unlisted-faces) - (matched nil)) - (while (and unlisted (not matched)) - (if (and (stringp (car unlisted)) - (string-match (car unlisted) name)) - (setq matched t) - (setq unlisted (cdr unlisted)))) - matched)) - (key ; has a keyboard equivalent. These go at the front. + (cond ((facemenu-iterate ; check if equivalent face is already in the menu + (lambda (m) (and (listp m) + (symbolp (car m)) + (face-equal (car m) symbol))) + (cdr (symbol-function menu)))) + ;; Faces with a keyboard equivalent. These go at the front. + (key (setq function (intern (concat "facemenu-set-" name))) (fset function `(lambda () @@ -700,17 +692,14 @@ This is called whenever you create a new face." (region-end))))) (define-key 'facemenu-keymap key (cons name function)) (define-key menu key (cons name function))) - ((facemenu-iterate ; check if equivalent face is already in the menu - (lambda (m) (and (listp m) - (symbolp (car m)) - (face-equal (car m) symbol))) - (cdr (symbol-function menu)))) - (t ; No keyboard equivalent. Figure out where to put it: + ;; Faces with no keyboard equivalent. Figure out where to put it: + ((or (eq t facemenu-listed-faces) + (memq symbol facemenu-listed-faces)) (setq key (vector symbol) function 'facemenu-set-face-from-menu menu-val (symbol-function menu)) (if (and facemenu-new-faces-at-end - (> (length menu-val) 3)) + (> (length menu-val) 3)) (define-key-after menu-val key (cons name function) (car (nth (- (length menu-val) 3) menu-val))) (define-key menu key (cons name function)))))) -- 2.39.2