Mercurial > emacs
comparison lisp/faces.el @ 96435:414b3d1e76df
(face-name-history): New variable.
(make-face, make-empty-face): Replace interactive spec "S"
with `read-from-minibuffer' where `read' arg is t and
`hist' arg is `face-name-history'.
(read-face-name): Set `hist' arg of `completing-read-multiple'
to `face-name-history'.
(list-faces-display): Use `read-regexp' instead of `read-string'
to read regexp.
author | Juri Linkov <juri@jurta.org> |
---|---|
date | Mon, 30 Jun 2008 19:35:59 +0000 |
parents | 36c91bfee166 |
children | 5a9a5f15f0e5 |
comparison
equal
deleted
inserted
replaced
96434:510adc264242 | 96435:414b3d1e76df |
---|---|
29 (require 'cl)) | 29 (require 'cl)) |
30 | 30 |
31 (declare-function xw-defined-colors "term/x-win" (&optional frame)) | 31 (declare-function xw-defined-colors "term/x-win" (&optional frame)) |
32 | 32 |
33 (defvar help-xref-stack-item) | 33 (defvar help-xref-stack-item) |
34 | |
35 (defvar face-name-history nil | |
36 "History list for some commands that read face names. | |
37 Maximum length of the history list is determined by the value | |
38 of `history-length', which see.") | |
39 | |
34 | 40 |
35 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 41 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
36 ;;; Font selection. | 42 ;;; Font selection. |
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 43 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
38 | 44 |
121 "Define a new face with name FACE, a symbol. | 127 "Define a new face with name FACE, a symbol. |
122 NO-INIT-FROM-RESOURCES non-nil means don't initialize frame-local | 128 NO-INIT-FROM-RESOURCES non-nil means don't initialize frame-local |
123 variants of FACE from X resources. (X resources recognized are found | 129 variants of FACE from X resources. (X resources recognized are found |
124 in the global variable `face-x-resources'.) If FACE is already known | 130 in the global variable `face-x-resources'.) If FACE is already known |
125 as a face, leave it unmodified. Value is FACE." | 131 as a face, leave it unmodified. Value is FACE." |
126 (interactive "SMake face: ") | 132 (interactive (list (read-from-minibuffer |
133 "Make face: " nil nil t 'face-name-history))) | |
127 (unless (facep face) | 134 (unless (facep face) |
128 ;; Make frame-local faces (this also makes the global one). | 135 ;; Make frame-local faces (this also makes the global one). |
129 (dolist (frame (frame-list)) | 136 (dolist (frame (frame-list)) |
130 (internal-make-lisp-face face frame)) | 137 (internal-make-lisp-face face frame)) |
131 ;; Add the face to the face menu. | 138 ;; Add the face to the face menu. |
138 | 145 |
139 | 146 |
140 (defun make-empty-face (face) | 147 (defun make-empty-face (face) |
141 "Define a new, empty face with name FACE. | 148 "Define a new, empty face with name FACE. |
142 If the face already exists, it is left unmodified. Value is FACE." | 149 If the face already exists, it is left unmodified. Value is FACE." |
143 (interactive "SMake empty face: ") | 150 (interactive (list (read-from-minibuffer |
151 "Make empty face: " nil nil t 'face-name-history))) | |
144 (make-face face 'no-init-from-resources)) | 152 (make-face face 'no-init-from-resources)) |
145 | 153 |
146 | 154 |
147 (defun copy-face (old-face new-face &optional frame new-frame) | 155 (defun copy-face (old-face new-face &optional frame new-frame) |
148 "Define a face just like OLD-FACE, with name NEW-FACE. | 156 "Define a face just like OLD-FACE, with name NEW-FACE. |
938 (format "%s (default %s): " prompt | 946 (format "%s (default %s): " prompt |
939 (if faces (mapconcat 'symbol-name faces ",") | 947 (if faces (mapconcat 'symbol-name faces ",") |
940 string-describing-default)) | 948 string-describing-default)) |
941 (format "%s: " prompt)) | 949 (format "%s: " prompt)) |
942 (completion-table-in-turn nonaliasfaces aliasfaces) | 950 (completion-table-in-turn nonaliasfaces aliasfaces) |
943 nil t nil nil | 951 nil t nil 'face-name-history |
944 (if faces (mapconcat 'symbol-name faces ",")))) | 952 (if faces (mapconcat 'symbol-name faces ",")))) |
945 ;; Canonicalize the output. | 953 ;; Canonicalize the output. |
946 (output | 954 (output |
947 (cond ((or (equal input "") (equal input '(""))) | 955 (cond ((or (equal input "") (equal input '(""))) |
948 faces) | 956 faces) |
1225 | 1233 |
1226 If REGEXP is non-nil, list only those faces with names matching | 1234 If REGEXP is non-nil, list only those faces with names matching |
1227 this regular expression. When called interactively with a prefix | 1235 this regular expression. When called interactively with a prefix |
1228 arg, prompt for a regular expression." | 1236 arg, prompt for a regular expression." |
1229 (interactive (list (and current-prefix-arg | 1237 (interactive (list (and current-prefix-arg |
1230 (read-string "List faces matching regexp: ")))) | 1238 (read-regexp "List faces matching regexp")))) |
1231 (let ((all-faces (zerop (length regexp))) | 1239 (let ((all-faces (zerop (length regexp))) |
1232 (frame (selected-frame)) | 1240 (frame (selected-frame)) |
1233 (max-length 0) | 1241 (max-length 0) |
1234 faces line-format | 1242 faces line-format |
1235 disp-frame window face-name) | 1243 disp-frame window face-name) |