diff options
| author | John Shahid | 2018-06-28 09:13:45 -0400 |
|---|---|---|
| committer | Eli Zaretskii | 2018-07-01 19:05:37 +0300 |
| commit | 260768a64be39aada03247d6057698df97bcb800 (patch) | |
| tree | f61ec4466fc4768a2b0c610a8fc1ac931a067746 /src | |
| parent | 7edc019651b3e16592d2d16616a7d4cecc285ae6 (diff) | |
| download | emacs-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.c | 20 |
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 | ||
| 5899 | DEFUN ("recenter", Frecenter, Srecenter, 0, 1, "P", | 5899 | DEFUN ("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. |
| 5901 | With a numeric prefix argument ARG, recenter putting point on screen line ARG | 5901 | With a numeric prefix argument ARG, recenter putting point on screen line ARG |
| 5902 | relative to the selected window. If ARG is negative, it counts up from the | 5902 | relative to the selected window. If ARG is negative, it counts up from the |
| 5903 | bottom of the window. (ARG should be less than the height of the window.) | 5903 | bottom of the window. (ARG should be less than the height of the window.) |
| 5904 | 5904 | ||
| 5905 | If ARG is omitted or nil, then recenter with point on the middle line of | 5905 | If ARG is omitted or nil, then recenter with point on the middle line |
| 5906 | the selected window; if the variable `recenter-redisplay' is non-nil, | 5906 | of the selected window; if REDISPLAY & `recenter-redisplay' are |
| 5907 | also erase the entire frame and redraw it (when `auto-resize-tool-bars' | 5907 | non-nil, also erase the entire frame and redraw it (when |
| 5908 | is 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 |
| 5909 | height needed); if `recenter-redisplay' has the special value `tty', | 5909 | tool-bar's height to the minimum height needed); if |
| 5910 | then only tty frames are redrawn. | 5910 | `recenter-redisplay' has the special value `tty', then only tty frames |
| 5911 | are redrawn. | ||
| 5911 | 5912 | ||
| 5912 | Just C-u as prefix means put point in the center of the window | 5913 | Just C-u as prefix means put point in the center of the window |
| 5913 | and redisplay normally--don't erase and redraw the frame. */) | 5914 | and 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 | { |