unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* recenter-redisplay
@ 2009-04-20  1:30 Miles Bader
  2009-04-20  3:06 ` recenter-redisplay Drew Adams
  2009-04-20 13:25 ` recenter-redisplay Leo
  0 siblings, 2 replies; 8+ messages in thread
From: Miles Bader @ 2009-04-20  1:30 UTC (permalink / raw)
  To: emacs-devel

I find the "dual functionality" of recenter, and particularly
recenter-top-bottom pretty annoying -- 99% of the time I just want to
shift the window contents around, and the frame-redrawing side-effect is
just irritating flicker.

[This is especially true these days, when lossy communication channels
are very rare, and in most cases, what redisplay is necessary happens
automatically.]

So I made the following patch, which adds a variable
`recenter-redisplay' to control whether recenter (and thus
recenter-top-bottom) also do redisplay or not.  For backward
compatibility it defaults to t.

I'm perfectly happen to use M-x redraw-display if I actually need to
redraw a display...

Opinions?

diff --git a/doc/emacs/display.texi b/doc/emacs/display.texi
index 905b47b..6144f94 100644
*** a/doc/emacs/display.texi
--- b/doc/emacs/display.texi
***************
*** 54,60 ****
  @table @kbd
  @item C-l
  Scroll the selected window to center point vertically within it and
! redisplay the screen (@code{recenter-top-bottom}).
  @item C-v
  @itemx @key{NEXT}
  @itemx @key{PAGEDOWN}
--- 54,60 ----
  @table @kbd
  @item C-l
  Scroll the selected window to center point vertically within it and
! maybe redisplay the screen (@code{recenter-top-bottom}).
  @item C-v
  @itemx @key{NEXT}
  @itemx @key{PAGEDOWN}
***************
*** 73,81 ****
    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}).
  
    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}
--- 73,82 ----
    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.  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}).
  
    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,100 ****
--- 96,106 ----
  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
diff --git a/lisp/cus-start.el b/lisp/cus-start.el
index d8d3cc5..4545f5a 100644
*** a/lisp/cus-start.el
--- b/lisp/cus-start.el
***************
*** 307,312 ****
--- 307,313 ----
   		       (const :tag "Off (nil)" :value nil)
   		       (const :tag "Full screen (t)" :value t)
   		       (other :tag "Always" 1)) "22.1")
+ 	     (recenter-redisplay windows boolean "23.1")
  	     ;; xdisp.c
  	     (scroll-step windows integer)
  	     (scroll-conservatively windows integer)
diff --git a/src/window.c b/src/window.c
index 4c68de2..126e8a3 100644
*** a/src/window.c
--- b/src/window.c
***************
*** 193,198 ****
--- 193,204 ----
  extern EMACS_INT scroll_margin;
  
  extern Lisp_Object Qwindow_scroll_functions, Vwindow_scroll_functions;
+ 
+ /* If non-zero, then the `recenter' command with a nil argument
+    also causes the entire frame to be redrawn.  */
+ 
+ static int recenter_redisplay;
+ 
  \f
  DEFUN ("windowp", Fwindowp, Swindowp, 1, 1, 0,
         doc: /* Return t if OBJECT is a window.  */)
***************
*** 5602,5615 ****
  
  
  DEFUN ("recenter", Frecenter, Srecenter, 0, 1, "P",
!        doc: /* Center point in selected window and 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.
  
  Just C-u as prefix means put point in the center of the window
  and redisplay normally--don't erase and redraw the frame.  */)
