summaryrefslogtreecommitdiff
path: root/src/window.c
diff options
context:
space:
mode:
authorJohn Shahid <jvshahid@gmail.com>2018-06-28 09:13:45 -0400
committerEli Zaretskii <eliz@gnu.org>2018-07-01 19:05:37 +0300
commit260768a64be39aada03247d6057698df97bcb800 (patch)
treef61ec4466fc4768a2b0c610a8fc1ac931a067746 /src/window.c
parent7edc019651b3e16592d2d16616a7d4cecc285ae6 (diff)
downloademacs-260768a64be39aada03247d6057698df97bcb800.tar.gz
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/window.c')
-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)
}
-DEFUN ("recenter", Frecenter, Srecenter, 0, 1, "P",
+DEFUN ("recenter", Frecenter, Srecenter, 0, 2, "P",
doc: /* Center point in selected window and maybe redisplay frame.
With a numeric prefix argument ARG, recenter putting point on screen line ARG
relative to the selected window. If ARG is negative, it counts up from the
bottom of the window. (ARG should be less than the height of the window.)
-If ARG is omitted or nil, then recenter with point on the middle line of
-the selected window; if the variable `recenter-redisplay' is non-nil,
-also erase the entire frame and redraw it (when `auto-resize-tool-bars'
-is set to `grow-only', this resets the tool-bar's height to the minimum
-height needed); if `recenter-redisplay' has the special value `tty',
-then only tty frames are redrawn.
+If ARG is omitted or nil, then recenter with point on the middle line
+of the selected window; if REDISPLAY & `recenter-redisplay' are
+non-nil, also erase the entire frame and redraw it (when
+`auto-resize-tool-bars' is set to `grow-only', this resets the
+tool-bar's height to the minimum height needed); if
+`recenter-redisplay' has the special value `tty', then only tty frames
+are redrawn.
Just C-u as prefix means put point in the center of the window
and redisplay normally--don't erase and redraw the frame. */)
- (register Lisp_Object arg)
+ (Lisp_Object arg, Lisp_Object redisplay)
{
struct window *w = XWINDOW (selected_window);
struct buffer *buf = XBUFFER (w->contents);
@@ -5931,7 +5932,8 @@ and redisplay normally--don't erase and redraw the frame. */)
if (NILP (arg))
{
- if (!NILP (Vrecenter_redisplay)
+ if (!NILP (redisplay)
+ && !NILP (Vrecenter_redisplay)
&& (!EQ (Vrecenter_redisplay, Qtty)
|| !NILP (Ftty_type (selected_frame))))
{