diff options
| author | Miles Bader | 2008-06-05 02:42:55 +0000 |
|---|---|---|
| committer | Miles Bader | 2008-06-05 02:42:55 +0000 |
| commit | e40a85cd56dc9b8da225767a79fe66c7f686351c (patch) | |
| tree | 83bb60bc9dcf59a1e28ebfaa57c3de015ae85ed9 /lisp | |
| parent | ed25242f87baeb6d74695da0103f87cb611b6f8c (diff) | |
| download | emacs-e40a85cd56dc9b8da225767a79fe66c7f686351c.tar.gz emacs-e40a85cd56dc9b8da225767a79fe66c7f686351c.zip | |
Rename functions in lisp/face-remap.el
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-1208
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 11 | ||||
| -rw-r--r-- | lisp/face-remap.el | 70 |
2 files changed, 46 insertions, 35 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 3ecb91a3bb6..a36517e9cee 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -36,6 +36,17 @@ | |||
| 36 | 36 | ||
| 37 | 2008-06-05 Miles Bader <miles@gnu.org> | 37 | 2008-06-05 Miles Bader <miles@gnu.org> |
| 38 | 38 | ||
| 39 | * face-remap.el | ||
| 40 | (face-remap-add-relative): Renamed from `add-relative-face-remapping'. | ||
| 41 | (face-remap-remove-relative): Renamed from | ||
| 42 | `remove-relative-face-remapping'. | ||
| 43 | (face-remap-reset-base): Renamed from | ||
| 44 | `set-default-base-face-remapping'. | ||
| 45 | (face-remap-set-base): Renamed from `set-base-face-remapping'. | ||
| 46 | (text-scale-increase): Renamed from `increase-buffer-face-height'. | ||
| 47 | (text-scale-decrease): Renamed from `decrease-buffer-face-height'. | ||
| 48 | (text-scale-adjust): Renamed from `adjust-buffer-face-height'. | ||
| 49 | |||
| 39 | * face-remap.el (variable-pitch-mode): Autoload. | 50 | * face-remap.el (variable-pitch-mode): Autoload. |
| 40 | 51 | ||
| 41 | 2008-06-04 Sam Steingold <sds@gnu.org> | 52 | 2008-06-04 Sam Steingold <sds@gnu.org> |
diff --git a/lisp/face-remap.el b/lisp/face-remap.el index c690e6a72d7..956c215afdd 100644 --- a/lisp/face-remap.el +++ b/lisp/face-remap.el | |||
| @@ -36,8 +36,8 @@ | |||
| 36 | ;; The "specs" values are a lists of face names or face attribute-value | 36 | ;; The "specs" values are a lists of face names or face attribute-value |
| 37 | ;; pairs, and are merged together, with earlier values taking precedence. | 37 | ;; pairs, and are merged together, with earlier values taking precedence. |
| 38 | ;; | 38 | ;; |
| 39 | ;; The RELATIVE_SPECS_* values are added by `add-relative-face-remapping' | 39 | ;; The RELATIVE_SPECS_* values are added by `face-remap-add-relative' |
| 40 | ;; (and removed by `remove-relative-face-remapping', and are intended for | 40 | ;; (and removed by `face-remap-remove-relative', and are intended for |
| 41 | ;; face "modifications" (such as increasing the size). Typical users of | 41 | ;; face "modifications" (such as increasing the size). Typical users of |
| 42 | ;; relative specs would be minor modes. | 42 | ;; relative specs would be minor modes. |
| 43 | ;; | 43 | ;; |
| @@ -45,10 +45,10 @@ | |||
| 45 | ;; face name, which causes the global definition of that face to be used. | 45 | ;; face name, which causes the global definition of that face to be used. |
| 46 | ;; | 46 | ;; |
| 47 | ;; A non-default value of BASE_SPECS may also be set using | 47 | ;; A non-default value of BASE_SPECS may also be set using |
| 48 | ;; `set-base-face-remapping'. Because this _overwrites_ the default | 48 | ;; `face-remap-set-base'. Because this _overwrites_ the default |
| 49 | ;; value inheriting from the global face definition, it is up to the | 49 | ;; value inheriting from the global face definition, it is up to the |
| 50 | ;; caller of set-base-face-remapping to add such inheritance if it is | 50 | ;; caller of face-remap-set-base to add such inheritance if it is |
| 51 | ;; desired. A typical use of set-base-face-remapping would be a major | 51 | ;; desired. A typical use of face-remap-set-base would be a major |
| 52 | ;; mode setting face remappings, e.g., of the default face. | 52 | ;; mode setting face remappings, e.g., of the default face. |
| 53 | ;; | 53 | ;; |
| 54 | ;; All modifications cause face-remapping-alist to be made buffer-local. | 54 | ;; All modifications cause face-remapping-alist to be made buffer-local. |
| @@ -62,11 +62,11 @@ | |||
| 62 | ;; Utility functions | 62 | ;; Utility functions |
| 63 | 63 | ||
| 64 | ;;;### autoload | 64 | ;;;### autoload |
| 65 | (defun add-relative-face-remapping (face &rest specs) | 65 | (defun face-remap-add-relative (face &rest specs) |
| 66 | "Add a face remapping entry of FACE to SPECS in the current buffer. | 66 | "Add a face remapping entry of FACE to SPECS in the current buffer. |
| 67 | 67 | ||
| 68 | Return a cookie which can be used to delete the remapping with | 68 | Return a cookie which can be used to delete the remapping with |
| 69 | `remove-relative-face-remapping'. | 69 | `face-remap-remove-relative'. |
| 70 | 70 | ||
| 71 | SPECS can be any value suitable for the `face' text property, | 71 | SPECS can be any value suitable for the `face' text property, |
| 72 | including a face name, a list of face names, or a face-attribute | 72 | including a face name, a list of face names, or a face-attribute |
| @@ -77,7 +77,7 @@ remapping taking precedence. | |||
| 77 | 77 | ||
| 78 | The base (lowest priority) remapping may be set to a specific | 78 | The base (lowest priority) remapping may be set to a specific |
| 79 | value, instead of the default of the global face definition, | 79 | value, instead of the default of the global face definition, |
| 80 | using `set-base-face-remapping'." | 80 | using `face-remap-set-base'." |
| 81 | (make-local-variable 'face-remapping-alist) | 81 | (make-local-variable 'face-remapping-alist) |
| 82 | (let ((entry (assq face face-remapping-alist))) | 82 | (let ((entry (assq face face-remapping-alist))) |
| 83 | (when (null entry) | 83 | (when (null entry) |
| @@ -86,8 +86,8 @@ using `set-base-face-remapping'." | |||
| 86 | (setcdr entry (cons specs (cdr entry))) | 86 | (setcdr entry (cons specs (cdr entry))) |
| 87 | (cons face specs))) | 87 | (cons face specs))) |
| 88 | 88 | ||
| 89 | (defun remove-relative-face-remapping (cookie) | 89 | (defun face-remap-remove-relative (cookie) |
| 90 | "Remove a face remapping previously added by `add-relative-face-remapping'. | 90 | "Remove a face remapping previously added by `face-remap-add-relative'. |
| 91 | COOKIE should be the return value from that function." | 91 | COOKIE should be the return value from that function." |
| 92 | (let ((remapping (assq (car cookie) face-remapping-alist))) | 92 | (let ((remapping (assq (car cookie) face-remapping-alist))) |
| 93 | (when remapping | 93 | (when remapping |
| @@ -102,7 +102,7 @@ COOKIE should be the return value from that function." | |||
| 102 | (cdr cookie)))))) | 102 | (cdr cookie)))))) |
| 103 | 103 | ||
| 104 | ;;;### autoload | 104 | ;;;### autoload |
| 105 | (defun set-default-base-face-remapping (face) | 105 | (defun face-remap-reset-base (face) |
| 106 | "Set the base remapping of FACE to inherit from FACE's global definition." | 106 | "Set the base remapping of FACE to inherit from FACE's global definition." |
| 107 | (let ((entry (assq face face-remapping-alist))) | 107 | (let ((entry (assq face face-remapping-alist))) |
| 108 | (when entry | 108 | (when entry |
| @@ -116,7 +116,7 @@ COOKIE should be the return value from that function." | |||
| 116 | (setcar (last entry) face))))) ; otherwise, just inherit global def | 116 | (setcar (last entry) face))))) ; otherwise, just inherit global def |
| 117 | 117 | ||
| 118 | ;;;### autoload | 118 | ;;;### autoload |
| 119 | (defun set-base-face-remapping (face &rest specs) | 119 | (defun face-remap-set-base (face &rest specs) |
| 120 | "Set the base remapping of FACE in the current buffer to SPECS. | 120 | "Set the base remapping of FACE in the current buffer to SPECS. |
| 121 | If SPECS is empty, the default base remapping is restored, which | 121 | If SPECS is empty, the default base remapping is restored, which |
| 122 | inherits from the global definition of FACE; note that this is | 122 | inherits from the global definition of FACE; note that this is |
| @@ -125,7 +125,7 @@ not inherit from the global definition of FACE." | |||
| 125 | (if (or (null specs) | 125 | (if (or (null specs) |
| 126 | (and (eq (car specs) face) (null (cdr specs)))) ; default | 126 | (and (eq (car specs) face) (null (cdr specs)))) ; default |
| 127 | ;; Set entry back to default | 127 | ;; Set entry back to default |
| 128 | (set-default-base-face-remapping face) | 128 | (face-remap-reset-base face) |
| 129 | ;; Set the base remapping | 129 | ;; Set the base remapping |
| 130 | (make-local-variable 'face-remapping-alist) | 130 | (make-local-variable 'face-remapping-alist) |
| 131 | (let ((entry (assq face face-remapping-alist))) | 131 | (let ((entry (assq face face-remapping-alist))) |
| @@ -163,26 +163,26 @@ The amount of scaling is determined by the variable | |||
| 163 | face size by the value of the variable `text-scale-mode-step' | 163 | face size by the value of the variable `text-scale-mode-step' |
| 164 | \(a negative amount shrinks the text). | 164 | \(a negative amount shrinks the text). |
| 165 | 165 | ||
| 166 | The `increase-buffer-face-height' and `decrease-buffer-face-height' | 166 | The `text-scale-increase' and `text-scale-decrease' functions may |
| 167 | functions may be used to interactively modify the variable | 167 | be used to interactively modify the variable |
| 168 | `text-scale-mode-amount' (they also enable or disable `text-scale-mode' | 168 | `text-scale-mode-amount' (they also enable or disable |
| 169 | as necessary)." | 169 | `text-scale-mode' as necessary)." |
| 170 | :lighter (" " text-scale-mode-lighter) | 170 | :lighter (" " text-scale-mode-lighter) |
| 171 | (when text-scale-mode-remapping | 171 | (when text-scale-mode-remapping |
| 172 | (remove-relative-face-remapping text-scale-mode-remapping)) | 172 | (face-remap-remove-relative text-scale-mode-remapping)) |
| 173 | (setq text-scale-mode-lighter | 173 | (setq text-scale-mode-lighter |
| 174 | (format (if (>= text-scale-mode-amount 0) "+%d" "%d") | 174 | (format (if (>= text-scale-mode-amount 0) "+%d" "%d") |
| 175 | text-scale-mode-amount)) | 175 | text-scale-mode-amount)) |
| 176 | (setq text-scale-mode-remapping | 176 | (setq text-scale-mode-remapping |
| 177 | (and text-scale-mode | 177 | (and text-scale-mode |
| 178 | (add-relative-face-remapping 'default | 178 | (face-remap-add-relative 'default |
| 179 | :height | 179 | :height |
| 180 | (expt text-scale-mode-step | 180 | (expt text-scale-mode-step |
| 181 | text-scale-mode-amount)))) | 181 | text-scale-mode-amount)))) |
| 182 | (force-window-update (current-buffer))) | 182 | (force-window-update (current-buffer))) |
| 183 | 183 | ||
| 184 | ;;;###autoload | 184 | ;;;###autoload |
| 185 | (defun increase-buffer-face-height (&optional inc) | 185 | (defun text-scale-increase (&optional inc) |
| 186 | "Increase the height of the default face in the current buffer by INC steps. | 186 | "Increase the height of the default face in the current buffer by INC steps. |
| 187 | If the new height is other than the default, `text-scale-mode' is enabled. | 187 | If the new height is other than the default, `text-scale-mode' is enabled. |
| 188 | 188 | ||
| @@ -195,18 +195,18 @@ will remove any scaling currently active." | |||
| 195 | (text-scale-mode (if (zerop text-scale-mode-amount) -1 1))) | 195 | (text-scale-mode (if (zerop text-scale-mode-amount) -1 1))) |
| 196 | 196 | ||
| 197 | ;;;###autoload | 197 | ;;;###autoload |
| 198 | (defun decrease-buffer-face-height (&optional dec) | 198 | (defun text-scale-decrease (&optional dec) |
| 199 | "Decrease the height of the default face in the current buffer by DEC steps. | 199 | "Decrease the height of the default face in the current buffer by DEC steps. |
| 200 | See `increase-buffer-face-height' for more details." | 200 | See `text-scale-increase' for more details." |
| 201 | (interactive "p") | 201 | (interactive "p") |
| 202 | (increase-buffer-face-height (- dec))) | 202 | (text-scale-increase (- dec))) |
| 203 | 203 | ||
| 204 | ;;;###autoload (define-key ctl-x-map [(control ?+)] 'adjust-buffer-face-height) | 204 | ;;;###autoload (define-key ctl-x-map [(control ?+)] 'text-scale-adjust) |
| 205 | ;;;###autoload (define-key ctl-x-map [(control ?-)] 'adjust-buffer-face-height) | 205 | ;;;###autoload (define-key ctl-x-map [(control ?-)] 'text-scale-adjust) |
| 206 | ;;;###autoload (define-key ctl-x-map [(control ?=)] 'adjust-buffer-face-height) | 206 | ;;;###autoload (define-key ctl-x-map [(control ?=)] 'text-scale-adjust) |
| 207 | ;;;###autoload (define-key ctl-x-map [(control ?0)] 'adjust-buffer-face-height) | 207 | ;;;###autoload (define-key ctl-x-map [(control ?0)] 'text-scale-adjust) |
| 208 | ;;;###autoload | 208 | ;;;###autoload |
| 209 | (defun adjust-buffer-face-height (&optional inc) | 209 | (defun text-scale-adjust (&optional inc) |
| 210 | "Increase or decrease the height of the default face in the current buffer. | 210 | "Increase or decrease the height of the default face in the current buffer. |
| 211 | 211 | ||
| 212 | The actual adjustment made depends on the final component of the | 212 | The actual adjustment made depends on the final component of the |
| @@ -226,10 +226,10 @@ height by the same amount). As a special case, an argument of 0 | |||
| 226 | will remove any scaling currently active. | 226 | will remove any scaling currently active. |
| 227 | 227 | ||
| 228 | This command is a special-purpose wrapper around the | 228 | This command is a special-purpose wrapper around the |
| 229 | `increase-buffer-face-height' command which makes repetition | 229 | `text-scale-increase' command which makes repetition convenient |
| 230 | convenient even when it is bound in a non-top-level keymap. | 230 | even when it is bound in a non-top-level keymap. For binding in |
| 231 | For binding in a top-level keymap, `increase-buffer-face-height' | 231 | a top-level keymap, `text-scale-increase' or |
| 232 | or `decrease-default-face-height' may be more appropriate." | 232 | `text-scale-decrease' may be more appropriate." |
| 233 | (interactive "p") | 233 | (interactive "p") |
| 234 | (let ((first t) | 234 | (let ((first t) |
| 235 | (step t) | 235 | (step t) |
| @@ -247,7 +247,7 @@ or `decrease-default-face-height' may be more appropriate." | |||
| 247 | (t | 247 | (t |
| 248 | (setq step nil)))) | 248 | (setq step nil)))) |
| 249 | (when step | 249 | (when step |
| 250 | (increase-buffer-face-height step) | 250 | (text-scale-increase step) |
| 251 | (setq inc 1 first nil) | 251 | (setq inc 1 first nil) |
| 252 | (setq ev (read-event)))) | 252 | (setq ev (read-event)))) |
| 253 | (push ev unread-command-events))) | 253 | (push ev unread-command-events))) |
| @@ -269,10 +269,10 @@ When active, causes the buffer text to be displayed using | |||
| 269 | the `variable-pitch' face." | 269 | the `variable-pitch' face." |
| 270 | :lighter " VarPitch" | 270 | :lighter " VarPitch" |
| 271 | (when variable-pitch-mode-remapping | 271 | (when variable-pitch-mode-remapping |
| 272 | (remove-relative-face-remapping variable-pitch-mode-remapping)) | 272 | (face-remap-remove-relative variable-pitch-mode-remapping)) |
| 273 | (setq variable-pitch-mode-remapping | 273 | (setq variable-pitch-mode-remapping |
| 274 | (and variable-pitch-mode | 274 | (and variable-pitch-mode |
| 275 | (add-relative-face-remapping 'default 'variable-pitch))) | 275 | (face-remap-add-relative 'default 'variable-pitch))) |
| 276 | (force-window-update (current-buffer))) | 276 | (force-window-update (current-buffer))) |
| 277 | 277 | ||
| 278 | 278 | ||