emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r113147: lisp/faces.el: Minor changes.


From: Juanma Barranquero
Subject: [Emacs-diffs] trunk r113147: lisp/faces.el: Minor changes.
Date: Sun, 23 Jun 2013 20:29:26 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 113147
revision-id: address@hidden
parent: address@hidden
committer: Juanma Barranquero <address@hidden>
branch nick: trunk
timestamp: Sun 2013-06-23 22:29:18 +0200
message:
  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.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/faces.el                  faces.el-20091113204419-o5vbwnq5f7feedwu-562
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-06-23 19:24:27 +0000
+++ b/lisp/ChangeLog    2013-06-23 20:29:18 +0000
@@ -1,3 +1,12 @@
+2013-06-23  Juanma Barranquero  <address@hidden>
+
+       * faces.el (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.
+
 2013-06-23  Lars Magne Ingebrigtsen  <address@hidden>
 
        * net/shr.el (shr-rescale-image): Use the new

=== modified file 'lisp/faces.el'
--- a/lisp/faces.el     2013-05-15 23:55:41 +0000
+++ b/lisp/faces.el     2013-06-23 20:29:18 +0000
@@ -536,11 +536,9 @@
 (defun face-documentation (face)
   "Get the documentation string for FACE.
 If FACE is a face-alias, get the documentation for the target face."
-  (let ((alias (get face 'face-alias))
-        doc)
+  (let ((alias (get face 'face-alias)))
     (if alias
-        (progn
-          (setq doc (get alias 'face-documentation))
+        (let ((doc (get alias 'face-documentation)))
          (format "%s is an alias for the face `%s'.%s" face alias
                   (if doc (format "\n%s" doc)
                     "")))
@@ -1171,7 +1169,7 @@
     ;; pixmap file name won't start with an open-paren.
     (and (memq attribute '(:stipple :box :underline))
         (stringp new-value)
-        (string-match "^[[(]" new-value)
+        (string-match-p "^[[(]" new-value)
         (setq new-value (read new-value)))
     new-value))
 
@@ -1272,7 +1270,7 @@
          (delq nil
                (mapcar (lambda (f)
                          (let ((s (symbol-name f)))
-                           (when (or all-faces (string-match regexp s))
+                           (when (or all-faces (string-match-p regexp s))
                              (setq max-length (max (length s) max-length))
                              f)))
                        (sort (face-list) #'string-lessp))))
@@ -1328,10 +1326,8 @@
     (setq disp-frame (if window (window-frame window)
                       (car (frame-list))))
     (or (eq frame disp-frame)
-       (let ((faces (face-list)))
-         (while faces
-           (copy-face (car faces) (car faces) frame disp-frame)
-           (setq faces (cdr faces)))))))
+       (dolist (face (face-list))
+         (copy-face face face frame disp-frame)))))
 
 
 (defun describe-face (face &optional frame)
@@ -1631,6 +1627,7 @@
   "Reset the face attributes of FACE on FRAME according to its specs.
 This applies the defface/custom spec first, then the custom theme specs,
 then the override spec."
+  (check-face face)
   (while (get face 'face-alias)
     (setq face (get face 'face-alias)))
   (face-spec-reset-face face frame)
@@ -1850,7 +1847,7 @@
       (when (and convert-to-RGB
                 (not (string-equal color "")))
        (let ((components (x-color-values color)))
-         (unless (string-match "^#\\([a-fA-F0-9][a-fA-F0-9][a-fA-F0-9]\\)+$" 
color)
+         (unless (string-match-p 
"^#\\(?:[a-fA-F0-9][a-fA-F0-9][a-fA-F0-9]\\)+$" color)
            (setq color (format "#%04X%04X%04X"
                                (logand 65535 (nth 0 components))
                                (logand 65535 (nth 1 components))
@@ -2096,7 +2093,7 @@
                (not (funcall pred type)))
       ;; Strip off last hyphen and what follows, then try again
       (setq type
-           (if (setq hyphend (string-match "[-_][^-_]+$" type))
+           (if (setq hyphend (string-match-p "[-_][^-_]+$" type))
                (substring type 0 hyphend)
              nil))))
   type)
@@ -2617,7 +2614,7 @@
       (let ((fonts (x-list-fonts pattern face frame 1)))
        (or fonts
            (if face
-               (if (string-match "\\*" pattern)
+               (if (string-match-p "\\*" pattern)
                    (if (null (face-font face))
                        (error "No matching fonts are the same height as the 
frame default font")
                      (error "No matching fonts are the same height as face 
`%s'" face))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]