]> git.eshelyaron.com Git - emacs.git/commitdiff
Add the `recenter-redisplay' variable, and make `recenter' use it.
authorMiles Bader <miles@gnu.org>
Tue, 23 Jun 2009 07:07:45 +0000 (07:07 +0000)
committerMiles Bader <miles@gnu.org>
Tue, 23 Jun 2009 07:07:45 +0000 (07:07 +0000)
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-1604

doc/emacs/ChangeLog
doc/emacs/display.texi
lisp/ChangeLog
lisp/cus-start.el
src/ChangeLog
src/window.c

index d060b4679e09119b053c9f099a8fc1c8b2f4a112..c990259b76db221729a0305245881171e8a257ff 100644 (file)
@@ -1,3 +1,7 @@
+2009-06-23  Miles Bader  <miles@gnu.org>
+
+       * display.texi (Scrolling): Document `recenter-redisplay'
+
 2009-06-21  Chong Yidong  <cyd@stupidchicken.com>
 
        * Branch for 23.1.
index 859ed50194b66309252d8b2908c8bd31ef794c0a..5cffc2e337729668fb3d2e0b1fac8ce440e28039 100644 (file)
@@ -54,7 +54,7 @@ commands:
 @table @kbd
 @item C-l
 Scroll the selected window to center point vertically within it and
-redisplay the screen (@code{recenter-top-bottom}).
+maybe redisplay the screen (@code{recenter-top-bottom}).
 @item C-v
 @itemx @key{next}
 @itemx @key{PageDown}
@@ -73,9 +73,12 @@ Scroll heuristically to bring useful information onto the screen
   The most basic scrolling command is @kbd{C-l}
 (@code{recenter-top-bottom}).  This @dfn{recenters} the selected
 window, scrolling it so that the current screen line is exactly in the
-center of the window, or as close to the center as possible.  It also
-clears the screen and redisplays all windows; this is useful in case
-the screen becomes garbled for any reason (@pxref{Screen Garbled}).
+center of the window, or as close to the center as possible.  If the
+variable @var{recenter-redisplay} is non-nil, it also clears the
+screen and redisplays all windows; this is useful in case the screen
+becomes garbled for any reason (@pxref{Screen Garbled}).  If
+@var{recenter-redisplay} has the special value @code{tty} (the
+default), then redisplay only happens on tty frames.
 
   Typing @kbd{C-l} twice in a row (@kbd{C-l C-l}) scrolls the window
 so that point is on the topmost screen line.  Typing a third @kbd{C-l}
@@ -95,6 +98,11 @@ puts point on the bottom line, and @kbd{C-u - 5 C-l} puts it five
 lines from the bottom.  When given an argument, @kbd{C-l} does not
 clear the screen or cycle through different screen positions.
 
+@vindex recenter-redisplay
+  When the variable @code{recenter-redisplay} is non-nil, the
+@code{recenter} and @code{recenter-top-bottom} commands redisplay the
+selected frame when they are invoked without a prefix argument.
+
 @kindex C-v
 @kindex M-v
 @kindex next
index 75b1048baca9c1d270b7504a786713128c60f2c8..879d8b3765552a7eaec24d89fc4117a4fec97a47 100644 (file)
@@ -1,3 +1,7 @@
+2009-06-23  Miles Bader  <miles@gnu.org>
+
+       * cus-start.el: Add entry for `recenter-redisplay'.
+
 2009-06-22  Dan Nicolaescu  <dann@ics.uci.edu>
 
        * vc-hooks.el (vc-stay-local-p, vc-state, vc-working-revision):
index d8d3cc5d3ac85b6d0e1c5bdd2ed788da9e703c37..09a0a93b103264b232fb00424b4ba88dfb5bc0c9 100644 (file)
@@ -307,6 +307,12 @@ since it could result in memory overflow and make Emacs crash."
                       (const :tag "Off (nil)" :value nil)
                       (const :tag "Full screen (t)" :value t)
                       (other :tag "Always" 1)) "22.1")
