]> git.eshelyaron.com Git - emacs.git/commitdiff
Add `text-scale-set' function
authorMiles Bader <miles@gnu.org>
Tue, 23 Jun 2009 08:27:58 +0000 (08:27 +0000)
committerMiles Bader <miles@gnu.org>
Tue, 23 Jun 2009 08:27:58 +0000 (08:27 +0000)
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-1607

doc/emacs/ChangeLog
doc/emacs/display.texi
lisp/ChangeLog
lisp/face-remap.el

index c990259b76db221729a0305245881171e8a257ff..d44b255eedfde00b035a87e17c8ffa82da655180 100644 (file)
@@ -1,6 +1,7 @@
 2009-06-23  Miles Bader  <miles@gnu.org>
 
        * display.texi (Scrolling): Document `recenter-redisplay'
+       (Temporary Face Changes): Document `text-scale-set'.
 
 2009-06-21  Chong Yidong  <cyd@stupidchicken.com>
 
index 5cffc2e337729668fb3d2e0b1fac8ce440e28039..96ae59ee6e181240a35eeaaaacf3977beeac1061 100644 (file)
@@ -509,6 +509,12 @@ default face, just like @kbd{C-x C-+} and @kbd{C-x C--} respectively.
 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
index aa58deb034703fd74223550a65873c1c6c72e232..c1dd6b374e21f11a458a3ffb923e4a79e5a91949 100644 (file)
@@ -1,3 +1,7 @@
+2009-06-23  Miles Bader  <miles@gnu.org>
+
+       * face-remap.el (text-scale-set): New function.
+
 2009-06-23  Glenn Morris  <rgm@gnu.org>
 
        * pcmpl-rpm.el (pcomplete/rpm): Doc fix.
index 369a265d43547413e2d4a762a782ec449ebfd20e..c899a8d3f8f72e7a252f0c4b1bde8f5ac854d3f5 100644 (file)
@@ -211,10 +211,10 @@ The amount of scaling is determined by the variable
 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))
@@ -229,6 +229,19 @@ be used to interactively modify the variable
                                                text-scale-mode-amount))))
   (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.