Rename functions in lisp/face-remap.el

Revision: emacs@sv.gnu.org/emacs--devo--0--patch-1208
This commit is contained in:
Miles Bader 2008-06-05 02:42:55 +00:00
parent ed25242f87
commit e40a85cd56
6 changed files with 85 additions and 65 deletions

View file

@ -1,3 +1,8 @@
2008-06-05 Miles Bader <miles@gnu.org>
* display.texi (Temporary Face Changes): Update to reflect function
renamings in face-remap.el.
2008-06-04 Miles Bader <miles@gnu.org> 2008-06-04 Miles Bader <miles@gnu.org>
* display.texi (Temporary Face Changes): Add * display.texi (Temporary Face Changes): Add

View file

@ -1179,7 +1179,7 @@ These are commands which temporarily change the default face used to
display text in a buffer. display text in a buffer.
@cindex adjust buffer face height @cindex adjust buffer face height
@findex adjust-buffer-face-height @findex text-scale-adjust
@kindex C-x C-+ @kindex C-x C-+
@kindex C-x C-- @kindex C-x C--
@kindex C-x C-= @kindex C-x C-=
@ -1188,7 +1188,7 @@ To increase the height of the default face in the current buffer one
step, type @kbd{C-x C-+} or @kbd{C-x C-=}. To decrease it one step, step, type @kbd{C-x C-+} or @kbd{C-x C-=}. To decrease it one step,
type @kbd{C-x C--}. To restore the default (global) face height, type type @kbd{C-x C--}. To restore the default (global) face height, type
@kbd{C-x C-0}. These keys are all bound to the same command, @kbd{C-x C-0}. These keys are all bound to the same command,
@code{adjust-buffer-face-height}, which looks at the last key typed to @code{text-scale-adjust}, which looks at the last key typed to
determine the adjustment to make. determine the adjustment to make.
The final key of these commands may be repeated without the leading The final key of these commands may be repeated without the leading
@ -1201,23 +1201,22 @@ decreases the height by the same amount). As a special case, an
argument of 0 will remove any scaling currently active. argument of 0 will remove any scaling currently active.
This command is a special-purpose wrapper around the This command is a special-purpose wrapper around the
@code{increase-buffer-face-height} command which makes repetition @code{text-scale-increase} command which makes repetition convenient
convenient even when it is bound in a non-top-level keymap. For even when it is bound in a non-top-level keymap. For binding in a
binding in a top-level keymap, @code{increase-buffer-face-height} or top-level keymap, @code{text-scale-increase} or
@code{decrease-default-face-height} may be more appropriate." @code{text-scale-decrease} may be more appropriate."
@cindex increase buffer face height @cindex increase buffer face height
@findex increase-buffer-face-height @findex text-scale-increase
@cindex decrease buffer face height @cindex decrease buffer face height
@findex decrease-buffer-face-height @findex text-scale-decrease
The @code{increase-buffer-face-height} and The @code{text-scale-increase} and @code{text-scale-decrease} commands
@code{decrease-buffer-face-height} commands increase or decrease the increase or decrease the height of the default face in the current
height of the default face in the current buffer by one step. With a buffer by one step. With a numeric prefix argument, the size will be
numeric prefix argument, the size will be increased/decreased by that increased/decreased by that many steps; each step scales the font
many steps; each step scales the font height by the value of the height by the value of the variable @code{text-scale-mode-step}. If
variable @code{text-scale-mode-step}. If repeated, this command has a repeated, this command has a cumulative effect. As a special case, a
cumulative effect. As a special case, a prefix argument of 0 will prefix argument of 0 will remove any scaling currently active.
remove any scaling currently active.
@findex text-scale-mode @findex text-scale-mode
These commands automatically enable or disable the These commands automatically enable or disable the

View file

@ -1,3 +1,8 @@
2008-06-05 Miles Bader <miles@gnu.org>
* display.texi (Displaying Faces): Update to reflect function
renamings in face-remap.el.
2008-06-05 Juanma Barranquero <lekktu@gmail.com> 2008-06-05 Juanma Barranquero <lekktu@gmail.com>
* display.texi (Fontsets): Fix typos. * display.texi (Fontsets): Fix typos.