+            (recenter-redisplay windows
+                                (choice
+                                 (const :tag "Never (nil)" :value nil)
+                                 (const :tag "Only on ttys" :value tty)
+                                 (other :tag "Always" t))
+                                "23.1")
             ;; xdisp.c
             (scroll-step windows integer)
             (scroll-conservatively windows integer)
index 9e1830e4d4a8da88f9625abd1103d6767d7bc243..1c7e15979f9fa5dac461bc9116516ddba2eeab53 100644 (file)
@@ -1,3 +1,10 @@
+2009-06-23  Miles Bader  <miles@gnu.org>
+
+       * window.c (Vrecenter_redisplay): New variable.
+       (syms_of_window): Initialize it.
+       (Qtty): New extern declaration.
+       (Frecenter): Only do redisplay if Vrecenter_redisplay requests it.
+
 2009-06-23  Jim Meyering  <meyering@redhat.com>
 
        Don't dereference NULL upon failed malloc and realloc
index 4c68de2b9059abf4c9572cea90f797dad8d3ac48..08fd8c829fa0eabe7388523f3865e5b661ff55ed 100644 (file)
@@ -193,6 +193,14 @@ static int inhibit_frame_unsplittable;
 extern EMACS_INT scroll_margin;
 
 extern Lisp_Object Qwindow_scroll_functions, Vwindow_scroll_functions;
+
+/* If non-nil, then the `recenter' command with a nil argument
+   the entire frame to be redrawn; the special value `tty' causes the
+   frame to be redrawn only if it is a tty frame.  */
+
+static Lisp_Object Vrecenter_redisplay;
+extern Lisp_Object Qtty;
+
 \f
 DEFUN ("windowp", Fwindowp, Swindowp, 1, 1, 0,
        doc: /* Return t if OBJECT is a window.  */)
@@ -5602,14 +5610,17 @@ displayed_window_lines (w)
 
 
 DEFUN ("recenter", Frecenter, Srecenter, 0, 1, "P",
-       doc: /* Center point in selected window and redisplay frame.
+       doc: /* Center point in selected window and maybe redisplay frame.
 With 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, erase the entire frame and then redraw with point
-in the center of the selected window.  If `auto-resize-tool-bars' is set to
-`grow-only', this resets the tool-bar's height to the minimum height needed.
+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 frame 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.  */)
@@ -5629,16 +5640,22 @@ and redisplay normally--don't erase and redraw the frame.  */)
 
   if (NILP (arg))
     {
-      int i;
+      if (!NILP (Vrecenter_redisplay)
+         && (!EQ (Vrecenter_redisplay, Qtty)
+             || !NILP (Ftty_type (selected_frame))))
+       {
+         int i;
 
-      /* Invalidate pixel data calculated for all compositions.  */
-      for (i = 0; i < n_compositions; i++)
-       composition_table[i]->font = NULL;
+         /* Invalidate pixel data calculated for all compositions.  */
+         for (i = 0; i < n_compositions; i++)
+           composition_table[i]->font = NULL;
 
-      WINDOW_XFRAME (w)->minimize_tool_bar_window_p = 1;
+         WINDOW_XFRAME (w)->minimize_tool_bar_window_p = 1;
+
+         Fredraw_frame (WINDOW_FRAME (w));
+         SET_FRAME_GARBAGED (WINDOW_XFRAME (w));
+       }
 
-      Fredraw_frame (WINDOW_FRAME (w));
-      SET_FRAME_GARBAGED (WINDOW_XFRAME (w));
       center_p = 1;
     }
   else if (CONSP (arg)) /* Just C-u. */
@@ -7246,6 +7263,13 @@ selected; while the global part is run only once for the modified frame,
 with the relevant frame selected.  */);
   Vwindow_configuration_change_hook = Qnil;
 
+  DEFVAR_LISP ("recenter-redisplay", &Vrecenter_redisplay,
+              doc: /* If non-nil, then the `recenter' command with a nil argument
+the entire frame to be redrawn; the special value `tty' causes the
+frame to be redrawn only if it is a tty frame.  */);
+  Vrecenter_redisplay = Qtty;
+
+
   defsubr (&Sselected_window);
   defsubr (&Sminibuffer_window);
   defsubr (&Swindow_minibuffer_p);