aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorChong Yidong2012-03-21 15:02:13 +0800
committerChong Yidong2012-03-21 15:02:13 +0800
commitfb5b8aca9928223c3fef042f1de4b50cd08fde43 (patch)
treeb1da6f261d64e95a4bbdf0566157c3919185adb2 /lisp
parentdc9924b8bd30e0f3f43b552070f6cac5c11942f7 (diff)
downloademacs-fb5b8aca9928223c3fef042f1de4b50cd08fde43.tar.gz
emacs-fb5b8aca9928223c3fef042f1de4b50cd08fde43.zip
Updates to Display chapter of Lisp manual.
* doc/lispref/display.texi (The Echo Area): Add xref to Output Streams. (Displaying Messages): Improve doc of message. (Echo Area Customization, Invisible Text): Copyedits. (Invisible Text): Mention that spec comparison is done with eq. (Width): Improve doc of char-width. (Faces): Recommend using symbol instead of string for face name. Minor clarifications. (Defining Faces): Copyedits. Update face example. (Attribute Functions): Mark set-face-foreground etc as commands. (Face Remapping): Mention text-scale-adjust. Clarify face-remapping-alist and related docs. (Face Functions): Don't document make-face or copy-face. * lisp/faces.el (make-face, make-empty-face, copy-face): * lisp/face-remap.el (face-remap-add-relative, face-remap-set-base): Doc fixes. * src/xfaces.c (Vface_remapping_alist): Doc fix.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/face-remap.el42
-rw-r--r--lisp/faces.el47
3 files changed, 52 insertions, 43 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 3699bb0f5bd..ea7d81bb969 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12012-03-21 Chong Yidong <cyd@gnu.org>
2
3 * faces.el (make-face, make-empty-face, copy-face):
4 * face-remap.el (face-remap-add-relative, face-remap-set-base):
5 Doc fixes.
6
12012-03-21 Stefan Monnier <monnier@iro.umontreal.ca> 72012-03-21 Stefan Monnier <monnier@iro.umontreal.ca>
2 8
3 * wid-edit.el (widget-complete-field): Remove (bug#11051). 9 * wid-edit.el (widget-complete-field): Remove (bug#11051).
diff --git a/lisp/face-remap.el b/lisp/face-remap.el
index 3af9e31a6f7..ca7a28328f9 100644
--- a/lisp/face-remap.el
+++ b/lisp/face-remap.el
@@ -106,21 +106,20 @@ The list structure of ENTRY may be destructively modified."
106;;;###autoload 106;;;###autoload
107(defun face-remap-add-relative (face &rest specs) 107(defun face-remap-add-relative (face &rest specs)
108 "Add a face remapping entry of FACE to SPECS in the current buffer. 108 "Add a face remapping entry of FACE to SPECS in the current buffer.
109 109Return a cookie which can be used to delete this remapping with
110Return a cookie which can be used to delete the remapping with
111`face-remap-remove-relative'. 110`face-remap-remove-relative'.
112 111
113SPECS can be any value suitable for the `face' text property, 112The remaining arguments, SPECS, should be either a list of face
114including a face name, a list of face names, or a face-attribute 113names, or a property list of face attribute/value pairs. The
115property list. The attributes given by SPECS will be merged with 114remapping specified by SPECS takes effect alongside the
116any other currently active face remappings of FACE, and with the 115remappings from other calls to `face-remap-add-relative', as well
117global definition of FACE. An attempt is made to sort multiple 116as the normal definition of FACE (at lowest priority). This
118entries so that entries with relative face-attributes are applied 117function tries to sort multiple remappings for the same face, so
119after entries with absolute face-attributes. 118that remappings specifying relative face attributes are applied
120 119after remappings specifying absolute face attributes.
121The base (lowest priority) remapping may be set to a specific 120
122value, instead of the default of the global face definition, 121The base (lowest priority) remapping may be set to something
123using `face-remap-set-base'." 122other than the normal definition of FACE via `face-remap-set-base'."
124 (while (and (consp specs) (null (cdr specs))) 123 (while (and (consp specs) (null (cdr specs)))
125 (setq specs (car specs))) 124 (setq specs (car specs)))
126 (make-local-variable 'face-remapping-alist) 125 (make-local-variable 'face-remapping-alist)
@@ -148,7 +147,9 @@ COOKIE should be the return value from that function."
148 147
149;;;###autoload 148;;;###autoload
150(defun face-remap-reset-base (face) 149(defun face-remap-reset-base (face)
151 "Set the base remapping of FACE to inherit from FACE's global definition." 150 "Set the base remapping of FACE to the normal definition of FACE.
151This causes the remappings specified by `face-remap-add-relative'
152to apply on top of the normal definition of FACE."
152 (let ((entry (assq face face-remapping-alist))) 153 (let ((entry (assq face face-remapping-alist)))
153 (when entry 154 (when entry
154 ;; If there's nothing except a base remapping, we simply remove 155 ;; If there's nothing except a base remapping, we simply remove
@@ -163,10 +164,15 @@ COOKIE should be the return value from that function."
163;;;###autoload 164;;;###autoload
164(defun face-remap-set-base (face &rest specs) 165(defun face-remap-set-base (face &rest specs)
165 "Set the base remapping of FACE in the current buffer to SPECS. 166 "Set the base remapping of FACE in the current buffer to SPECS.
166If SPECS is empty, the default base remapping is restored, which 167This causes the remappings specified by `face-remap-add-relative'
167inherits from the global definition of FACE; note that this is 168to apply on top of the face specification given by SPECS. SPECS
168different from SPECS containing a single value `nil', which does 169should be either a list of face names, or a property list of face
169not inherit from the global definition of FACE." 170attribute/value pairs.
171
172If SPECS is empty, call `face-remap-reset-base' to use the normal
173definition of FACE as the base remapping; note that this is
174different from SPECS containing a single value `nil', which means
175not to inherit from the global definition of FACE at all."
170 (while (and (consp specs) (not (null (car specs))) (null (cdr specs))) 176 (while (and (consp specs) (not (null (car specs))) (null (cdr specs)))
171 (setq specs (car specs))) 177 (setq specs (car specs)))
172 (if (or (null specs) 178 (if (or (null specs)
diff --git a/lisp/faces.el b/lisp/faces.el
index 34fad66ce27..0256f8d951a 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -122,15 +122,13 @@ REGISTRY, ALTERNATIVE1, ALTERNATIVE2, and etc."
122 "Return a list of all defined faces." 122 "Return a list of all defined faces."
123 (mapcar #'car face-new-frame-defaults)) 123 (mapcar #'car face-new-frame-defaults))
124 124
125
126;;; ### If not frame-local initialize by what X resources?
127
128(defun make-face (face &optional no-init-from-resources) 125(defun make-face (face &optional no-init-from-resources)
129 "Define a new face with name FACE, a symbol. 126 "Define a new face with name FACE, a symbol.
130NO-INIT-FROM-RESOURCES non-nil means don't initialize frame-local 127Do not call this directly from Lisp code; use `defface' instead.
131variants of FACE from X resources. (X resources recognized are found 128
132in the global variable `face-x-resources'.) If FACE is already known 129If NO-INIT-FROM-RESOURCES is non-nil, don't initialize face
133as a face, leave it unmodified. Value is FACE." 130attributes from X resources. If FACE is already known as a face,
131leave it unmodified. Return FACE."
134 (interactive (list (read-from-minibuffer 132 (interactive (list (read-from-minibuffer
135 "Make face: " nil nil t 'face-name-history))) 133 "Make face: " nil nil t 'face-name-history)))
136 (unless (facep face) 134 (unless (facep face)
@@ -145,31 +143,30 @@ as a face, leave it unmodified. Value is FACE."
145 (make-face-x-resource-internal face))) 143 (make-face-x-resource-internal face)))
146 face) 144 face)
147 145
148
149(defun make-empty-face (face) 146(defun make-empty-face (face)
150 "Define a new, empty face with name FACE. 147 "Define a new, empty face with name FACE.
151If the face already exists, it is left unmodified. Value is FACE." 148Do not call this directly from Lisp code; use `defface' instead."
152 (interactive (list (read-from-minibuffer 149 (interactive (list (read-from-minibuffer
153 "Make empty face: " nil nil t 'face-name-history))) 150 "Make empty face: " nil nil t 'face-name-history)))
154 (make-face face 'no-init-from-resources)) 151 (make-face face 'no-init-from-resources))
155 152
156
157(defun copy-face (old-face new-face &optional frame new-frame) 153(defun copy-face (old-face new-face &optional frame new-frame)
158 "Define a face just like OLD-FACE, with name NEW-FACE. 154 "Define a face named NEW-FACE, which is a copy of OLD-FACE.
159 155This function does not copy face customization data, so NEW-FACE
160If NEW-FACE already exists as a face, it is modified to be like 156will not be made customizable. Most Lisp code should not call
161OLD-FACE. If it doesn't already exist, it is created. 157this function; use `defface' with :inherit instead.
162 158
163If the optional argument FRAME is given as a frame, NEW-FACE is 159If NEW-FACE already exists as a face, modify it to be like
164changed on FRAME only. 160OLD-FACE. If NEW-FACE doesn't already exist, create it.
165If FRAME is t, the frame-independent default specification for OLD-FACE 161
166is copied to NEW-FACE. 162If the optional argument FRAME is a frame, change NEW-FACE on
167If FRAME is nil, copying is done for the frame-independent defaults 163FRAME only. If FRAME is t, copy the frame-independent default
168and for each existing frame. 164specification for OLD-FACE to NEW-FACE. If FRAME is nil, copy
169 165the defaults as well as the faces on each existing frame.
170If the optional fourth argument NEW-FRAME is given, 166
171copy the information from face OLD-FACE on frame FRAME 167If the optional fourth argument NEW-FRAME is given, copy the
172to NEW-FACE on frame NEW-FRAME. In this case, FRAME may not be nil." 168information from face OLD-FACE on frame FRAME to NEW-FACE on
169frame NEW-FRAME. In this case, FRAME must not be nil."
173 (let ((inhibit-quit t)) 170 (let ((inhibit-quit t))
174 (if (null frame) 171 (if (null frame)
175 (progn 172 (progn