diff options
| author | Chong Yidong | 2012-03-21 15:02:13 +0800 |
|---|---|---|
| committer | Chong Yidong | 2012-03-21 15:02:13 +0800 |
| commit | fb5b8aca9928223c3fef042f1de4b50cd08fde43 (patch) | |
| tree | b1da6f261d64e95a4bbdf0566157c3919185adb2 /lisp | |
| parent | dc9924b8bd30e0f3f43b552070f6cac5c11942f7 (diff) | |
| download | emacs-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/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/face-remap.el | 42 | ||||
| -rw-r--r-- | lisp/faces.el | 47 |
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 @@ | |||
| 1 | 2012-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 | |||
| 1 | 2012-03-21 Stefan Monnier <monnier@iro.umontreal.ca> | 7 | 2012-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 | 109 | Return a cookie which can be used to delete this remapping with | |
| 110 | Return a cookie which can be used to delete the remapping with | ||
| 111 | `face-remap-remove-relative'. | 110 | `face-remap-remove-relative'. |
| 112 | 111 | ||
| 113 | SPECS can be any value suitable for the `face' text property, | 112 | The remaining arguments, SPECS, should be either a list of face |
| 114 | including a face name, a list of face names, or a face-attribute | 113 | names, or a property list of face attribute/value pairs. The |
| 115 | property list. The attributes given by SPECS will be merged with | 114 | remapping specified by SPECS takes effect alongside the |
| 116 | any other currently active face remappings of FACE, and with the | 115 | remappings from other calls to `face-remap-add-relative', as well |
| 117 | global definition of FACE. An attempt is made to sort multiple | 116 | as the normal definition of FACE (at lowest priority). This |
| 118 | entries so that entries with relative face-attributes are applied | 117 | function tries to sort multiple remappings for the same face, so |
| 119 | after entries with absolute face-attributes. | 118 | that remappings specifying relative face attributes are applied |
| 120 | 119 | after remappings specifying absolute face attributes. | |
| 121 | The base (lowest priority) remapping may be set to a specific | 120 | |
| 122 | value, instead of the default of the global face definition, | 121 | The base (lowest priority) remapping may be set to something |
| 123 | using `face-remap-set-base'." | 122 | other 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. |
| 151 | This causes the remappings specified by `face-remap-add-relative' | ||
| 152 | to 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. |
| 166 | If SPECS is empty, the default base remapping is restored, which | 167 | This causes the remappings specified by `face-remap-add-relative' |
| 167 | inherits from the global definition of FACE; note that this is | 168 | to apply on top of the face specification given by SPECS. SPECS |
| 168 | different from SPECS containing a single value `nil', which does | 169 | should be either a list of face names, or a property list of face |
| 169 | not inherit from the global definition of FACE." | 170 | attribute/value pairs. |
| 171 | |||
| 172 | If SPECS is empty, call `face-remap-reset-base' to use the normal | ||
| 173 | definition of FACE as the base remapping; note that this is | ||
| 174 | different from SPECS containing a single value `nil', which means | ||
| 175 | not 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. |
| 130 | NO-INIT-FROM-RESOURCES non-nil means don't initialize frame-local | 127 | Do not call this directly from Lisp code; use `defface' instead. |
| 131 | variants of FACE from X resources. (X resources recognized are found | 128 | |
| 132 | in the global variable `face-x-resources'.) If FACE is already known | 129 | If NO-INIT-FROM-RESOURCES is non-nil, don't initialize face |
| 133 | as a face, leave it unmodified. Value is FACE." | 130 | attributes from X resources. If FACE is already known as a face, |
| 131 | leave 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. |
| 151 | If the face already exists, it is left unmodified. Value is FACE." | 148 | Do 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 | 155 | This function does not copy face customization data, so NEW-FACE | |
| 160 | If NEW-FACE already exists as a face, it is modified to be like | 156 | will not be made customizable. Most Lisp code should not call |
| 161 | OLD-FACE. If it doesn't already exist, it is created. | 157 | this function; use `defface' with :inherit instead. |
| 162 | 158 | ||
| 163 | If the optional argument FRAME is given as a frame, NEW-FACE is | 159 | If NEW-FACE already exists as a face, modify it to be like |
| 164 | changed on FRAME only. | 160 | OLD-FACE. If NEW-FACE doesn't already exist, create it. |
| 165 | If FRAME is t, the frame-independent default specification for OLD-FACE | 161 | |
| 166 | is copied to NEW-FACE. | 162 | If the optional argument FRAME is a frame, change NEW-FACE on |
| 167 | If FRAME is nil, copying is done for the frame-independent defaults | 163 | FRAME only. If FRAME is t, copy the frame-independent default |
| 168 | and for each existing frame. | 164 | specification for OLD-FACE to NEW-FACE. If FRAME is nil, copy |
| 169 | 165 | the defaults as well as the faces on each existing frame. | |
| 170 | If the optional fourth argument NEW-FRAME is given, | 166 | |
| 171 | copy the information from face OLD-FACE on frame FRAME | 167 | If the optional fourth argument NEW-FRAME is given, copy the |
| 172 | to NEW-FACE on frame NEW-FRAME. In this case, FRAME may not be nil." | 168 | information from face OLD-FACE on frame FRAME to NEW-FACE on |
| 169 | frame 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 |