aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorGlenn Morris2012-11-14 23:30:46 -0800
committerGlenn Morris2012-11-14 23:30:46 -0800
commitbde3c6c0f79ab814e12ea0f04b06625f91f5cd52 (patch)
tree1c5120a620b7fd140b6325cfa0a42173d155589e /lisp
parente2e13f1831a71b558b3625c4ecf3d35100236870 (diff)
downloademacs-bde3c6c0f79ab814e12ea0f04b06625f91f5cd52.tar.gz
emacs-bde3c6c0f79ab814e12ea0f04b06625f91f5cd52.zip
Fixes related to face underlining
* lisp/faces.el (face-underline-p): Doc fix. Handle :underline being things other than `t' (a string, a list). (face-inverse-video-p): Doc fix. (set-face-underline): Rename it back from set-face-underline-p. Doc fix. Allow interactive input of values other than t. (read-face-attribute): Apply formatting to :underline, since like :box and :stipple it can take list values. * doc/lispref/display.texi (Face Attributes): Fix :underline COLOR description. (Attribute Functions): Update for set-face-underline rename. Tweak descriptions of face-underline-p, face-inverse-video-p. * etc/NEWS: Related edit.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/faces.el58
2 files changed, 43 insertions, 23 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 01ccb886434..e53b667b2b2 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,13 @@
12012-11-15 Glenn Morris <rgm@gnu.org> 12012-11-15 Glenn Morris <rgm@gnu.org>
2 2
3 * faces.el (face-underline-p): Doc fix. Handle :underline being
4 things other than `t' (a string, a list).
5 (face-inverse-video-p): Doc fix.
6 (set-face-underline): Rename it back from set-face-underline-p.
7 Doc fix. Allow interactive input of values other than t.
8 (read-face-attribute): Apply formatting to :underline,
9 since like :box and :stipple it can take list values.
10
3 * term.el (ansi-term): Don't let C-x escape-char binding 11 * term.el (ansi-term): Don't let C-x escape-char binding
4 clobber the more standard C-c binding. (Bug#12842) 12 clobber the more standard C-c binding. (Bug#12842)
5 13
diff --git a/lisp/faces.el b/lisp/faces.el
index f5ef88d08b0..d07c4d6f5a5 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 (not (memq (face-attribute face :underline frame) '(unspecified 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" ())