bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#31325: 27.0.50; PROPOSAL: introduce a new function to recenter witho


From: John Shahid
Subject: bug#31325: 27.0.50; PROPOSAL: introduce a new function to recenter without redisplaying the frame
Date: Mon, 02 Jul 2018 20:38:38 +0000
User-agent: mu4e 1.1.0; emacs 27.0.50

Eli Zaretskii <address@hidden> writes:

>> From: John Shahid <address@hidden>
>> Cc: address@hidden, address@hidden, address@hidden
>> Date: Sun, 01 Jul 2018 18:58:09 +0000
>> 
>> >From 3ac3d2d5f60593776563e27d4b406b2776de9b96 Mon Sep 17 00:00:00 2001
>> From: John Shahid <address@hidden>
>> Date: Sun, 1 Jul 2018 14:48:24 -0400
>> Subject: [PATCH] Keep `recenter' behavior backward compatible when called
>>  interactively
>> 
>> * window.c (recenter): Change the interactive spec to always pass a
>>   non-nil value to the REDISPLAY argument when called interactively.
>> * window.el (recenter-top-bottom): Make sure recenter's second
>>   argument is non-nil everywhere.
>> * windows.texi (Textual Scrolling): Edit documentation of `recenter'.
>
> Bug number is missing.  Also, we prefer to quite in documentation (as
> opposed to doc strings) 'like this', not `like this'.

That is fixed in the attached patch.

>
>> --- a/doc/lispref/windows.texi
>> +++ b/doc/lispref/windows.texi
>> @@ -4154,7 +4154,8 @@ Textual Scrolling
>>  @code{recenter} puts the line containing point in the middle of the
>>  window.  If @var{count} is @code{nil} and @var{redisplay} is
>>  address@hidden, this function may redraw the frame, according to the
>> -value of @code{recenter-redisplay}.
>> +value of @code{recenter-redisplay}. Interactive calls pass non-‘nil’
>> +for @var{redisplay}.              ^^
>
> Two spaces between sentences.

Sorry about that, I'm still getting used to using 2 spaces after
period. How do you spot these ? Do you have some font-lock keyword to
highlight them. I found checkdoc not to be very useful for checking the
manual or docstrings in .c files.

>
>> -DEFUN ("recenter", Frecenter, Srecenter, 0, 2, "P",
>> +DEFUN ("recenter", Frecenter, Srecenter, 0, 2, "P\np",
>>         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
>> @@ -5910,7 +5910,7 @@ 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.
>> +are redrawn.  Interactive calls pass non-nil for REDISPLAY.
>
> I think this text is slightly more clear:
>
>   Interactively, REDISPLAY is always non-nil.

I changed the text in the attached patch.

Thanks,

>From ed35d20c422adc80bfbd4090b64d9a43d099b6b9 Mon Sep 17 00:00:00 2001
From: John Shahid <address@hidden>
Date: Sun, 1 Jul 2018 14:48:24 -0400
Subject: [PATCH] Keep interactive uses of 'recenter' backward compatible
 (Bug#31325)

* window.c (recenter): Change the interactive spec to always pass a
  non-nil value to the REDISPLAY argument when called interactively.
* window.el (recenter-top-bottom): Make sure recenter's second
  argument is non-nil everywhere.
* windows.texi (Textual Scrolling): Edit documentation of 'recenter'.
---
 doc/lispref/windows.texi | 3 ++-
 lisp/window.el           | 2 +-
 src/window.c             | 4 ++--
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi
index 9740bbebf2..6f1cf788a0 100644
--- a/doc/lispref/windows.texi
+++ b/doc/lispref/windows.texi
@@ -4154,7 +4154,8 @@ Textual Scrolling
 @code{recenter} puts the line containing point in the middle of the
 window.  If @var{count} is @code{nil} and @var{redisplay} is
 address@hidden, this function may redraw the frame, according to the
-value of @code{recenter-redisplay}.
+value of @code{recenter-redisplay}.  Interactive calls pass non-‘nil’
+for @var{redisplay}.
 
 When @code{recenter} is called interactively, @var{count} is the raw
 prefix argument.  Thus, typing @kbd{C-u} as the prefix sets the
diff --git a/lisp/window.el b/lisp/window.el
index 6d9d8bdcd2..d56bed63da 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -8767,7 +8767,7 @@ recenter-top-bottom
  With plain `C-u', move current line to window center."
   (interactive "P")
   (cond
-   (arg (recenter arg))                        ; Always respect ARG.
+   (arg (recenter arg t))                 ; Always respect ARG.
    (t
     (setq recenter-last-op
          (if (eq this-command last-command)
diff --git a/src/window.c b/src/window.c
index 20f6862e3b..047b741475 100644
--- a/src/window.c
+++ b/src/window.c
@@ -5896,7 +5896,7 @@ displayed_window_lines (struct window *w)
 }
 
 
-DEFUN ("recenter", Frecenter, Srecenter, 0, 2, "P",
+DEFUN ("recenter", Frecenter, Srecenter, 0, 2, "P\np",
        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
@@ -5908,7 +5908,7 @@ 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.
+are redrawn.  Interactively, REDISPLAY is always non-nil.
 
 Just C-u as prefix means put point in the center of the window
 and redisplay normally--don't erase and redraw the frame.  */)
-- 
2.18.0


reply via email to

[Prev in Thread] Current Thread [Next in Thread]