diff options
| author | Richard M. Stallman | 1997-08-26 17:59:23 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1997-08-26 17:59:23 +0000 |
| commit | 7dc30d5ba8d5e5a67b598d5f92b406c3249e2ff0 (patch) | |
| tree | 844e28117283b85881a4f977a1686188c3463c72 | |
| parent | d871aa9bb11e22f2340662f586ffb09c39afffeb (diff) | |
| download | emacs-7dc30d5ba8d5e5a67b598d5f92b406c3249e2ff0.tar.gz emacs-7dc30d5ba8d5e5a67b598d5f92b406c3249e2ff0.zip | |
(facemenu-unlisted-faces): Expand variable
definition to allow regexps; add regexps for some packages that
define a lot of faces.
(facemenu-add-new-face): Test new face against regexps.
(list-colors-display): Rather than creating a zillion faces, use
new (foreground-color . COLOR) and (background-color . COLOR)
face properties.
| -rw-r--r-- | lisp/facemenu.el | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/lisp/facemenu.el b/lisp/facemenu.el index 6586b77a1fd..35b7bb5a6fa 100644 --- a/lisp/facemenu.el +++ b/lisp/facemenu.el | |||
| @@ -136,8 +136,14 @@ just before \"Other\" at the end." | |||
| 136 | :group 'facemenu) | 136 | :group 'facemenu) |
| 137 | 137 | ||
| 138 | (defcustom facemenu-unlisted-faces | 138 | (defcustom facemenu-unlisted-faces |
| 139 | '(modeline region secondary-selection highlight scratch-face) | 139 | '(modeline region secondary-selection highlight scratch-face |
| 140 | "^font-lock-" "^gnus-" "^message-" "^ediff-" "^term-" "^vc-" | ||
| 141 | "^widget-" "^custom-" "^vm-") | ||
| 140 | "*List of faces not to include in the Face menu. | 142 | "*List of faces not to include in the Face menu. |
| 143 | Each element may be either a symbol, which is the name of a face, or a string, | ||
| 144 | which is a regular expression to be matched against face names. Matching | ||
| 145 | faces will not be added to the menu. | ||
| 146 | |||
| 141 | You can set this list before loading facemenu.el, or add a face to it before | 147 | You can set this list before loading facemenu.el, or add a face to it before |
| 142 | creating that face if you do not want it to be listed. If you change the | 148 | creating that face if you do not want it to be listed. If you change the |
| 143 | variable so as to eliminate faces that have already been added to the menu, | 149 | variable so as to eliminate faces that have already been added to the menu, |
| @@ -148,7 +154,7 @@ temporarily turning off the feature that automatically adds faces to the menu | |||
| 148 | when they are created." | 154 | when they are created." |
| 149 | :type '(choice (const :tag "Don't add" t) | 155 | :type '(choice (const :tag "Don't add" t) |
| 150 | (const :tag "None" nil) | 156 | (const :tag "None" nil) |
| 151 | (repeat face)) | 157 | (repeat (choice symbol regexp))) |
| 152 | :group 'facemenu) | 158 | :group 'facemenu) |
| 153 | 159 | ||
| 154 | ;;;###autoload | 160 | ;;;###autoload |
| @@ -488,20 +494,17 @@ of colors that the current display can handle." | |||
| 488 | (with-output-to-temp-buffer "*Colors*" | 494 | (with-output-to-temp-buffer "*Colors*" |
| 489 | (save-excursion | 495 | (save-excursion |
| 490 | (set-buffer standard-output) | 496 | (set-buffer standard-output) |
| 491 | (let ((facemenu-unlisted-faces t) | 497 | (let (s) |
| 492 | s) | ||
| 493 | (while list | 498 | (while list |
| 494 | (setq s (point)) | 499 | (setq s (point)) |
| 495 | (insert (car list)) | 500 | (insert (car list)) |
| 496 | (indent-to 20) | 501 | (indent-to 20) |
| 497 | (put-text-property s (point) 'face | 502 | (put-text-property s (point) 'face |
| 498 | (facemenu-get-face | 503 | (cons 'background-color (car list))) |
| 499 | (intern (concat "bg:" (car list))))) | ||
| 500 | (setq s (point)) | 504 | (setq s (point)) |
| 501 | (insert " " (car list) "\n") | 505 | (insert " " (car list) "\n") |
| 502 | (put-text-property s (point) 'face | 506 | (put-text-property s (point) 'face |
| 503 | (facemenu-get-face | 507 | (cons 'foreground-color (car list))) |
| 504 | (intern (concat "fg:" (car list))))) | ||
| 505 | (setq list (cdr list))))))) | 508 | (setq list (cdr list))))))) |
| 506 | 509 | ||
| 507 | (defun facemenu-color-equal (a b) | 510 | (defun facemenu-color-equal (a b) |
| @@ -639,6 +642,15 @@ Automatically called when a new face is created." | |||
| 639 | (setq menu 'facemenu-face-menu))) | 642 | (setq menu 'facemenu-face-menu))) |
| 640 | (cond ((eq t facemenu-unlisted-faces)) | 643 | (cond ((eq t facemenu-unlisted-faces)) |
| 641 | ((memq face facemenu-unlisted-faces)) | 644 | ((memq face facemenu-unlisted-faces)) |
| 645 | ;; test against regexps in facemenu-unlisted-faces | ||
| 646 | ((let ((unlisted facemenu-unlisted-faces) | ||
| 647 | (matched nil)) | ||
| 648 | (while (and unlisted (not matched)) | ||
| 649 | (if (and (stringp (car unlisted)) | ||
| 650 | (string-match (car unlisted) name)) | ||
| 651 | (setq matched t) | ||
| 652 | (setq unlisted (cdr unlisted)))) | ||
| 653 | matched)) | ||
| 642 | (key ; has a keyboard equivalent. These go at the front. | 654 | (key ; has a keyboard equivalent. These go at the front. |
| 643 | (setq function (intern (concat "facemenu-set-" name))) | 655 | (setq function (intern (concat "facemenu-set-" name))) |
| 644 | (fset function | 656 | (fset function |