View file

@ -2439,8 +2439,8 @@ names or face attribute-value pairs. All face specs are merged
together, with earlier values taking precedence. together, with earlier values taking precedence.
The @var{relative_specs_}n values are ``relative specs'', and are The @var{relative_specs_}n values are ``relative specs'', and are
added by @code{add-relative-face-remapping} (and removed by added by @code{face-remap-add-relative} (and removed by
@code{remove-relative-face-remapping}. These are intended for face @code{face-remap-remove-relative}. These are intended for face
modifications (such as increasing the size). Typical users of these modifications (such as increasing the size). Typical users of these
relative specs would be minor modes. relative specs would be minor modes.
@ -2448,37 +2448,37 @@ relative specs would be minor modes.
face name, which causes the global definition of that face to be used. face name, which causes the global definition of that face to be used.
A non-default value of @var{base_specs} may also be set using A non-default value of @var{base_specs} may also be set using
@code{set-base-face-remapping}. Because this @emph{overwrites} the @code{face-remap-set-base}. Because this @emph{overwrites} the
default base-spec value (which inherits the global face definition), default base-spec value (which inherits the global face definition),
it is up to the caller of @code{set-base-face-remapping} to add such it is up to the caller of @code{face-remap-set-base} to add such
inheritance if it is desired. A typical use of inheritance if it is desired. A typical use of
@code{set-base-face-remapping} would be a major mode adding a face @code{face-remap-set-base} would be a major mode adding a face
remappings, e.g., of the default face. remappings, e.g., of the default face.
@defun add-relative-face-remapping face &rest specs @defun face-remap-add-relative face &rest specs
This functions adds a face remapping entry of @var{face} to @var{specs} This functions adds a face remapping entry of @var{face} to @var{specs}
in the current buffer. in the current buffer.
It returns a ``cookie'' which can be used to later delete the remapping with It returns a ``cookie'' which can be used to later delete the remapping with
@code{remove-relative-face-remapping}. @code{face-remap-remove-relative}.
@var{specs} can be any value suitable for the @code{face} text @var{specs} can be any value suitable for the @code{face} text
property, including a face name, a list of face names, or a property, including a face name, a list of face names, or a
face-attribute property list. The attributes given by @var{specs} face-attribute property list. The attributes given by @var{specs}
will be merged with any other currently active face remappings of will be merged with any other currently active face remappings of
@var{face}, and with the global definition of @var{face} (by default; @var{face}, and with the global definition of @var{face} (by default;
this may be changed using @code{set-base-face-remapping}), this may be changed using @code{face-remap-set-base}), with the most
with the most recently added relative remapping taking precedence. recently added relative remapping taking precedence.
@end defun @end defun
@defun remove-relative-face-remapping cookie @defun face-remap-remove-relative cookie
This function removes a face remapping previously added by This function removes a face remapping previously added by
@code{add-relative-face-remapping}. @var{cookie} should be a return @code{face-remap-add-relative}. @var{cookie} should be a return value
value from that function. from that function.
@end defun @end defun
@defun set-base-face-remapping face &rest specs @defun face-remap-set-base face &rest specs
This function sets the ``base remapping'' of @var{face} in the current This function sets the ``base remapping'' of @var{face} in the current
buffer to @var{specs}. If @var{specs} is empty, the default base buffer to @var{specs}. If @var{specs} is empty, the default base
remapping is restored, which inherits from the global definition of remapping is restored, which inherits from the global definition of
@ -2487,7 +2487,7 @@ single value @code{nil}, which has the opposite result (the global
definition of @var{face} is ignored). definition of @var{face} is ignored).
@end defun @end defun
@defun set-default-base-face-remapping face @defun face-remap-reset-base face
This function sets the ``base remapping'' of @var{face} to its default This function sets the ``base remapping'' of @var{face} to its default
value, which inherits from @var{face}'s global definition. value, which inherits from @var{face}'s global definition.
@end defun @end defun

View file

@ -36,6 +36,17 @@
2008-06-05 Miles Bader <miles@gnu.org> 2008-06-05 Miles Bader <miles@gnu.org>
* face-remap.el
(face-remap-add-relative): Renamed from `add-relative-face-remapping'.
(face-remap-remove-relative): Renamed from
`remove-relative-face-remapping'.
(face-remap-reset-base): Renamed from
`set-default-base-face-remapping'.
(face-remap-set-base): Renamed from `set-base-face-remapping'.
(text-scale-increase): Renamed from `increase-buffer-face-height'.
(text-scale-decrease): Renamed from `decrease-buffer-face-height'.
(text-scale-adjust): Renamed from `adjust-buffer-face-height'.
* face-remap.el (variable-pitch-mode): Autoload. * face-remap.el (variable-pitch-mode): Autoload.
2008-06-04 Sam Steingold <sds@gnu.org> 2008-06-04 Sam Steingold <sds@gnu.org>

View file

@ -36,8 +36,8 @@
;; The "specs" values are a lists of face names or face attribute-value ;; The "specs" values are a lists of face names or face attribute-value
;; pairs, and are merged together, with earlier values taking precedence. ;; pairs, and are merged together, with earlier values taking precedence.
;; ;;
;; The RELATIVE_SPECS_* values are added by `add-relative-face-remapping' ;; The RELATIVE_SPECS_* values are added by `face-remap-add-relative'
;; (and removed by `remove-relative-face-remapping', and are intended for ;; (and removed by `face-remap-remove-relative', and are intended for
;; face "modifications" (such as increasing the size). Typical users of ;; face "modifications" (such as increasing the size). Typical users of
;; relative specs would be minor modes. ;; relative specs would be minor modes.
;; ;;
@ -45,10 +45,10 @@
;; face name, which causes the global definition of that face to be used. ;; face name, which causes the global definition of that face to be used.
;; ;;
;; A non-default value of BASE_SPECS may also be set using ;; A non-default value of BASE_SPECS may also be set using
;; `set-base-face-remapping'. Because this _overwrites_ the default ;; `face-remap-set-base'. Because this _overwrites_ the default
;; value inheriting from the global face definition, it is up to the ;; value inheriting from the global face definition, it is up to the
;; caller of set-base-face-remapping to add such inheritance if it is ;; caller of face-remap-set-base to add such inheritance if it is
;; desired. A typical use of set-base-face-remapping would be a major ;; desired. A typical use of face-remap-set-base would be a major
;; mode setting face remappings, e.g., of the default face. ;; mode setting face remappings, e.g., of the default face.
;; ;;
;; All modifications cause face-remapping-alist to be made buffer-local. ;; All modifications cause face-remapping-alist to be made buffer-local.
@ -62,11 +62,11 @@
;; Utility functions ;; Utility functions
;;;### autoload ;;;### autoload
(defun add-relative-face-remapping (face &rest specs) (defun face-remap-add-relative (face &rest specs)
"Add a face remapping entry of FACE to SPECS in the current buffer. "Add a face remapping entry of FACE to SPECS in the current buffer.
Return a cookie which can be used to delete the remapping with Return a cookie which can be used to delete the remapping with
`remove-relative-face-remapping'. `face-remap-remove-relative'.
SPECS can be any value suitable for the `face' text property, SPECS can be any value suitable for the `face' text property,
including a face name, a list of face names, or a face-attribute including a face name, a list of face names, or a face-attribute
@ -77,7 +77,7 @@ remapping taking precedence.
The base (lowest priority) remapping may be set to a specific The base (lowest priority) remapping may be set to a specific
value, instead of the default of the global face definition, value, instead of the default of the global face definition,
using `set-base-face-remapping'." using `face-remap-set-base'."
(make-local-variable 'face-remapping-alist) (make-local-variable 'face-remapping-alist)
(let ((entry (assq face face-remapping-alist))) (let ((entry (assq face face-remapping-alist)))
(when (null entry) (when (null entry)
@ -86,8 +86,8 @@ using `set-base-face-remapping'."
(setcdr entry (cons specs (cdr entry))) (setcdr entry (cons specs (cdr entry)))
(cons face specs))) (cons face specs)))
(defun remove-relative-face-remapping (cookie) (defun face-remap-remove-relative (cookie)
"Remove a face remapping previously added by `add-relative-face-remapping'. "Remove a face remapping previously added by `face-remap-add-relative'.
COOKIE should be the return value from that function." COOKIE should be the return value from that function."
(let ((remapping (assq (car cookie) face-remapping-alist))) (let ((remapping (assq (car cookie) face-remapping-alist)))
(when remapping (when remapping
@ -102,7 +102,7 @@ COOKIE should be the return value from that function."
(cdr cookie)))))) (cdr cookie))))))
;;;### autoload ;;;### autoload
(defun set-default-base-face-remapping (face) (defun face-remap-reset-base (face)
"Set the base remapping of FACE to inherit from FACE's global definition." "Set the base remapping of FACE to inherit from FACE's global definition."
(let ((entry (assq face face-remapping-alist))) (let ((entry (assq face face-remapping-alist)))
(when entry (when entry
@ -116,7 +116,7 @@ COOKIE should be the return value from that function."
(setcar (last entry) face))))) ; otherwise, just inherit global def (setcar (last entry) face))))) ; otherwise, just inherit global def
;;;### autoload ;;;### autoload
(defun set-base-face-remapping (face &rest specs) (defun face-remap-set-base (face &rest specs)
"Set the base remapping of FACE in the current buffer to SPECS. "Set the base remapping of FACE in the current buffer to SPECS.
If SPECS is empty, the default base remapping is restored, which If SPECS is empty, the default base remapping is restored, which
inherits from the global definition of FACE; note that this is inherits from the global definition of FACE; note that this is
@ -125,7 +125,7 @@ not inherit from the global definition of FACE."
(if (or (null specs) (if (or (null specs)
(and (eq (car specs) face) (null (cdr specs)))) ; default (and (eq (car specs) face) (null (cdr specs)))) ; default
;; Set entry back to default ;; Set entry back to default
(set-default-base-face-remapping face) (face-remap-reset-base face)
;; Set the base remapping ;; Set the base remapping
(make-local-variable 'face-remapping-alist) (make-local-variable 'face-remapping-alist)
(let ((entry (assq face face-remapping-alist))) (let ((entry (assq face face-remapping-alist)))
@ -163,26 +163,26 @@ The amount of scaling is determined by the variable
face size by the value of the variable `text-scale-mode-step' face size by the value of the variable `text-scale-mode-step'
\(a negative amount shrinks the text). \(a negative amount shrinks the text).
The `increase-buffer-face-height' and `decrease-buffer-face-height' The `text-scale-increase' and `text-scale-decrease' functions may
functions may be used to interactively modify the variable be used to interactively modify the variable
`text-scale-mode-amount' (they also enable or disable `text-scale-mode' `text-scale-mode-amount' (they also enable or disable
as necessary)." `text-scale-mode' as necessary)."
:lighter (" " text-scale-mode-lighter) :lighter (" " text-scale-mode-lighter)
(when text-scale-mode-remapping (when text-scale-mode-remapping
(remove-relative-face-remapping text-scale-mode-remapping)) (face-remap-remove-relative text-scale-mode-remapping))
(setq text-scale-mode-lighter (setq text-scale-mode-lighter
(format (if (>= text-scale-mode-amount 0) "+%d" "%d") (format (if (>= text-scale-mode-amount 0) "+%d" "%d")
text-scale-mode-amount)) text-scale-mode-amount))
(setq text-scale-mode-remapping (setq text-scale-mode-remapping
(and text-scale-mode (and text-scale-mode
(add-relative-face-remapping 'default (face-remap-add-relative 'default
:height :height
(expt text-scale-mode-step (expt text-scale-mode-step
text-scale-mode-amount)))) text-scale-mode-amount))))
(force-window-update (current-buffer))) (force-window-update (current-buffer)))
;;;###autoload ;;;###autoload
(defun increase-buffer-face-height (&optional inc) (defun text-scale-increase (&optional inc)
"Increase the height of the default face in the current buffer by INC steps. "Increase the height of the default face in the current buffer by INC steps.
If the new height is other than the default, `text-scale-mode' is enabled. If the new height is other than the default, `text-scale-mode' is enabled.
@ -195,18 +195,18 @@ will remove any scaling currently active."
(text-scale-mode (if (zerop text-scale-mode-amount) -1 1))) (text-scale-mode (if (zerop text-scale-mode-amount) -1 1)))
;;;###autoload ;;;###autoload
(defun decrease-buffer-face-height (&optional dec) (defun text-scale-decrease (&optional dec)
"Decrease the height of the default face in the current buffer by DEC steps. "Decrease the height of the default face in the current buffer by DEC steps.
See `increase-buffer-face-height' for more details." See `text-scale-increase' for more details."
(interactive "p") (interactive "p")
(increase-buffer-face-height (- dec))) (text-scale-increase (- dec)))
;;;###autoload (define-key ctl-x-map [(control ?+)] 'adjust-buffer-face-height) ;;;###autoload (define-key ctl-x-map [(control ?+)] 'text-scale-adjust)
;;;###autoload (define-key ctl-x-map [(control ?-)] 'adjust-buffer-face-height) ;;;###autoload (define-key ctl-x-map [(control ?-)] 'text-scale-adjust)
;;;###autoload (define-key ctl-x-map [(control ?=)] 'adjust-buffer-face-height) ;;;###autoload (define-key ctl-x-map [(control ?=)] 'text-scale-adjust)
;;;###autoload (define-key ctl-x-map [(control ?0)] 'adjust-buffer-face-height) ;;;###autoload (define-key ctl-x-map [(control ?0)] 'text-scale-adjust)
;;;###autoload ;;;###autoload
(defun adjust-buffer-face-height (&optional inc) (defun text-scale-adjust (&optional inc)
"Increase or decrease the height of the default face in the current buffer. "Increase or decrease the height of the default face in the current buffer.
The actual adjustment made depends on the final component of the 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
will remove any scaling currently active. will remove any scaling currently active.
This command is a special-purpose wrapper around the This command is a special-purpose wrapper around the
`increase-buffer-face-height' command which makes repetition `text-scale-increase' command which makes repetition convenient
convenient even when it is bound in a non-top-level keymap. even when it is bound in a non-top-level keymap. For binding in
For binding in a top-level keymap, `increase-buffer-face-height' a top-level keymap, `text-scale-increase' or
or `decrease-default-face-height' may be more appropriate." `text-scale-decrease' may be more appropriate."
(interactive "p") (interactive "p")
(let ((first t) (let ((first t)
(step t) (step t)
@ -247,7 +247,7 @@ or `decrease-default-face-height' may be more appropriate."
(t (t
(setq step nil)))) (setq step nil))))
(when step (when step
(increase-buffer-face-height step) (text-scale-increase step)
(setq inc 1 first nil) (setq inc 1 first nil)
(setq ev (read-event)))) (setq ev (read-event))))
(push ev unread-command-events))) (push ev unread-command-events)))
@ -269,10 +269,10 @@ When active, causes the buffer text to be displayed using
the `variable-pitch' face." the `variable-pitch' face."
:lighter " VarPitch" :lighter " VarPitch"
(when variable-pitch-mode-remapping (when variable-pitch-mode-remapping
(remove-relative-face-remapping variable-pitch-mode-remapping)) (face-remap-remove-relative variable-pitch-mode-remapping))
(setq variable-pitch-mode-remapping (setq variable-pitch-mode-remapping
(and variable-pitch-mode (and variable-pitch-mode
(add-relative-face-remapping 'default 'variable-pitch))) (face-remap-add-relative 'default 'variable-pitch)))
(force-window-update (current-buffer))) (force-window-update (current-buffer)))