--- 5608,5623 ----
  
  
  DEFUN ("recenter", Frecenter, Srecenter, 0, 1, "P",
!        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, 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 (if
! `auto-resize-tool-bars' is set to `grow-only', this resets the
! tool-bar's height to the minimum height needed).
  
  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,5644 ****
  
    if (NILP (arg))
      {
!       int i;
  
!       /* 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;
  
-       Fredraw_frame (WINDOW_FRAME (w));
-       SET_FRAME_GARBAGED (WINDOW_XFRAME (w));
        center_p = 1;
      }
    else if (CONSP (arg)) /* Just C-u. */
--- 5637,5656 ----
  
    if (NILP (arg))
      {
!       if (recenter_redisplay)
! 	{
! 	  int i;
  
! 	  /* 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;
! 
! 	  Fredraw_frame (WINDOW_FRAME (w));
! 	  SET_FRAME_GARBAGED (WINDOW_XFRAME (w));
! 	}
  
        center_p = 1;
      }
    else if (CONSP (arg)) /* Just C-u. */
***************
*** 7246,7251 ****
--- 7258,7269 ----
  with the relevant frame selected.  */);
    Vwindow_configuration_change_hook = Qnil;
  
+   DEFVAR_BOOL ("recenter-redisplay", &recenter_redisplay,
+ 	       doc: /* If non-nil, then the `recenter' command with a nil argument
+ also causes the entire frame to be redrawn.  */);
+   recenter_redisplay = 1;
+ 
+ 
    defsubr (&Sselected_window);
    defsubr (&Sminibuffer_window);
    defsubr (&Swindow_minibuffer_p);


-- 
"1971 pickup truck; will trade for guns"




^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: recenter-redisplay
  2009-04-20  1:30 recenter-redisplay Miles Bader
@ 2009-04-20  3:06 ` Drew Adams
  2009-04-20  8:30   ` recenter-redisplay Lennart Borgman
  2009-04-20 13:25 ` recenter-redisplay Leo
  1 sibling, 1 reply; 8+ messages in thread
From: Drew Adams @ 2009-04-20  3:06 UTC (permalink / raw)
  To: 'Miles Bader', emacs-devel

I didn't try it, but it sounds good to me. I don't really care about redisplay
either way. It doesn't annoy me, but I agree that it might as well be
independent from recentering. I like the proposal. If implemented, I will likely
never bother to use the redisplay part.

I'd even vote for turning off redisplay by default (setting the variable to nil
by default). Is there really anyone who cares about backward compatibility in
this case? (I do remember, however, connecting over a modem at 1200 baud or
whatever it was. Many, many moon ago...)





^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: recenter-redisplay
  2009-04-20  3:06 ` recenter-redisplay Drew Adams
@ 2009-04-20  8:30   ` Lennart Borgman
  2009-06-22  6:32     ` recenter-redisplay Miles Bader
  0 siblings, 1 reply; 8+ messages in thread
From: Lennart Borgman @ 2009-04-20  8:30 UTC (permalink / raw)
  To: Drew Adams; +Cc: emacs-devel, Miles Bader

On Mon, Apr 20, 2009 at 5:06 AM, Drew Adams <drew.adams@oracle.com> wrote:
> I didn't try it, but it sounds good to me. I don't really care about redisplay
> either way. It doesn't annoy me, but I agree that it might as well be
> independent from recentering. I like the proposal. If implemented, I will likely
> never bother to use the redisplay part.
>
> I'd even vote for turning off redisplay by default (setting the variable to nil
> by default). Is there really anyone who cares about backward compatibility in
> this case? (I do remember, however, connecting over a modem at 1200 baud or
> whatever it was. Many, many moon ago...)

Yes, turn it off by default.




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: recenter-redisplay
  2009-04-20  1:30 recenter-redisplay Miles Bader
  2009-04-20  3:06 ` recenter-redisplay Drew Adams
@ 2009-04-20 13:25 ` Leo
  1 sibling, 0 replies; 8+ messages in thread
From: Leo @ 2009-04-20 13:25 UTC (permalink / raw)
  To: emacs-devel

On 2009-04-20 02:30 +0100, Miles Bader wrote:
> I find the "dual functionality" of recenter, and particularly
> recenter-top-bottom pretty annoying -- 99% of the time I just want to
> shift the window contents around, and the frame-redrawing side-effect is
> just irritating flicker.
>
> [This is especially true these days, when lossy communication channels
> are very rare, and in most cases, what redisplay is necessary happens
> automatically.]
>
> So I made the following patch, which adds a variable
> `recenter-redisplay' to control whether recenter (and thus
> recenter-top-bottom) also do redisplay or not.  For backward
> compatibility it defaults to t.
>
> I'm perfectly happen to use M-x redraw-display if I actually need to
> redraw a display...
>
> Opinions?

I also like this proposal.

-- 
.:  Leo  :.  [ sdl.web AT gmail.com ]  .: I use Emacs :.

               www.git-scm.com
    git - the one true version control system





^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: recenter-redisplay
  2009-04-20  8:30   ` recenter-redisplay Lennart Borgman
@ 2009-06-22  6:32     ` Miles Bader
  2009-06-22  7:05       ` recenter-redisplay Eli Zaretskii
  2009-06-23  3:52       ` recenter-redisplay Richard Stallman
  0 siblings, 2 replies; 8+ messages in thread
From: Miles Bader @ 2009-06-22  6:32 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: Drew Adams, emacs-devel

Since nobody commented otherwise, I'll check in this patch (with
redisplay off by default -- my impression is that corrupted displays
are so rare on modern systems, that there's little point in catering
to them with a common binding).

-Miles

-- 
Do not taunt Happy Fun Ball.




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: recenter-redisplay
  2009-06-22  6:32     ` recenter-redisplay Miles Bader
@ 2009-06-22  7:05       ` Eli Zaretskii
  2009-06-22  9:14         ` recenter-redisplay Miles Bader
  2009-06-23  3:52       ` recenter-redisplay Richard Stallman
  1 sibling, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2009-06-22  7:05 UTC (permalink / raw)
  To: Miles Bader; +Cc: lennart.borgman, drew.adams, emacs-devel

> From: Miles Bader <miles@gnu.org>
> Date: Mon, 22 Jun 2009 15:32:40 +0900
> Cc: Drew Adams <drew.adams@oracle.com>, emacs-devel@gnu.org
> 
> Since nobody commented otherwise, I'll check in this patch

Trunk or branch?  I hope the former.




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: recenter-redisplay
  2009-06-22  7:05       ` recenter-redisplay Eli Zaretskii
@ 2009-06-22  9:14         ` Miles Bader
  0 siblings, 0 replies; 8+ messages in thread
From: Miles Bader @ 2009-06-22  9:14 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: lennart.borgman, drew.adams, emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:
>> Since nobody commented otherwise, I'll check in this patch
>
> Trunk or branch?  I hope the former.

Yup

-miles

-- 
A zen-buddhist walked into a pizza shop and
said, "Make me one with everything."




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: recenter-redisplay
  2009-06-22  6:32     ` recenter-redisplay Miles Bader
  2009-06-22  7:05       ` recenter-redisplay Eli Zaretskii
@ 2009-06-23  3:52       ` Richard Stallman
  1 sibling, 0 replies; 8+ messages in thread
From: Richard Stallman @ 2009-06-23  3:52 UTC (permalink / raw)
  To: Miles Bader; +Cc: lennart.borgman, drew.adams, emacs-devel

Please do not change this behavior on terminals.
Corrupted display is common enough when editing on a terminal.
(Linux outputs various messages to the current terminal.)

Perhaps under X there is no need to redisplay the screen.






^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-06-23  3:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-20  1:30 recenter-redisplay Miles Bader
2009-04-20  3:06 ` recenter-redisplay Drew Adams
2009-04-20  8:30   ` recenter-redisplay Lennart Borgman
2009-06-22  6:32     ` recenter-redisplay Miles Bader
2009-06-22  7:05       ` recenter-redisplay Eli Zaretskii
2009-06-22  9:14         ` recenter-redisplay Miles Bader
2009-06-23  3:52       ` recenter-redisplay Richard Stallman
2009-04-20 13:25 ` recenter-redisplay Leo

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).