summaryrefslogtreecommitdiff
path: root/lisp/face-remap.el
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>2009-06-23 08:27:58 +0000
committerMiles Bader <miles@gnu.org>2009-06-23 08:27:58 +0000
commit05fbc4a9f15b93661bc4027f83450566f674032e (patch)
tree26ad09180b9b9f86527e040be519941d17ed61a6 /lisp/face-remap.el
parente65f32c1d8c7553424c27c0558f2830916f58ecf (diff)
downloademacs-05fbc4a9f15b93661bc4027f83450566f674032e.tar.gz
Add `text-scale-set' function
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-1607
Diffstat (limited to 'lisp/face-remap.el')
-rw-r--r--lisp/face-remap.el21
1 files changed, 17 insertions, 4 deletions
diff --git a/lisp/face-remap.el b/lisp/face-remap.el
index 369a265d435..c899a8d3f8f 100644
--- a/lisp/face-remap.el
+++ b/lisp/face-remap.el
@@ -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))
@@ -230,6 +230,19 @@ be used to interactively modify the variable
(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.