aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/emacs/ChangeLog7
-rw-r--r--doc/emacs/display.texi46
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/face-remap.el69
4 files changed, 103 insertions, 26 deletions
diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog
index 314c42d4dff..41c3e3225bf 100644
--- a/doc/emacs/ChangeLog
+++ b/doc/emacs/ChangeLog
@@ -1,3 +1,10 @@
12008-06-04 Miles Bader <miles@gnu.org>
2
3 * display.texi (Temporary Face Changes): Add
4 `adjust-buffer-face-height'. Rewrite description of
5 `increase-buffer-face-height' and `decrease-default-face-height' now
6 that they aren't bound by default.
7
12008-06-03 Miles Bader <miles@gnu.org> 82008-06-03 Miles Bader <miles@gnu.org>
2 9
3 * display.texi (Temporary Face Changes): New node. 10 * display.texi (Temporary Face Changes): New node.
diff --git a/doc/emacs/display.texi b/doc/emacs/display.texi
index 9cf8c986d4a..47650ec5601 100644
--- a/doc/emacs/display.texi
+++ b/doc/emacs/display.texi
@@ -1178,24 +1178,48 @@ fringe when positioned on that newline.
1178These are commands which temporarily change the default face used to 1178These are commands which temporarily change the default face used to
1179display text in a buffer. 1179display text in a buffer.
1180 1180
1181@cindex adjust buffer face height
1182@findex adjust-buffer-face-height
1183@kindex C-x C-+
1184@kindex C-x C--
1185@kindex C-x C-=
1186@kindex C-x C-0
1187To increase the height of the default face in the current buffer one
1188step, type @kbd{C-x C-+} or @kbd{C-x C-=}. To decrease it one step,
1189type @kbd{C-x C--}. To restore the default (global) face height, type
1190@kbd{C-x C-0}. These keys are all bound to the same command,
1191@code{adjust-buffer-face-height}, which looks at the last key typed to
1192determine the adjustment to make.
1193
1194The final key of these commands may be repeated without the leading
1195@kbd{C-x} -- for instance, @kbd{C-x C-= C-= C-=} increases the face
1196height by three steps.
1197
1198Each step scales the height of the default face by the value of the
1199variable @code{text-scale-mode-step} (a negative number of steps
1200decreases the height by the same amount). As a special case, an
1201argument of 0 will remove any scaling currently active.
1202
1203This command is a special-purpose wrapper around the
1204@code{increase-buffer-face-height} command which makes repetition
1205convenient even when it is bound in a non-top-level keymap. For
1206binding in a top-level keymap, @code{increase-buffer-face-height} or
1207@code{decrease-default-face-height} may be more appropriate."
1208
1181@cindex increase buffer face height 1209@cindex increase buffer face height
1182@findex increase-buffer-face-height 1210@findex increase-buffer-face-height
1183@cindex decrease buffer face height 1211@cindex decrease buffer face height
1184@findex decrease-buffer-face-height 1212@findex decrease-buffer-face-height
1185@findex text-scale-mode 1213The @code{increase-buffer-face-height} and
1186To increase the size of the font used to display text in the current 1214@code{decrease-buffer-face-height} commands increase or decrease the
1187buffer, type @kbd{C-=} or @kbd{C-+} 1215height of the default face in the current buffer by one step. With a
1188(@code{increase-buffer-face-height}). With a numeric prefix argument, 1216numeric prefix argument, the size will be increased/decreased by that
1189the size will be increased by that many steps (the default is 1 step); 1217many steps; each step scales the font height by the value of the
1190each step scales the font height by the value of the variable 1218variable @code{text-scale-mode-step}. If repeated, this command has a
1191@code{text-scale-mode-step}. If repeated, this command has a
1192cumulative effect. As a special case, a prefix argument of 0 will 1219cumulative effect. As a special case, a prefix argument of 0 will
1193remove any scaling currently active. 1220remove any scaling currently active.
1194 1221
1195To decrease the size of the text, type @kbd{C--} 1222@findex text-scale-mode
1196(@code{decrease-buffer-face-height}). The behavior is similar to that
1197of @code{increase-buffer-face-height}, but in reverse.
1198
1199These commands automatically enable or disable the 1223These commands automatically enable or disable the
1200@code{text-scale-mode} minor-mode, depending on whether the current 1224@code{text-scale-mode} minor-mode, depending on whether the current
1201font scaling is other than 1 or not. 1225font scaling is other than 1 or not.
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 7416318744f..9cd7a630cf4 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
12008-06-04 Miles Bader <miles@gnu.org>
2
3 * face-remap.el (adjust-buffer-face-height): New function.
4 Add autoloaded keybindings in ctl-x-map.
5 (increase-buffer-face-height, decrease-buffer-face-height):
6 Simplify interactive spec to just "p". Remove autoloaded keybindings.
7
12008-06-03 Chong Yidong <cyd@stupidchicken.com> 82008-06-03 Chong Yidong <cyd@stupidchicken.com>
2 9
3 * simple.el (line-move-1): If we did not move as far as desired, 10 * simple.el (line-move-1): If we did not move as far as desired,
diff --git a/lisp/face-remap.el b/lisp/face-remap.el
index fe517a77a33..f53e37e969e 100644
--- a/lisp/face-remap.el
+++ b/lisp/face-remap.el
@@ -181,8 +181,6 @@ also enable or disable `text-scale-mode' as necessary."
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 (global-set-key [(control =)] 'increase-buffer-face-height)
185;;;###autoload (global-set-key [(control +)] 'increase-buffer-face-height)
186;;;###autoload 184;;;###autoload
187(defun increase-buffer-face-height (&optional inc) 185(defun increase-buffer-face-height (&optional inc)
188 "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.
@@ -192,28 +190,69 @@ Each step scales the height of the default face by the variable
192`text-scale-mode-step' (a negative number of steps decreases the 190`text-scale-mode-step' (a negative number of steps decreases the
193height by the same amount). As a special case, an argument of 0 191height by the same amount). As a special case, an argument of 0
194will remove any scaling currently active." 192will remove any scaling currently active."
195 (interactive 193 (interactive "p")
196 (list
197 (cond ((eq current-prefix-arg '-) -1)
198 ((numberp current-prefix-arg) current-prefix-arg)
199 ((consp current-prefix-arg) -1)
200 (t 1))))
201 (setq text-scale-mode-amount (if (= inc 0) 0 (+ text-scale-mode-amount inc))) 194 (setq text-scale-mode-amount (if (= inc 0) 0 (+ text-scale-mode-amount inc)))
202 (text-scale-mode (if (zerop text-scale-mode-amount) -1 1))) 195 (text-scale-mode (if (zerop text-scale-mode-amount) -1 1)))
203 196
204;;;###autoload (global-set-key [(control -)] 'decrease-buffer-face-height)
205;;;###autoload 197;;;###autoload
206(defun decrease-buffer-face-height (&optional dec) 198(defun decrease-buffer-face-height (&optional dec)
207 "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.
208See `increase-buffer-face-height' for more details." 200See `increase-buffer-face-height' for more details."
209 (interactive 201 (interactive "p")
210 (list
211 (cond ((eq current-prefix-arg '-) -1)
212 ((numberp current-prefix-arg) current-prefix-arg)
213 ((consp current-prefix-arg) -1)
214 (t 1))))
215 (increase-buffer-face-height (- dec))) 202 (increase-buffer-face-height (- dec)))
216 203
204;;;###autoload (define-key ctl-x-map [(control ?+)] 'adjust-buffer-face-height)
205;;;###autoload (define-key ctl-x-map [(control ?-)] 'adjust-buffer-face-height)
206;;;###autoload (define-key ctl-x-map [(control ?=)] 'adjust-buffer-face-height)
207;;;###autoload (define-key ctl-x-map [(control ?0)] 'adjust-buffer-face-height)
208;;;###autoload
209(defun adjust-buffer-face-height (&optional inc)
210 "Increase or decrease the height of the default face in the current buffer.
211
212The actual adjustment made depends on the final component of the
213key-binding used to invoke the command, with all modifiers
214removed:
215
216 +, = Increase the default face height by one step
217 - Decrease the default face height by one step
218 0 Reset the default face height to the global default
219
220Then, continue to read input events and further adjust the face
221height as long as the input event read (with all modifiers
222removed) is one the above.
223
224Each step scales the height of the default face by the variable
225`text-scale-mode-step' (a negative number of steps decreases the
226height by the same amount). As a special case, an argument of 0
227will remove any scaling currently active.
228
229This command is a special-purpose wrapper around the
230`increase-buffer-face-height' command which makes repetition
231convenient even when it is bound in a non-top-level keymap. For
232binding in a top-level keymap, `increase-buffer-face-height' or
233`decrease-default-face-height' may be more appropriate."
234 (interactive "p")
235 (let ((first t)
236 (step t)
237 (ev last-command-event))
238 (while step
239 (let ((base (event-basic-type ev)))
240 (cond ((or (eq base ?+) (eq base ?=))
241 (setq step inc))
242 ((eq base ?-)
243 (setq step (- inc)))
244 ((eq base ?0)
245 (setq step 0))
246 (first
247 (setq step inc))
248 (t
249 (setq step nil))))
250 (when step
251 (increase-buffer-face-height step)
252 (setq inc 1 first nil)
253 (setq ev (read-event))))
254 (push ev unread-command-events)))
255
217 256
218;; ---------------------------------------------------------------- 257;; ----------------------------------------------------------------
219;; variable-pitch-mode 258;; variable-pitch-mode