aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohn Shahid2018-06-28 09:13:45 -0400
committerEli Zaretskii2018-07-01 19:05:37 +0300
commit260768a64be39aada03247d6057698df97bcb800 (patch)
treef61ec4466fc4768a2b0c610a8fc1ac931a067746 /src
parent7edc019651b3e16592d2d16616a7d4cecc285ae6 (diff)
downloademacs-260768a64be39aada03247d6057698df97bcb800.tar.gz
emacs-260768a64be39aada03247d6057698df97bcb800.zip
Add a new argument to 'recenter' to allow finer control of redisplay
* window.c (recenter): Add a new REDISPLAY argument to allow the caller to control the redisplay behavior. 'recenter' will only redisplay the frame if this new arg and 'recenter-redisplay' are both non-nil. (recenter-top-bottom): Pass an extra non-nil argument to 'recenter' to force a redisplay. (Bug#31325)
Diffstat (limited to 'src')
-rw-r--r--src/window.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/window.c b/src/window.c
index a97f1dd3efb..20f6862e3b4 100644
--- a/src/window.c
+++ b/src/window.c
@@ -5896,22 +5896,23 @@ displayed_window_lines (struct window *w)
5896} 5896}
5897 5897
5898 5898
5899DEFUN ("recenter", Frecenter, Srecenter, 0, 1, "P", 5899DEFUN ("recenter", Frecenter, Srecenter, 0, 2, "P",
5900 doc: /* Center point in selected window and maybe redisplay frame. 5900 doc: /* Center point in selected window and maybe redisplay frame.
5901With a numeric prefix argument ARG, recenter putting point on screen line ARG 5901With a numeric prefix argument ARG, recenter putting point on screen line ARG
5902relative to the selected window. If ARG is negative, it counts up from the 5902relative to the selected window. If ARG is negative, it counts up from the
5903bottom of the window. (ARG should be less than the height of the window.) 5903bottom of the window. (ARG should be less than the height of the window.)
5904 5904
5905If ARG is omitted or nil, then recenter with point on the middle line of 5905If ARG is omitted or nil, then recenter with point on the middle line
5906the selected window; if the variable `recenter-redisplay' is non-nil, 5906of the selected window; if REDISPLAY & `recenter-redisplay' are
5907also erase the entire frame and redraw it (when `auto-resize-tool-bars' 5907non-nil, also erase the entire frame and redraw it (when
5908is set to `grow-only', this resets the tool-bar's height to the minimum 5908`auto-resize-tool-bars' is set to `grow-only', this resets the
5909height needed); if `recenter-redisplay' has the special value `tty', 5909tool-bar's height to the minimum height needed); if
5910then only tty frames are redrawn. 5910`recenter-redisplay' has the special value `tty', then only tty frames
5911are redrawn.
5911 5912
5912Just C-u as prefix means put point in the center of the window 5913Just C-u as prefix means put point in the center of the window
5913and redisplay normally--don't erase and redraw the frame. */) 5914and redisplay normally--don't erase and redraw the frame. */)
5914 (register Lisp_Object arg) 5915 (Lisp_Object arg, Lisp_Object redisplay)
5915{ 5916{
5916 struct window *w = XWINDOW (selected_window); 5917 struct window *w = XWINDOW (selected_window);
5917 struct buffer *buf = XBUFFER (w->contents); 5918 struct buffer *buf = XBUFFER (w->contents);
@@ -5931,7 +5932,8 @@ and redisplay normally--don't erase and redraw the frame. */)
5931 5932
5932 if (NILP (arg)) 5933 if (NILP (arg))
5933 { 5934 {
5934 if (!NILP (Vrecenter_redisplay) 5935 if (!NILP (redisplay)
5936 && !NILP (Vrecenter_redisplay)
5935 && (!EQ (Vrecenter_redisplay, Qtty) 5937 && (!EQ (Vrecenter_redisplay, Qtty)
5936 || !NILP (Ftty_type (selected_frame)))) 5938 || !NILP (Ftty_type (selected_frame))))
5937 { 5939 {