diff options
| author | Juanma Barranquero | 2013-06-23 22:29:18 +0200 |
|---|---|---|
| committer | Juanma Barranquero | 2013-06-23 22:29:18 +0200 |
| commit | 5e400cb3ed7b0ffc5f166e4cd9c4e18f4e58c14e (patch) | |
| tree | 5d41ee2e61f503ee654c314b90da59c4d5218b79 | |
| parent | f3f9606c7acb4b3248dbe6f9fe16db6d5e46c3af (diff) | |
| download | emacs-5e400cb3ed7b0ffc5f166e4cd9c4e18f4e58c14e.tar.gz emacs-5e400cb3ed7b0ffc5f166e4cd9c4e18f4e58c14e.zip | |
lisp/faces.el: Minor changes.
(face-documentation): Simplify.
(read-face-attribute, tty-find-type, x-resolve-font-name):
Use `string-match-p'.
(list-faces-display): Use `string-match-p'. Simplify.
(face-spec-recalc): Check face to avoid face alias loops.
(read-color): Use `string-match-p' and non-capturing parenthesis.
| -rw-r--r-- | lisp/ChangeLog | 9 | ||||
| -rw-r--r-- | lisp/faces.el | 23 |
2 files changed, 19 insertions, 13 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ff41129b906..27e2b824953 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,12 @@ | |||
| 1 | 2013-06-23 Juanma Barranquero <lekktu@gmail.com> | ||
| 2 | |||
| 3 | * faces.el (face-documentation): Simplify. | ||
| 4 | (read-face-attribute, tty-find-type, x-resolve-font-name): | ||
| 5 | Use `string-match-p'. | ||
| 6 | (list-faces-display): Use `string-match-p'. Simplify. | ||
| 7 | (face-spec-recalc): Check face to avoid face alias loops. | ||
| 8 | (read-color): Use `string-match-p' and non-capturing parenthesis. | ||
| 9 | |||
| 1 | 2013-06-23 Lars Magne Ingebrigtsen <larsi@gnus.org> | 10 | 2013-06-23 Lars Magne Ingebrigtsen <larsi@gnus.org> |
| 2 | 11 | ||
| 3 | * net/shr.el (shr-rescale-image): Use the new | 12 | * net/shr.el (shr-rescale-image): Use the new |
diff --git a/lisp/faces.el b/lisp/faces.el index d570140e7e6..65039c095e5 100644 --- a/lisp/faces.el +++ b/lisp/faces.el | |||
| @@ -536,11 +536,9 @@ Use `face-attribute' for finer control." | |||
| 536 | (defun face-documentation (face) | 536 | (defun face-documentation (face) |
| 537 | "Get the documentation string for FACE. | 537 | "Get the documentation string for FACE. |
| 538 | If FACE is a face-alias, get the documentation for the target face." | 538 | If FACE is a face-alias, get the documentation for the target face." |
| 539 | (let ((alias (get face 'face-alias)) | 539 | (let ((alias (get face 'face-alias))) |
| 540 | doc) | ||
| 541 | (if alias | 540 | (if alias |
| 542 | (progn | 541 | (let ((doc (get alias 'face-documentation))) |
| 543 | (setq doc (get alias 'face-documentation)) | ||
| 544 | (format "%s is an alias for the face `%s'.%s" face alias | 542 | (format "%s is an alias for the face `%s'.%s" face alias |
| 545 | (if doc (format "\n%s" doc) | 543 | (if doc (format "\n%s" doc) |
| 546 | ""))) | 544 | ""))) |
| @@ -1171,7 +1169,7 @@ of a global face. Value is the new attribute value." | |||
| 1171 | ;; pixmap file name won't start with an open-paren. | 1169 | ;; pixmap file name won't start with an open-paren. |
| 1172 | (and (memq attribute '(:stipple :box :underline)) | 1170 | (and (memq attribute '(:stipple :box :underline)) |
| 1173 | (stringp new-value) | 1171 | (stringp new-value) |
| 1174 | (string-match "^[[(]" new-value) | 1172 | (string-match-p "^[[(]" new-value) |
| 1175 | (setq new-value (read new-value))) | 1173 | (setq new-value (read new-value))) |
| 1176 | new-value)) | 1174 | new-value)) |
| 1177 | 1175 | ||
| @@ -1272,7 +1270,7 @@ arg, prompt for a regular expression." | |||
| 1272 | (delq nil | 1270 | (delq nil |
| 1273 | (mapcar (lambda (f) | 1271 | (mapcar (lambda (f) |
| 1274 | (let ((s (symbol-name f))) | 1272 | (let ((s (symbol-name f))) |
| 1275 | (when (or all-faces (string-match regexp s)) | 1273 | (when (or all-faces (string-match-p regexp s)) |
| 1276 | (setq max-length (max (length s) max-length)) | 1274 | (setq max-length (max (length s) max-length)) |
| 1277 | f))) | 1275 | f))) |
| 1278 | (sort (face-list) #'string-lessp)))) | 1276 | (sort (face-list) #'string-lessp)))) |
| @@ -1328,10 +1326,8 @@ arg, prompt for a regular expression." | |||
| 1328 | (setq disp-frame (if window (window-frame window) | 1326 | (setq disp-frame (if window (window-frame window) |
| 1329 | (car (frame-list)))) | 1327 | (car (frame-list)))) |
| 1330 | (or (eq frame disp-frame) | 1328 | (or (eq frame disp-frame) |
| 1331 | (let ((faces (face-list))) | 1329 | (dolist (face (face-list)) |
| 1332 | (while faces | 1330 | (copy-face face face frame disp-frame))))) |
| 1333 | (copy-face (car faces) (car faces) frame disp-frame) | ||
| 1334 | (setq faces (cdr faces))))))) | ||
| 1335 | 1331 | ||
| 1336 | 1332 | ||
| 1337 | (defun describe-face (face &optional frame) | 1333 | (defun describe-face (face &optional frame) |
| @@ -1631,6 +1627,7 @@ the face's attributes on existing frames." | |||
| 1631 | "Reset the face attributes of FACE on FRAME according to its specs. | 1627 | "Reset the face attributes of FACE on FRAME according to its specs. |
| 1632 | This applies the defface/custom spec first, then the custom theme specs, | 1628 | This applies the defface/custom spec first, then the custom theme specs, |
| 1633 | then the override spec." | 1629 | then the override spec." |
| 1630 | (check-face face) | ||
| 1634 | (while (get face 'face-alias) | 1631 | (while (get face 'face-alias) |
| 1635 | (setq face (get face 'face-alias))) | 1632 | (setq face (get face 'face-alias))) |
| 1636 | (face-spec-reset-face face frame) | 1633 | (face-spec-reset-face face frame) |
| @@ -1850,7 +1847,7 @@ resulting color name in the echo area." | |||
| 1850 | (when (and convert-to-RGB | 1847 | (when (and convert-to-RGB |
| 1851 | (not (string-equal color ""))) | 1848 | (not (string-equal color ""))) |
| 1852 | (let ((components (x-color-values color))) | 1849 | (let ((components (x-color-values color))) |
| 1853 | (unless (string-match "^#\\([a-fA-F0-9][a-fA-F0-9][a-fA-F0-9]\\)+$" color) | 1850 | (unless (string-match-p "^#\\(?:[a-fA-F0-9][a-fA-F0-9][a-fA-F0-9]\\)+$" color) |
| 1854 | (setq color (format "#%04X%04X%04X" | 1851 | (setq color (format "#%04X%04X%04X" |
| 1855 | (logand 65535 (nth 0 components)) | 1852 | (logand 65535 (nth 0 components)) |
| 1856 | (logand 65535 (nth 1 components)) | 1853 | (logand 65535 (nth 1 components)) |
| @@ -2096,7 +2093,7 @@ the above example." | |||
| 2096 | (not (funcall pred type))) | 2093 | (not (funcall pred type))) |
| 2097 | ;; Strip off last hyphen and what follows, then try again | 2094 | ;; Strip off last hyphen and what follows, then try again |
| 2098 | (setq type | 2095 | (setq type |
| 2099 | (if (setq hyphend (string-match "[-_][^-_]+$" type)) | 2096 | (if (setq hyphend (string-match-p "[-_][^-_]+$" type)) |
| 2100 | (substring type 0 hyphend) | 2097 | (substring type 0 hyphend) |
| 2101 | nil)))) | 2098 | nil)))) |
| 2102 | type) | 2099 | type) |
| @@ -2617,7 +2614,7 @@ also the same size as FACE on FRAME, or fail." | |||
| 2617 | (let ((fonts (x-list-fonts pattern face frame 1))) | 2614 | (let ((fonts (x-list-fonts pattern face frame 1))) |
| 2618 | (or fonts | 2615 | (or fonts |
| 2619 | (if face | 2616 | (if face |
| 2620 | (if (string-match "\\*" pattern) | 2617 | (if (string-match-p "\\*" pattern) |
| 2621 | (if (null (face-font face)) | 2618 | (if (null (face-font face)) |
| 2622 | (error "No matching fonts are the same height as the frame default font") | 2619 | (error "No matching fonts are the same height as the frame default font") |
| 2623 | (error "No matching fonts are the same height as face `%s'" face)) | 2620 | (error "No matching fonts are the same height as face `%s'" face)) |