aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/faces.el
diff options
context:
space:
mode:
authorEli Zaretskii2012-11-17 20:00:16 +0200
committerEli Zaretskii2012-11-17 20:00:16 +0200
commitcf2d22b874ca2df0072e32ee641e8efffe4abd6d (patch)
tree1795142ec7861fc85c61adc90f03265b69041556 /lisp/faces.el
parent3c4ca7155293ffc2d04708007131bcbc882d8913 (diff)
parent6ad30855c02908fdd99d9b11943719e185e65ee3 (diff)
downloademacs-cf2d22b874ca2df0072e32ee641e8efffe4abd6d.tar.gz
emacs-cf2d22b874ca2df0072e32ee641e8efffe4abd6d.zip
Merge from trunk.
Diffstat (limited to 'lisp/faces.el')
-rw-r--r--lisp/faces.el58
1 files changed, 35 insertions, 23 deletions
diff --git a/lisp/faces.el b/lisp/faces.el
index f5ef88d08b0..9e0ca962499 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -487,16 +487,21 @@ with the `default' face (which is always completely specified)."
487(defalias 'face-background-pixmap 'face-stipple) 487(defalias 'face-background-pixmap 'face-stipple)
488 488
489 489
490;; FIXME all of these -p functions ignore inheritance (cf face-stipple).
491;; Ie, a face that inherits from an underlined face but does not
492;; specify :underline will return nil.
493;; So these functions don't actually tell you anything about how the
494;; face will _appear_. So not very useful IMO.
490(defun face-underline-p (face &optional frame) 495(defun face-underline-p (face &optional frame)
491 "Return non-nil if FACE is underlined. 496 "Return non-nil if FACE specifies a non-nil underlining.
492If the optional argument FRAME is given, report on face FACE in that frame. 497If the optional argument FRAME is given, report on face FACE in that frame.
493If FRAME is t, report on the defaults for face FACE (for new frames). 498If FRAME is t, report on the defaults for face FACE (for new frames).
494If FRAME is omitted or nil, use the selected frame." 499If FRAME is omitted or nil, use the selected frame."
495 (eq (face-attribute face :underline frame) t)) 500 (face-attribute-specified-or (face-attribute face :underline frame) nil))
496 501
497 502
498(defun face-inverse-video-p (face &optional frame) 503(defun face-inverse-video-p (face &optional frame)
499 "Return non-nil if FACE is in inverse video on FRAME. 504 "Return non-nil if FACE specifies a non-nil inverse-video.
500If the optional argument FRAME is given, report on face FACE in that frame. 505If the optional argument FRAME is given, report on face FACE in that frame.
501If FRAME is t, report on the defaults for face FACE (for new frames). 506If FRAME is t, report on the defaults for face FACE (for new frames).
502If FRAME is omitted or nil, use the selected frame." 507If FRAME is omitted or nil, use the selected frame."
@@ -837,21 +842,24 @@ and DATA is a string, containing the raw bits of the bitmap."
837 (set-face-attribute face frame :stipple (or stipple 'unspecified))) 842 (set-face-attribute face frame :stipple (or stipple 'unspecified)))
838 843
839 844
840(defun set-face-underline-p (face underline &optional frame) 845(defun set-face-underline (face underline &optional frame)
841 "Specify whether face FACE is underlined. 846 "Specify whether face FACE is underlined.
842UNDERLINE nil means FACE explicitly doesn't underline. 847UNDERLINE nil means FACE explicitly doesn't underline.
843UNDERLINE non-nil means FACE explicitly does underlining 848UNDERLINE t means FACE underlines with its foreground color.
844with the same of the foreground color. 849If UNDERLINE is a string, underline with that color.
845If UNDERLINE is a string, underline with the color named UNDERLINE. 850
851UNDERLINE may also be a list of the form (:color COLOR :style STYLE),
852where COLOR is a string or `foreground-color', and STYLE is either
853`line' or `wave'. :color may be omitted, which means to use the
854foreground color. :style may be omitted, which means to use a line.
855
846FRAME nil or not specified means change face on all frames. 856FRAME nil or not specified means change face on all frames.
847Use `set-face-attribute' to ``unspecify'' underlining." 857Use `set-face-attribute' to ``unspecify'' underlining."
848 (interactive 858 (interactive (read-face-and-attribute :underline))
849 (let ((list (read-face-and-attribute :underline)))
850 (list (car list) (eq (car (cdr list)) t))))
851 (set-face-attribute face frame :underline underline)) 859 (set-face-attribute face frame :underline underline))
852 860
853(define-obsolete-function-alias 'set-face-underline 861(define-obsolete-function-alias 'set-face-underline-p
854 'set-face-underline-p "22.1") 862 'set-face-underline "24.3")
855 863
856 864
857(defun set-face-inverse-video-p (face inverse-video-p &optional frame) 865(defun set-face-inverse-video-p (face inverse-video-p &optional frame)
@@ -866,6 +874,9 @@ Use `set-face-attribute' to ``unspecify'' the inverse video attribute."
866 (set-face-attribute face frame :inverse-video inverse-video-p)) 874 (set-face-attribute face frame :inverse-video inverse-video-p))
867 875
868 876
877;; The -p suffix is a hostage to fortune. What if we want to extend
878;; this to allow more than boolean options? Exactly this happened
879;; to set-face-underline-p.
869(defun set-face-bold-p (face bold-p &optional frame) 880(defun set-face-bold-p (face bold-p &optional frame)
870 "Specify whether face FACE is bold. 881 "Specify whether face FACE is bold.
871BOLD-P non-nil means FACE should explicitly display bold. 882BOLD-P non-nil means FACE should explicitly display bold.
@@ -1114,6 +1125,9 @@ name of the attribute for prompting. Value is the new attribute value."
1114 (string-to-number new-value))))) 1125 (string-to-number new-value)))))
1115 1126
1116 1127
1128;; FIXME this does allow you to enter the list forms of :box,
1129;; :stipple, or :underline, because face-valid-attribute-values does
1130;; not return those forms.
1117(defun read-face-attribute (face attribute &optional frame) 1131(defun read-face-attribute (face attribute &optional frame)
1118 "Interactively read a new value for FACE's ATTRIBUTE. 1132 "Interactively read a new value for FACE's ATTRIBUTE.
1119Optional argument FRAME nil or unspecified means read an attribute value 1133Optional argument FRAME nil or unspecified means read an attribute value
@@ -1125,12 +1139,11 @@ of a global face. Value is the new attribute value."
1125 ;; Represent complex attribute values as strings by printing them 1139 ;; Represent complex attribute values as strings by printing them
1126 ;; out. Stipple can be a vector; (WIDTH HEIGHT DATA). Box can be 1140 ;; out. Stipple can be a vector; (WIDTH HEIGHT DATA). Box can be
1127 ;; a list `(:width WIDTH :color COLOR)' or `(:width WIDTH :shadow 1141 ;; a list `(:width WIDTH :color COLOR)' or `(:width WIDTH :shadow
1128 ;; SHADOW)'. 1142 ;; SHADOW)'. Underline can be `(:color COLOR :style STYLE)'.
1129 (when (and (or (eq attribute :stipple) 1143 (and (memq attribute '(:box :stipple :underline))
1130 (eq attribute :box)) 1144 (or (consp old-value)
1131 (or (consp old-value) 1145 (vectorp old-value))
1132 (vectorp old-value))) 1146 (setq old-value (prin1-to-string old-value)))
1133 (setq old-value (prin1-to-string old-value)))
1134 (cond ((listp valid) 1147 (cond ((listp valid)
1135 (let ((default 1148 (let ((default
1136 (or (car (rassoc old-value valid)) 1149 (or (car (rassoc old-value valid))
@@ -1160,11 +1173,10 @@ of a global face. Value is the new attribute value."
1160 ;; Convert stipple and box value text we read back to a list or 1173 ;; Convert stipple and box value text we read back to a list or
1161 ;; vector if it looks like one. This makes the assumption that a 1174 ;; vector if it looks like one. This makes the assumption that a
1162 ;; pixmap file name won't start with an open-paren. 1175 ;; pixmap file name won't start with an open-paren.
1163 (when (and (or (eq attribute :stipple) 1176 (and (memq attribute '(:stipple :box :underline))
1164 (eq attribute :box)) 1177 (stringp new-value)
1165 (stringp new-value) 1178 (string-match "^[[(]" new-value)
1166 (string-match "^[[(]" new-value)) 1179 (setq new-value (read new-value)))
1167 (setq new-value (read new-value)))
1168 new-value)) 1180 new-value))
1169 1181
1170(declare-function fontset-list "fontset.c" ()) 1182(declare-function fontset-list "fontset.c" ())