# HG changeset patch # User Miles Bader # Date 1245745678 0 # Node ID 90878fc8d55db1b0de1521f2fd15f06ac6a579f7 # Parent 0659f98d664f5a8afcc1ac6408c4fec55386951b Add `text-scale-set' function Revision: emacs@sv.gnu.org/emacs--devo--0--patch-1607 diff -r 0659f98d664f -r 90878fc8d55d doc/emacs/ChangeLog --- a/doc/emacs/ChangeLog Tue Jun 23 07:44:08 2009 +0000 +++ b/doc/emacs/ChangeLog Tue Jun 23 08:27:58 2009 +0000 @@ -1,6 +1,7 @@ 2009-06-23 Miles Bader * display.texi (Scrolling): Document `recenter-redisplay' + (Temporary Face Changes): Document `text-scale-set'. 2009-06-21 Chong Yidong diff -r 0659f98d664f -r 90878fc8d55d doc/emacs/display.texi --- a/doc/emacs/display.texi Tue Jun 23 07:44:08 2009 +0000 +++ b/doc/emacs/display.texi Tue Jun 23 08:27:58 2009 +0000 @@ -509,6 +509,12 @@ You may find it convenient to bind to these commands, rather than @code{text-scale-adjust}. +@cindex set buffer face height +@findex text-scale-set +The command @code{text-scale-set} sets the height of the default face +in the current buffer to an absolute level specified by its prefix +argument. + @findex text-scale-mode The above commands automatically enable or disable the minor mode @code{text-scale-mode}, depending on whether the current font scaling diff -r 0659f98d664f -r 90878fc8d55d lisp/ChangeLog --- a/lisp/ChangeLog Tue Jun 23 07:44:08 2009 +0000 +++ b/lisp/ChangeLog Tue Jun 23 08:27:58 2009 +0000 @@ -1,3 +1,7 @@ +2009-06-23 Miles Bader + + * face-remap.el (text-scale-set): New function. + 2009-06-23 Glenn Morris * pcmpl-rpm.el (pcomplete/rpm): Doc fix. diff -r 0659f98d664f -r 90878fc8d55d lisp/face-remap.el --- a/lisp/face-remap.el Tue Jun 23 07:44:08 2009 +0000 +++ b/lisp/face-remap.el Tue Jun 23 08:27:58 2009 +0000 @@ -211,10 +211,10 @@ face size by the value of the variable `text-scale-mode-step' \(a negative amount shrinks the text). -The `text-scale-increase' and `text-scale-decrease' functions may -be used to interactively modify the variable -`text-scale-mode-amount' (they also enable or disable -`text-scale-mode' as necessary)." +The `text-scale-increase', `text-scale-decrease', and +`text-scale-set' functions may be used to interactively modify +the variable `text-scale-mode-amount' (they also enable or +disable `text-scale-mode' as necessary)." :lighter (" " text-scale-mode-lighter) (when text-scale-mode-remapping (face-remap-remove-relative text-scale-mode-remapping)) @@ -230,6 +230,19 @@ (force-window-update (current-buffer))) ;;;###autoload +(defun text-scale-set (level) + "Set the scale factor of the default face in the current buffer to LEVEL. +If LEVEL is non-zero, `text-scale-mode' is enabled, otherwise it is disabled. + +LEVEL is a number of steps, with 0 representing the default size. +Each step scales the height of the default face by the variable +`text-scale-mode-step' (a negative number decreases the height by +the same amount)." + (interactive "p") + (setq text-scale-mode-amount level) + (text-scale-mode (if (zerop text-scale-mode-amount) -1 1))) + +;;;###autoload (defun text-scale-increase (inc) "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.