diff options
| author | Miles Bader | 2009-06-23 07:07:45 +0000 |
|---|---|---|
| committer | Miles Bader | 2009-06-23 07:07:45 +0000 |
| commit | 666e158e382bca51630b3822a54bf51c52d41d23 (patch) | |
| tree | 75125ed242a47eeba4403398b3845faea4f097ac /src/window.c | |
| parent | c6da7cd2b63cc9094d690b74875bf8609b5c0107 (diff) | |
| download | emacs-666e158e382bca51630b3822a54bf51c52d41d23.tar.gz emacs-666e158e382bca51630b3822a54bf51c52d41d23.zip | |
Add the `recenter-redisplay' variable, and make `recenter' use it.
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-1604
Diffstat (limited to 'src/window.c')
| -rw-r--r-- | src/window.c | 46 |
1 files changed, 35 insertions, 11 deletions
diff --git a/src/window.c b/src/window.c index 4c68de2b905..08fd8c829fa 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -193,6 +193,14 @@ static int inhibit_frame_unsplittable; | |||
| 193 | extern EMACS_INT scroll_margin; | 193 | extern EMACS_INT scroll_margin; |
| 194 | 194 | ||
| 195 | extern Lisp_Object Qwindow_scroll_functions, Vwindow_scroll_functions; | 195 | extern Lisp_Object Qwindow_scroll_functions, Vwindow_scroll_functions; |
| 196 | |||
| 197 | /* If non-nil, then the `recenter' command with a nil argument | ||
| 198 | the entire frame to be redrawn; the special value `tty' causes the | ||
| 199 | frame to be redrawn only if it is a tty frame. */ | ||
| 200 | |||
| 201 | static Lisp_Object Vrecenter_redisplay; | ||
| 202 | extern Lisp_Object Qtty; | ||
| 203 | |||
| 196 | 204 | ||
| 197 | DEFUN ("windowp", Fwindowp, Swindowp, 1, 1, 0, | 205 | DEFUN ("windowp", Fwindowp, Swindowp, 1, 1, 0, |
| 198 | doc: /* Return t if OBJECT is a window. */) | 206 | doc: /* Return t if OBJECT is a window. */) |
| @@ -5602,14 +5610,17 @@ displayed_window_lines (w) | |||
| 5602 | 5610 | ||
| 5603 | 5611 | ||
| 5604 | DEFUN ("recenter", Frecenter, Srecenter, 0, 1, "P", | 5612 | DEFUN ("recenter", Frecenter, Srecenter, 0, 1, "P", |
| 5605 | doc: /* Center point in selected window and redisplay frame. | 5613 | doc: /* Center point in selected window and maybe redisplay frame. |
| 5606 | With prefix argument ARG, recenter putting point on screen line ARG | 5614 | With prefix argument ARG, recenter putting point on screen line ARG |
| 5607 | relative to the selected window. If ARG is negative, it counts up from the | 5615 | relative to the selected window. If ARG is negative, it counts up from the |
| 5608 | bottom of the window. (ARG should be less than the height of the window.) | 5616 | bottom of the window. (ARG should be less than the height of the window.) |
| 5609 | 5617 | ||
| 5610 | If ARG is omitted or nil, erase the entire frame and then redraw with point | 5618 | If ARG is omitted or nil, then recenter with point on the middle line of |
| 5611 | in the center of the selected window. If `auto-resize-tool-bars' is set to | 5619 | the selected window; if the variable `recenter-redisplay' is non-nil, |
| 5612 | `grow-only', this resets the tool-bar's height to the minimum height needed. | 5620 | also erase the entire frame and redraw it (when `auto-resize-tool-bars' |
| 5621 | is set to `grow-only', this resets the tool-bar's height to the minimum | ||
| 5622 | height needed); if `recenter-redisplay' has the special value `tty', | ||
| 5623 | then only tty frame are redrawn. | ||
| 5613 | 5624 | ||
| 5614 | Just C-u as prefix means put point in the center of the window | 5625 | Just C-u as prefix means put point in the center of the window |
| 5615 | and redisplay normally--don't erase and redraw the frame. */) | 5626 | and redisplay normally--don't erase and redraw the frame. */) |
| @@ -5629,16 +5640,22 @@ and redisplay normally--don't erase and redraw the frame. */) | |||
| 5629 | 5640 | ||
| 5630 | if (NILP (arg)) | 5641 | if (NILP (arg)) |
| 5631 | { | 5642 | { |
| 5632 | int i; | 5643 | if (!NILP (Vrecenter_redisplay) |
| 5644 | && (!EQ (Vrecenter_redisplay, Qtty) | ||
| 5645 | || !NILP (Ftty_type (selected_frame)))) | ||
| 5646 | { | ||
| 5647 | int i; | ||
| 5633 | 5648 | ||
| 5634 | /* Invalidate pixel data calculated for all compositions. */ | 5649 | /* Invalidate pixel data calculated for all compositions. */ |
| 5635 | for (i = 0; i < n_compositions; i++) | 5650 | for (i = 0; i < n_compositions; i++) |
| 5636 | composition_table[i]->font = NULL; | 5651 | composition_table[i]->font = NULL; |
| 5637 | 5652 | ||
| 5638 | WINDOW_XFRAME (w)->minimize_tool_bar_window_p = 1; | 5653 | WINDOW_XFRAME (w)->minimize_tool_bar_window_p = 1; |
| 5654 | |||
| 5655 | Fredraw_frame (WINDOW_FRAME (w)); | ||
| 5656 | SET_FRAME_GARBAGED (WINDOW_XFRAME (w)); | ||
| 5657 | } | ||
| 5639 | 5658 | ||
| 5640 | Fredraw_frame (WINDOW_FRAME (w)); | ||
| 5641 | SET_FRAME_GARBAGED (WINDOW_XFRAME (w)); | ||
| 5642 | center_p = 1; | 5659 | center_p = 1; |
| 5643 | } | 5660 | } |
| 5644 | else if (CONSP (arg)) /* Just C-u. */ | 5661 | else if (CONSP (arg)) /* Just C-u. */ |
| @@ -7246,6 +7263,13 @@ selected; while the global part is run only once for the modified frame, | |||
| 7246 | with the relevant frame selected. */); | 7263 | with the relevant frame selected. */); |
| 7247 | Vwindow_configuration_change_hook = Qnil; | 7264 | Vwindow_configuration_change_hook = Qnil; |
| 7248 | 7265 | ||
| 7266 | DEFVAR_LISP ("recenter-redisplay", &Vrecenter_redisplay, | ||
| 7267 | doc: /* If non-nil, then the `recenter' command with a nil argument | ||
| 7268 | the entire frame to be redrawn; the special value `tty' causes the | ||
| 7269 | frame to be redrawn only if it is a tty frame. */); | ||
| 7270 | Vrecenter_redisplay = Qtty; | ||
| 7271 | |||
| 7272 | |||
| 7249 | defsubr (&Sselected_window); | 7273 | defsubr (&Sselected_window); |
| 7250 | defsubr (&Sminibuffer_window); | 7274 | defsubr (&Sminibuffer_window); |
| 7251 | defsubr (&Swindow_minibuffer_p); | 7275 | defsubr (&Swindow_minibuffer_p); |