* recenter-top-bottom
@ 2007-11-06 16:53 Drew Adams
2007-11-06 17:02 ` recenter-top-bottom Lennart Borgman (gmail)
` (3 more replies)
0 siblings, 4 replies; 58+ messages in thread
From: Drew Adams @ 2007-11-06 16:53 UTC (permalink / raw)
To: Emacs-Devel
Any interest in this or something like it? I bind it to `C-l' in place of
`recenter'. If there is interest, then perhaps `recenter' itself could have
this behavior (but the frame redisplay behavior might need to be taken into
account).
With a prefix arg, it's the same as `recenter'. Otherwise, it alternately
moves the current line to the center, top, and bottom of the window. In
this, it's a bit like `C-M-l'. It's a trivial change, but I find it useful -
I have no need for repeated `C-l' to keep doing the same thing.
(defun recenter-top-bottom (&optional arg)
"Move current line to window center, top, and bottom, alternately.
With prefix ARG, move current line to window-line ARG."
(interactive "P")
(cond ((and (eq this-command last-command) (not arg))
(setq this-command 'recenter-top-bottom-1)
(recenter 0))
((and (eq 'recenter-top-bottom-1 last-command) (not arg))
(setq this-command 'recenter-top-bottom-2)
(recenter -1))
(t
(recenter arg))))
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: recenter-top-bottom
2007-11-06 16:53 recenter-top-bottom Drew Adams
@ 2007-11-06 17:02 ` Lennart Borgman (gmail)
2007-11-07 7:55 ` recenter-top-bottom Richard Stallman
` (2 subsequent siblings)
3 siblings, 0 replies; 58+ messages in thread
From: Lennart Borgman (gmail) @ 2007-11-06 17:02 UTC (permalink / raw)
To: Drew Adams; +Cc: Emacs-Devel
Drew Adams wrote:
> Any interest in this or something like it? I bind it to `C-l' in place of
> `recenter'. If there is interest, then perhaps `recenter' itself could have
> this behavior (but the frame redisplay behavior might need to be taken into
> account).
>
> With a prefix arg, it's the same as `recenter'. Otherwise, it alternately
> moves the current line to the center, top, and bottom of the window. In
> this, it's a bit like `C-M-l'. It's a trivial change, but I find it useful -
> I have no need for repeated `C-l' to keep doing the same thing.
>
> (defun recenter-top-bottom (&optional arg)
> "Move current line to window center, top, and bottom, alternately.
> With prefix ARG, move current line to window-line ARG."
> (interactive "P")
> (cond ((and (eq this-command last-command) (not arg))
> (setq this-command 'recenter-top-bottom-1)
> (recenter 0))
> ((and (eq 'recenter-top-bottom-1 last-command) (not arg))
> (setq this-command 'recenter-top-bottom-2)
> (recenter -1))
> (t
> (recenter arg))))
I like it, there is less to remember this way.
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: recenter-top-bottom
2007-11-06 16:53 recenter-top-bottom Drew Adams
2007-11-06 17:02 ` recenter-top-bottom Lennart Borgman (gmail)
@ 2007-11-07 7:55 ` Richard Stallman
2007-11-07 9:25 ` recenter-top-bottom Tassilo Horn
2007-11-08 0:41 ` recenter-top-bottom Juri Linkov
2007-11-11 8:27 ` recenter-top-bottom Alan Mackenzie
3 siblings, 1 reply; 58+ messages in thread
From: Richard Stallman @ 2007-11-07 7:55 UTC (permalink / raw)
To: Drew Adams; +Cc: emacs-devel
With a prefix arg, it's the same as `recenter'. Otherwise, it alternately
moves the current line to the center, top, and bottom of the window. In
this, it's a bit like `C-M-l'. It's a trivial change, but I find it useful -
I have no need for repeated `C-l' to keep doing the same thing.
It looks good to me. What do others think?
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: recenter-top-bottom
2007-11-07 7:55 ` recenter-top-bottom Richard Stallman
@ 2007-11-07 9:25 ` Tassilo Horn
0 siblings, 0 replies; 58+ messages in thread
From: Tassilo Horn @ 2007-11-07 9:25 UTC (permalink / raw)
To: emacs-devel; +Cc: Richard Stallman
Richard Stallman <rms@gnu.org> writes:
> With a prefix arg, it's the same as `recenter'. Otherwise, it
> alternately moves the current line to the center, top, and bottom
> of the window. In this, it's a bit like `C-M-l'. It's a trivial
> change, but I find it useful - I have no need for repeated `C-l'
> to keep doing the same thing.
>
> It looks good to me. What do others think?
I've remapped recenter to it, and I like it very much.
Bye,
Tassilo
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: recenter-top-bottom
@ 2007-11-07 13:16 Alan Mackenzie_JWA
2007-11-07 14:09 ` recenter-top-bottom Lennart Borgman (gmail)
` (2 more replies)
0 siblings, 3 replies; 58+ messages in thread
From: Alan Mackenzie_JWA @ 2007-11-07 13:16 UTC (permalink / raw)
To: emacs-devel; +Cc: Richard Stallman
[-- Attachment #1.1: Type: text/plain, Size: 2068 bytes --]
[Apologies for the lack of threading, etc.]
> With a prefix arg, it's the same as `recenter'. Otherwise, it
alternately
> moves the current line to the center, top, and bottom of the window.
In
> this, it's a bit like `C-M-l'. It's a trivial change, but I find it
useful -
> I have no need for repeated `C-l' to keep doing the same thing.
> It looks good to me. What do others think?
I wouldn't like it, because I'd find it too slow. I've
had defuns bound to C-S-<right>/<left> for years, which
move point directly to the top/bottom of the window
without passing Go or collecting $200. If I want to zap
point to BOW, I want it done NOW, atomically, not as a
triple key-sequence.
For this reason, I'd find the new command an irritation.
I think it would thus be better to have a user option to
request this new behaviour: something like this (untested):
[I've also edited the doc string; "alternately" is
inappropriate for three things; "successively" is right.]
(defvar recenter-triple-action-flag t ; or nil ???
"....")
(defun recenter-top-bottom (&optional arg)
"Move current line successively to window center, top, and bottom.
<=====
With prefix ARG, move current line to window-line ARG.
If option `recenter-triple-action-flag' is NIL, just recenter." ; <=====
(interactive "P")
(cond ((and recenter-triple-action-flag ; <=========
(eq this-command last-command) (not arg))
(setq this-command 'recenter-top-bottom-1)
(recenter 0))
((and recenter-triple-action-flag ; <=========
(eq 'recenter-top-bottom-1 last-command) (not arg))
(setq this-command 'recenter-top-bottom-2)
(recenter -1))
(t
(recenter arg))))
Perhaps its behaviour could be changed so that the
current window line is the criterion for where to go,
thusly:
(or <RANDOM> <BOTTOM>) -> <MIDDLE>
<MIDDLE> -> <TOP>
<TOP> -> <BOTTOM>.
This would make the new command more consistent with
C-M-l `reposition-window'.
--
Alan Mackenzie (Nuremberg, Germany).
[-- Attachment #1.2: Type: text/html, Size: 3689 bytes --]
[-- Attachment #2: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: recenter-top-bottom
2007-11-07 13:16 recenter-top-bottom Alan Mackenzie_JWA
@ 2007-11-07 14:09 ` Lennart Borgman (gmail)
2007-11-08 4:42 ` recenter-top-bottom Richard Stallman
2007-11-11 20:16 ` recenter-top-bottom Drew Adams
2 siblings, 0 replies; 58+ messages in thread
From: Lennart Borgman (gmail) @ 2007-11-07 14:09 UTC (permalink / raw)
To: Alan Mackenzie_JWA; +Cc: Richard Stallman, emacs-devel
Alan Mackenzie_JWA wrote:
> [Apologies for the lack of threading, etc.]
>
> > With a prefix arg, it's the same as `recenter'. Otherwise, it
> alternately
> > moves the current line to the center, top, and bottom of the
> window. In
> > this, it's a bit like `C-M-l'. It's a trivial change, but I find
> it useful -
> > I have no need for repeated `C-l' to keep doing the same thing.
>
> > It looks good to me. What do others think?
>
> I wouldn't like it, because I'd find it too slow. I've
In what way is it slower when todays binding of C-l?
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: recenter-top-bottom
[not found] <OF7E920891.667E3D64-ONC125738C.0058D24D-C125738C.00587C7B@philips.com>
@ 2007-11-07 17:24 ` Lennart Borgman (gmail)
2007-11-07 20:44 ` recenter-top-bottom Lennart Borgman (gmail)
0 siblings, 1 reply; 58+ messages in thread
From: Lennart Borgman (gmail) @ 2007-11-07 17:24 UTC (permalink / raw)
To: Alan Mackenzie_JWA; +Cc: Richard Stallman, emacs-devel
Alan Mackenzie_JWA wrote:
> >> I wouldn't like it, because I'd find it too slow. I've
>
> >> In what way is it slower when todays binding of C-l?
>
> Sorry, lack of clarity there. I meant that to scroll point to bottom
> of window, C-l C-l C-l is much slower than C-S-<left>. For me, it
> would be unusably slow. Given that, the changed functionality on C-l,
> though I'd only be caught by it occasionally, would irritate me.
How about C-u - C-l with Drews suggestion?
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: recenter-top-bottom
2007-11-07 17:24 ` recenter-top-bottom Lennart Borgman (gmail)
@ 2007-11-07 20:44 ` Lennart Borgman (gmail)
2007-11-07 21:54 ` recenter-top-bottom Lennart Borgman (gmail)
2007-11-08 17:39 ` recenter-top-bottom Richard Stallman
0 siblings, 2 replies; 58+ messages in thread
From: Lennart Borgman (gmail) @ 2007-11-07 20:44 UTC (permalink / raw)
To: Alan Mackenzie_JWA; +Cc: Drew Adams, emacs-devel
Lennart Borgman (gmail) wrote:
> Alan Mackenzie_JWA wrote:
>> >> I wouldn't like it, because I'd find it too slow. I've
>>
>> >> In what way is it slower when todays binding of C-l?
>>
>> Sorry, lack of clarity there. I meant that to scroll point to bottom
>> of window, C-l C-l C-l is much slower than C-S-<left>. For me, it
>> would be unusably slow. Given that, the changed functionality on C-l,
>> though I'd only be caught by it occasionally, would irritate me.
>
>
> How about C-u - C-l with Drews suggestion?
Or, here is another variant similar of Drew's suggestion. This uses
timeout and does not scroll until the action is decided. I have set the
time out to 2 seconds here, because it looks like there are some bugs
when putting back the key sequence that was read:
(defun recenter-top-bottom (&optional arg)
"Move current line to window center, top, and bottom, alternately.
With prefix ARG, move current line to window-line ARG.
Otherwise if the key sequence that invoked this command is
repeated within `cua-prefix-override-inhibit-delay' then current
line is moved to top, or if repeated again, bottom."
(interactive "P")
(if arg
(recenter arg)
(let* ((cmd-keys (this-command-keys))
(delay 2);cua-prefix-override-inhibit-delay)
(keys (with-timeout (delay nil) (read-key-sequence nil))))
(if (equal cmd-keys keys)
(let ((keys (with-timeout (delay nil) (read-key-sequence nil))))
(if (equal cmd-keys keys)
(recenter -1)
(recenter 0)
(put-back-read-key-sequence keys)))
(recenter)
(put-back-read-key-sequence keys)))))
(defun put-back-read-key-sequence (keys)
(when keys
(when (vectorp keys)
(setq keys (append keys nil)))
(isearch-unread keys)))
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: recenter-top-bottom
2007-11-07 20:44 ` recenter-top-bottom Lennart Borgman (gmail)
@ 2007-11-07 21:54 ` Lennart Borgman (gmail)
2007-11-08 17:39 ` recenter-top-bottom Richard Stallman
1 sibling, 0 replies; 58+ messages in thread
From: Lennart Borgman (gmail) @ 2007-11-07 21:54 UTC (permalink / raw)
To: Alan Mackenzie_JWA; +Cc: Drew Adams, emacs-devel
Lennart Borgman (gmail) wrote:
> (defun recenter-top-bottom (&optional arg)
> "Move current line to window center, top, and bottom, alternately.
> With prefix ARG, move current line to window-line ARG.
>
> Otherwise if the key sequence that invoked this command is
> repeated within `cua-prefix-override-inhibit-delay' then current
> line is moved to top, or if repeated again, bottom."
> (interactive "P")
> (if arg
> (recenter arg)
> (let* ((cmd-keys (this-command-keys))
> (delay 2);cua-prefix-override-inhibit-delay)
> (keys (with-timeout (delay nil) (read-key-sequence nil))))
> (if (equal cmd-keys keys)
> (let ((keys (with-timeout (delay nil) (read-key-sequence nil))))
> (if (equal cmd-keys keys)
> (recenter -1)
> (recenter 0)
> (put-back-read-key-sequence keys)))
> (recenter)
> (put-back-read-key-sequence keys)))))
>
> (defun put-back-read-key-sequence (keys)
> (when keys
> (when (vectorp keys)
> (setq keys (append keys nil)))
> (isearch-unread keys)))
I do not understand why, but this version works better:
(defun put-back-read-key-sequence (keys)
(when keys
(when (stringp keys)
(setq keys (string-to-char keys)))
(when (vectorp keys)
(setq keys (append keys nil)))
(isearch-unread keys)))
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: recenter-top-bottom
2007-11-06 16:53 recenter-top-bottom Drew Adams
2007-11-06 17:02 ` recenter-top-bottom Lennart Borgman (gmail)
2007-11-07 7:55 ` recenter-top-bottom Richard Stallman
@ 2007-11-08 0:41 ` Juri Linkov
2007-11-11 8:27 ` recenter-top-bottom Alan Mackenzie
3 siblings, 0 replies; 58+ messages in thread
From: Juri Linkov @ 2007-11-08 0:41 UTC (permalink / raw)
To: Drew Adams; +Cc: emacs-devel
> Any interest in this or something like it? I bind it to `C-l' in place
> of `recenter'. If there is interest, then perhaps `recenter' itself
> could have this behavior (but the frame redisplay behavior might need
> to be taken into account).
I think there should be an option to toggle this behavior for users who type
C-l repeatedly just to redraw the frame. And also an option to change
the default position of the center of the window where C-l puts point
when it is typed the first time. The middle of the window is not always
the preferable position, and I use my own version of C-l that puts point
at appr. 1/3 of the window height.
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: recenter-top-bottom
2007-11-07 13:16 recenter-top-bottom Alan Mackenzie_JWA
2007-11-07 14:09 ` recenter-top-bottom Lennart Borgman (gmail)
@ 2007-11-08 4:42 ` Richard Stallman
2007-11-11 20:16 ` recenter-top-bottom Drew Adams
2 siblings, 0 replies; 58+ messages in thread
From: Richard Stallman @ 2007-11-08 4:42 UTC (permalink / raw)
To: Alan Mackenzie_JWA; +Cc: emacs-devel
For this reason, I'd find the new command an irritation.
It would be an irritation, on occasions when you type multiple C-l in
a row and expect the current behavior. Is that something you often do?
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: recenter-top-bottom
2007-11-07 20:44 ` recenter-top-bottom Lennart Borgman (gmail)
2007-11-07 21:54 ` recenter-top-bottom Lennart Borgman (gmail)
@ 2007-11-08 17:39 ` Richard Stallman
1 sibling, 0 replies; 58+ messages in thread
From: Richard Stallman @ 2007-11-08 17:39 UTC (permalink / raw)
To: Lennart Borgman (gmail); +Cc: alan.mackenzie_jwa, drew.adams, emacs-devel
Or, here is another variant similar of Drew's suggestion. This uses
timeout and does not scroll until the action is decided. I have set the
time out to 2 seconds here, because it looks like there are some bugs
when putting back the key sequence that was read:
Adding a timeout means it really WILL be slow compared with the
current command. I don't want to make an ordinary single C-l any
slower than it is now.
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: recenter-top-bottom
2007-11-06 16:53 recenter-top-bottom Drew Adams
` (2 preceding siblings ...)
2007-11-08 0:41 ` recenter-top-bottom Juri Linkov
@ 2007-11-11 8:27 ` Alan Mackenzie
2007-11-11 23:54 ` recenter-top-bottom Richard Stallman
3 siblings, 1 reply; 58+ messages in thread
From: Alan Mackenzie @ 2007-11-11 8:27 UTC (permalink / raw)
To: Drew Adams; +Cc: Emacs-Devel
Hi, Drew!
A couple more technical points:
On Tue, Nov 06, 2007 at 08:53:39AM -0800, Drew Adams wrote:
> Any interest in this or something like it? I bind it to `C-l' in place
> of `recenter'. If there is interest, then perhaps `recenter' itself
> could have this behavior (but the frame redisplay behavior might need
> to be taken into account).
> With a prefix arg, it's the same as `recenter'. Otherwise, it
> alternately moves the current line to the center, top, and bottom of
> the window. In this, it's a bit like `C-M-l'. It's a trivial change,
> but I find it useful - I have no need for repeated `C-l' to keep doing
> the same thing.
`recenter' already has two functions: C-l means "redraw screen, scrolling
point to centre" and C-u C-l means "scroll point to centre,
flicker-free". Having thought about it, I very rarely use a bare C-l.
I reassert my view that any further functionality on C-l should be
optional.
> (defun recenter-top-bottom (&optional arg)
> "Move current line to window center, top, and bottom, alternately.
> With prefix ARG, move current line to window-line ARG."
> (interactive "P")
> (cond ((and (eq this-command last-command) (not arg))
> (setq this-command 'recenter-top-bottom-1) <===============
PLEASE DON'T DO THIS!!!! This is an abuse of `\(this\|last\)-command',
and will surely cause some other emacs function, present or future, to
fail. In particular, the contents of these variables have always been
executable commands. Surely you can defyourownvar for this.
> (recenter 0))
> ((and (eq 'recenter-top-bottom-1 last-command) (not arg))
> (setq this-command 'recenter-top-bottom-2) <================
> (recenter -1))
> (t
> (recenter arg))))
--
Alan Mackenzie (Ittersbach, Germany).
^ permalink raw reply [flat|nested] 58+ messages in thread
* RE: recenter-top-bottom
2007-11-07 13:16 recenter-top-bottom Alan Mackenzie_JWA
2007-11-07 14:09 ` recenter-top-bottom Lennart Borgman (gmail)
2007-11-08 4:42 ` recenter-top-bottom Richard Stallman
@ 2007-11-11 20:16 ` Drew Adams
2007-11-11 21:47 ` recenter-top-bottom Juri Linkov
2007-11-12 5:59 ` recenter-top-bottom Richard Stallman
2 siblings, 2 replies; 58+ messages in thread
From: Drew Adams @ 2007-11-11 20:16 UTC (permalink / raw)
To: Alan Mackenzie_JWA, emacs-devel; +Cc: Richard Stallman
I don't care what happens with the `recenter-top-bottom' suggestion I made -
feel free to adapt it or ignore it.
There was some interest and some feedback, however, and no one has adapted
the code and installed it, so I'll respond a bit. Again, from here on in,
please do whatever you like with the idea.
It sounds, BTW, as if it might be difficult to please everyone: Juri wants
an option to specify the "center" target (e.g. 1/3 vs 1/2 height). Juri
wants a toggle between the new behavior and plain `recenter', for redrawing
purposes. Alan wants an option (not a toggle) to choose this or plain
`recenter'... (Wrt the last: Users can just rebind `C-l' to `recenter' - no
need for such an option, IMO.)
Below is a new definition that responds to some of the feedback, but not
all. I didn't add any options or toggles - feel free to do so.
With the new definition:
1. The current window line determines the destination: If within the top
third, move to window bottom. If within the middle third, move to top. If
within the bottom third, move to center.
2. The `last-command' is no longer relevant. Only the current window
position decides the destination.
3. Destinations "top" and "bottom" are in fact `scroll-conservatively' and
bottom-minus-`scroll-conservatively', respectively, so you can control how
much is kept on screen. The default value of 0 means use absolute top and
bottom. I don't think it is worthwhile to have a new, separate option for
this, since the purpose of `scroll-conservatively' is about the same - it
seems like a good fit.
Like the previous definition I sent, an explicit ARG (either plain `C-u' or
numeric) always calls `(recenter ARG)'.
Alan:
> I've had defuns bound to C-S-<right>/<left> for years,
> which move point directly to the top/bottom of the window
> without passing Go or collecting $200. If I want to zap
> point to BOW, I want it done NOW, atomically, not as a
> triple key-sequence.
So if you already have a command bound that does that, use it. I don't see
your problem with a command that you don't use. The benefit of this
suggestion is to get 3 destinations with the same key (C-l). If you prefer
to have 3 separate keys for those destinations, go for it.
Alan:
> Having thought about it, I very rarely use a bare C-l.
So, IIUC, (1) you use your own keys/commands to move "NOW" to top or bottom,
and (2) you "very rarely use a bare C-l", which moves to the center. So
`recenter-top-bottom' should "very rarely" have any effect at all on you.
You will remain happy using `C-u C-l' and your C-S-<right>/<left> commands,
as usual. (`C-l' with a prefix arg is the same for `recenter-top-bottom' as
for `recenter'.)
Alan:
> any further functionality on C-l should be optional.
From what you say, you hardly ever use plain `C-l'. If you use `C-l' only
with a prefix arg, then you are not affected at all. However, such an option
could easily be accommodated, if others agree that it is useful. Personally,
I think it's enough for a user to rebind `C-l' to `recenter' - why have an
option for that?
Alan:
> Perhaps its behaviour could be changed so that the
> current window line is the criterion for where to go,
Good idea. I've done that in the new version, below.
Concerning frame redrawing:
The Emacs manual says that frame redisplay occurs only for a text terminal.
If redrawing for plain `C-l' is an important consideration here ("in case
the screen is garbled", which I imagine happens less nowadays), then I
propose that `recenter-top-bottom' be bound to `C-l' only when a window
manager is used. If redisplay for plain `C-l' is not an obstacle, then I
propose that we always bind `C-l' to `recenter-top-bottom'.
Alternatively, to allow for redisplay with no movement, we could add an
option, as Alan suggested, or a toggle, as Juri suggested. Or we could let
plain `C-u' call `(recenter)' to redisplay - in that case, the effect of
`C-u' would be opposite what it is for `recenter'. If there is still a need
for redisplay without movement but the need is rare, then `C-u C-l' is not
too much to ask of users, IMO. And any users who need that often could
simply bind `C-l' to `recenter'.
BTW, the doc string for `recenter' seems to contradict the Emacs manual
(node Scrolling). The manual says that `C-l' with a prefix arg does not
redraw the frame - and that is mentioned specifically in the context of a
numeric arg. The doc string says that redrawing is inhibited for plain
`C-u'; it suggests that redrawing occurs for numeric ARG.
Here's the new definition I'd propose:
(defun recenter-top-bottom (&optional arg)
"Move current line to line ARG, window center, top, or bottom.
With a prefix argument, this is the same as `recenter':
With numeric prefix ARG, move current line to window-line ARG.
With plain `C-u', move current line to window center.
Otherwise, the window starting position determines the next position:
If in the top third, move to bottom.
If in middle third, move to top.
If in bottom third, move tocenter.
Top and bottom destinations are actually `scroll-conservatively' lines
from true top and bottom."
(interactive "P")
(cond (arg (recenter arg))
(t
(let* ((top (1+ (count-lines 1 (window-start))))
(bottom (1+ (count-lines 1 (window-end))))
(current (1+ (count-lines 1 (point))))
(total (window-height)))
(cond ((< (- current top) (/ total 3))
(recenter (1- (- scroll-conservatively))))
((< (- bottom current) (/ total 3)) (recenter))
(t (recenter scroll-conservatively)))))))
Note that this code could be optimized by replacing the multiple
`count-lines' calls with a single-traversal pickup of top, bottom and
current values. I don't think such optimization is needed here, however.
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: recenter-top-bottom
2007-11-11 20:16 ` recenter-top-bottom Drew Adams
@ 2007-11-11 21:47 ` Juri Linkov
2007-11-11 22:38 ` recenter-top-bottom Drew Adams
2007-11-12 5:59 ` recenter-top-bottom Richard Stallman
1 sibling, 1 reply; 58+ messages in thread
From: Juri Linkov @ 2007-11-11 21:47 UTC (permalink / raw)
To: Drew Adams; +Cc: alan.mackenzie_jwa, emacs-devel
> (cond (arg (recenter arg))
> (t
> (let* ((top (1+ (count-lines 1 (window-start))))
> (bottom (1+ (count-lines 1 (window-end))))
> (current (1+ (count-lines 1 (point))))
> (total (window-height)))
> (cond ((< (- current top) (/ total 3))
> (recenter (1- (- scroll-conservatively))))
> ((< (- bottom current) (/ total 3)) (recenter))
> (t (recenter scroll-conservatively)))))))
I like the new definition of `recenter-top-bottom'. But there is one
problem: it doesn't work when point is close to the end of the buffer.
It doesn't put point to the upper half of the window but this
is possible with other commands (because the end of the buffer
is not attached to the end of the window in Emacs).
Also I suggest replacing `(recenter)' with `(recenter '(4))' to not redraw
the frame when moving point to the center, to not make it different from
moving point to other parts of the window that doesn't redraw the frame.
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 58+ messages in thread
* RE: recenter-top-bottom
2007-11-11 21:47 ` recenter-top-bottom Juri Linkov
@ 2007-11-11 22:38 ` Drew Adams
2007-11-11 22:59 ` recenter-top-bottom Juri Linkov
0 siblings, 1 reply; 58+ messages in thread
From: Drew Adams @ 2007-11-11 22:38 UTC (permalink / raw)
To: Juri Linkov; +Cc: alan.mackenzie_jwa, emacs-devel
> I like the new definition of `recenter-top-bottom'. But there is one
> problem: it doesn't work when point is close to the end of the buffer.
>
> It doesn't put point to the upper half of the window but this
> is possible with other commands (because the end of the buffer
> is not attached to the end of the window in Emacs).
Or at or near the beginning of the buffer. Depending on what you mean by
"work".
I think it DTRT in these cases, but you're welcome to tweak it.
> Also I suggest replacing `(recenter)' with `(recenter '(4))' to not redraw
> the frame when moving point to the center, to not make it different from
> moving point to other parts of the window that doesn't redraw the frame.
Yes. Go for it.
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: recenter-top-bottom
2007-11-11 22:38 ` recenter-top-bottom Drew Adams
@ 2007-11-11 22:59 ` Juri Linkov
2007-11-11 23:06 ` recenter-top-bottom Drew Adams
2007-11-12 0:12 ` recenter-top-bottom Bastien
0 siblings, 2 replies; 58+ messages in thread
From: Juri Linkov @ 2007-11-11 22:59 UTC (permalink / raw)
To: Drew Adams; +Cc: emacs-devel
>> I like the new definition of `recenter-top-bottom'. But there is one
>> problem: it doesn't work when point is close to the end of the buffer.
>>
>> It doesn't put point to the upper half of the window but this
>> is possible with other commands (because the end of the buffer
>> is not attached to the end of the window in Emacs).
>
> Or at or near the beginning of the buffer. Depending on what you mean by
> "work".
>
> I think it DTRT in these cases, but you're welcome to tweak it.
When point is at the end of the buffer and at the middle of the window
then typing C-l could move it to the beginning of the window.
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 58+ messages in thread
* RE: recenter-top-bottom
2007-11-11 22:59 ` recenter-top-bottom Juri Linkov
@ 2007-11-11 23:06 ` Drew Adams
2007-11-12 0:12 ` recenter-top-bottom Bastien
1 sibling, 0 replies; 58+ messages in thread
From: Drew Adams @ 2007-11-11 23:06 UTC (permalink / raw)
To: Juri Linkov; +Cc: emacs-devel
> >> I like the new definition of `recenter-top-bottom'. But there is one
> >> problem: it doesn't work when point is close to the end of the buffer.
> >>
> >> It doesn't put point to the upper half of the window but this
> >> is possible with other commands (because the end of the buffer
> >> is not attached to the end of the window in Emacs).
> >
> > Or at or near the beginning of the buffer. Depending on what you mean by
> > "work".
> >
> > I think it DTRT in these cases, but you're welcome to tweak it.
>
> When point is at the end of the buffer and at the middle of the window
> then typing C-l could move it to the beginning of the window.
Sure; do it.
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: recenter-top-bottom
2007-11-11 8:27 ` recenter-top-bottom Alan Mackenzie
@ 2007-11-11 23:54 ` Richard Stallman
0 siblings, 0 replies; 58+ messages in thread
From: Richard Stallman @ 2007-11-11 23:54 UTC (permalink / raw)
To: Alan Mackenzie; +Cc: drew.adams, emacs-devel
> (cond ((and (eq this-command last-command) (not arg))
> (setq this-command 'recenter-top-bottom-1) <===============
PLEASE DON'T DO THIS!!!! This is an abuse of `\(this\|last\)-command',
and will surely cause some other emacs function, present or future, to
fail.
Changing the value of these variables is the recommended way to do
this sort of thing. This is what they were made for.
In particular, the contents of these variables have always been
executable commands.
They have been, but I am not sure it matters -- does anything want to
funcall them? They are normally used for eq comparisons like these,
and the different facilities that use them don't interfere because they
check for different symbols.
The one thing to check is that the feature now being designed to
record the commands and their arguments works in a way that is not
broken by functions such as kill-region, which set this-command.
^ permalink raw reply [flat|nested] 58+ messages in thread
* RE: recenter-top-bottom
2007-11-12 0:12 ` recenter-top-bottom Bastien
@ 2007-11-11 23:56 ` Drew Adams
2007-11-12 4:56 ` recenter-top-bottom Bastien
2007-11-12 12:06 ` recenter-top-bottom Robert J. Chassell
0 siblings, 2 replies; 58+ messages in thread
From: Drew Adams @ 2007-11-11 23:56 UTC (permalink / raw)
To: Bastien, emacs-devel
> I often type C-l when to point is *near* the middle of the buffer, just
> to slightly adjust the display.
Just out of curiosity, why?
Except for refreshing the display, why anyone would use `C-l' with point
already at or near the center - and want it to stay there - is beyond me.
But people are different.
You could of course still do the same thing, but you would need to hit `C-l'
three times, not one. If you make such minor display adjustments with `C-l'
frequently, then, yes, this is not optimal for you.
> Sometimes, the point is already in the very middle and I
> don't notice it, and typing C-l just leaves the point
> where it is -- which is fine.
>
> I would find it disturbing to see the point jumping at the beginning of
> the window when it is at the middle of the window. For me, the middle
> of the window is kind of a gravity center, and hitting C-l should go
> there first, even when the point is already at the middle of the window.
As I said, I expect we're not going to be able to satisfy everyone on this,
regardless of how it is tweaked. If we decide to go this route, then there
will always be someone who prefers the old behavior. My preferred response
would be to tell them to just rebind `C-l' to `recenter' - nothing lost. I
would think most people would prefer the proposed behavior - but who knows?
FWIW - I find remarkable the language some people are using. I'm impressed
that anyone finds such a proposal "disturbing" or "an irritation" (and
screams "PLEASE DON'T DO THIS!!!!" for setting `last-command' to an
undefined command name). I'm truly amazed that this is so critical. I have
my own habits and preferences, so I understand, but I'm still a bit
surprised.
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: recenter-top-bottom
2007-11-11 22:59 ` recenter-top-bottom Juri Linkov
2007-11-11 23:06 ` recenter-top-bottom Drew Adams
@ 2007-11-12 0:12 ` Bastien
2007-11-11 23:56 ` recenter-top-bottom Drew Adams
1 sibling, 1 reply; 58+ messages in thread
From: Bastien @ 2007-11-12 0:12 UTC (permalink / raw)
To: emacs-devel
Juri Linkov <juri@jurta.org> writes:
>>> I like the new definition of `recenter-top-bottom'. But there is one
>>> problem: it doesn't work when point is close to the end of the buffer.
>>>
>>> It doesn't put point to the upper half of the window but this
>>> is possible with other commands (because the end of the buffer
>>> is not attached to the end of the window in Emacs).
>>
>> Or at or near the beginning of the buffer. Depending on what you mean by
>> "work".
>>
>> I think it DTRT in these cases, but you're welcome to tweak it.
>
> When point is at the end of the buffer and at the middle of the window
> then typing C-l could move it to the beginning of the window.
I often type C-l when to point is *near* the middle of the buffer, just
to slightly adjust the display. Sometimes, the point is already in the
very middle and I don't notice it, and typing C-l just leaves the point
where it is -- which is fine.
I would find it disturbing to see the point jumping at the beginning of
the window when it is at the middle of the window. For me, the middle
of the window is kind of a gravity center, and hitting C-l should go
there first, even when the point is already at the middle of the window.
--
Bastien
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: recenter-top-bottom
2007-11-11 23:56 ` recenter-top-bottom Drew Adams
@ 2007-11-12 4:56 ` Bastien
2007-11-12 8:33 ` recenter-top-bottom Drew Adams
2007-11-12 12:06 ` recenter-top-bottom Robert J. Chassell
1 sibling, 1 reply; 58+ messages in thread
From: Bastien @ 2007-11-12 4:56 UTC (permalink / raw)
To: Drew Adams; +Cc: emacs-devel
"Drew Adams" <drew.adams@oracle.com> writes:
>> I often type C-l when to point is *near* the middle of the buffer, just
>> to slightly adjust the display.
>
> Just out of curiosity, why?
No specific reason, it just appears I took this habit. It's just a way
to tell myself: okay, now concentrate on what you read.
> Except for refreshing the display, why anyone would use `C-l' with point
> already at or near the center - and want it to stay there - is beyond me.
> But people are different.
Moving the point to the center when the point is *near* the center
sounds okay to me.
But moving the point from the center to the top when the point is *at*
the center *and* when the last command was not 'recenter-top-bottom is
awkward. Because it is very likely that I wasn't aware the point was
already at the center and that I just wanted to move it to the center.
You can call this "refreshing", but 80% of the times I'm really trying
to recenter (not refresh) when the point is already at the center.
Relying on people's ability to *know* that the point is at the center to
move it without surprise sounds a bit risky to me.
> You could of course still do the same thing, but you would need to hit
> `C-l' three times, not one. If you make such minor display adjustments
> with `C-l' frequently, then, yes, this is not optimal for you.
If point is at the center and the last command was 'recenter-top-bottom
then I think it's ok to move the point to the top. But maybe the first
call should reach the center, even if it's already at the center.
But sure, I could also use `recenter' instead.
> FWIW - I find remarkable the language some people are using. I'm
> impressed that anyone finds such a proposal "disturbing" or "an
> irritation" (and screams "PLEASE DON'T DO THIS!!!!" for setting
> `last-command' to an undefined command name). I'm truly amazed that
> this is so critical.
I guess this is because C-l is a fundamuntal command. Every little
change to it strikes the imagination quite easily. Hence people are
shouting, crying, etc. but everyone's trying to be helpful here, no?
Anyway, I hope I was.
--
Bastien
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: recenter-top-bottom
2007-11-11 20:16 ` recenter-top-bottom Drew Adams
2007-11-11 21:47 ` recenter-top-bottom Juri Linkov
@ 2007-11-12 5:59 ` Richard Stallman
2007-11-12 7:17 ` recenter-top-bottom Bastien
2007-11-12 8:34 ` recenter-top-bottom Drew Adams
1 sibling, 2 replies; 58+ messages in thread
From: Richard Stallman @ 2007-11-12 5:59 UTC (permalink / raw)
To: Drew Adams; +Cc: alan.mackenzie_jwa, emacs-devel
1. The current window line determines the destination: If within the top
third, move to window bottom. If within the middle third, move to top. If
within the bottom third, move to center.
That is clever, but it has the bad effect of altering the behavior
of a single C-l. The virtue of your previous idea is that it
only alters the effect of repeated C-l.
So I think your first suggestion is better, and I am still thinking
of maybe installing it.
If people are very enthusiastic about your second suggestion,
I will say yes to it.
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: recenter-top-bottom
2007-11-12 5:59 ` recenter-top-bottom Richard Stallman
@ 2007-11-12 7:17 ` Bastien
2007-11-12 8:34 ` recenter-top-bottom Drew Adams
1 sibling, 0 replies; 58+ messages in thread
From: Bastien @ 2007-11-12 7:17 UTC (permalink / raw)
To: emacs-devel
Richard Stallman <rms@gnu.org> writes:
> 1. The current window line determines the destination: If within the top
> third, move to window bottom. If within the middle third, move to top. If
> within the bottom third, move to center.
>
> That is clever, but it has the bad effect of altering the behavior
> of a single C-l. The virtue of your previous idea is that it
> only alters the effect of repeated C-l.
Fully agreed. See my comment on the fact that any single call to
recenter-top-bottom should recenter, whether the display will be
modified (recenter) or not ("refresh").
> So I think your first suggestion is better
So do I.
--
Bastien
^ permalink raw reply [flat|nested] 58+ messages in thread
* RE: recenter-top-bottom
2007-11-12 4:56 ` recenter-top-bottom Bastien
@ 2007-11-12 8:33 ` Drew Adams
2007-11-12 13:01 ` recenter-top-bottom Bastien
0 siblings, 1 reply; 58+ messages in thread
From: Drew Adams @ 2007-11-12 8:33 UTC (permalink / raw)
To: Bastien; +Cc: emacs-devel
> But moving the point from the center to the top when the point is *at*
> the center *and* when the last command was not 'recenter-top-bottom is
> awkward. Because it is very likely that I wasn't aware the point was
> already at the center and that I just wanted to move it to the center.
It's unclear to me why someone wants to put the window point exactly at the
center. I look at this as trying to position a section of text, and point,
within a general window area, for convenience, visibility etc. - similar to
scrolling. So, for me, the window point being near the middle or at the
middle is the same goal. Why is it important for you to move the window
point precisely to the center (from nearby)? (You can still do that, but
`C-u C-l' is not as handy, if you want such precision often.)
I'm not trying to persuade you; I just don't see the use case. I can
understand why it might be important sometimes to have the window point
exactly at the window top or bottom, but I can't imagine why it is often
important to move it exactly to the middle from nearby.
> You can call this "refreshing", but 80% of the times I'm really trying
> to recenter (not refresh) when the point is already at the center.
What does that mean - recenter when the window point is already at the
center? You mean near the center, don't you?
> Relying on people's ability to *know* that the point is at the center to
> move it without surprise sounds a bit risky to me.
You don't have to know that the window point is at the center. You just need
to know whether it is nearer the center than the top or bottom. If you want
the window point mainly in the center area, and it is already there, then do
nothing. If it is not already there, then hit `C-l' once or twice. Same with
the other two areas: if the window point is in the area you want (top or
bottom), then do nothing; else hit `C-l' once or twice.
> > You could of course still do the same thing, but you would need to hit
> > `C-l' three times, not one. If you make such minor display adjustments
> > with `C-l' frequently, then, yes, this is not optimal for you.
>
> If point is at the center and the last command was 'recenter-top-bottom
> then I think it's ok to move the point to the top. But maybe the first
> call should reach the center, even if it's already at the center.
I don't see that. If that were the behavior, I'm sure someone would complain
that s?he had to hit `C-l' twice just to get the window point to move away
from the central area. I think it's better to leave the behavior as defined,
and let people choose whether they want that or plain `recenter' for `C-l'.
> But sure, I could also use `recenter' instead.
It sounds like that is what you prefer. I have no idea what most people
prefer - I was guessing that they would prefer what I proposed, but life can
be full of surprises.
> > FWIW - I find remarkable the language some people are using. I'm
> > impressed that anyone finds such a proposal "disturbing" or "an
> > irritation" (and screams "PLEASE DON'T DO THIS!!!!" for setting
> > `last-command' to an undefined command name). I'm truly amazed that
> > this is so critical.
>
> I guess this is because C-l is a fundamuntal command. Every little
> change to it strikes the imagination quite easily. Hence people are
> shouting, crying, etc.
I suppose it's mainly a question of habit - I was wondering if there wasn't
perhaps more than that involved here. But even so, it's not as if the good
ol' `recenter' behavior were being removed altogether. The only question is
about the default behavior - what most people find most helpful.
> but everyone's trying to be helpful here, no? Anyway, I hope I was.
Sure. Anyway, as I said, I don't have a preference for Emacs about this. I
use this as a personal preference, and I don't care whether it becomes the
default behavior or is even added to Emacs as an option. I am curious about
the range of opinion though.
^ permalink raw reply [flat|nested] 58+ messages in thread
* RE: recenter-top-bottom
2007-11-12 5:59 ` recenter-top-bottom Richard Stallman
2007-11-12 7:17 ` recenter-top-bottom Bastien
@ 2007-11-12 8:34 ` Drew Adams
2007-11-12 8:50 ` recenter-top-bottom Drew Adams
` (2 more replies)
1 sibling, 3 replies; 58+ messages in thread
From: Drew Adams @ 2007-11-12 8:34 UTC (permalink / raw)
To: rms; +Cc: alan.mackenzie_jwa, emacs-devel
> 1. The current window line determines the destination: If
> within the top third, move to window bottom. If within
> the middle third, move to top. If
> within the bottom third, move to center.
>
> That is clever, but it has the bad effect of altering the behavior
> of a single C-l. The virtue of your previous idea is that it
> only alters the effect of repeated C-l.
It was a suggestion from Alan, so as not to be required to use `C-l'
repeatedly to move the window point in some cases - just move immediately. I
think it's a good suggestion, myself.
The only things it doesn't let you do are:
1. Hit `C-l' only once to move from top to center. (Top moves to bottom.)
2. Hit `C-l' only once to move from near center to exact center.
Between top and bottom, I think top is the better choice for #1. That is, I
think it is more important for bottom to go to center than for top to go to
center. It seems natural to me, in terms of reading and scrolling. Cycling
means choosing one or the other order, in any case.
I don't understand a need for #2, but Bastien apparently does it often.
> So I think your first suggestion is better, and I am still thinking
> of maybe installing it.
>
> If people are very enthusiastic about your second suggestion,
> I will say yes to it.
I'm neutral. My personal preference (for myself, not for Emacs) is the
second suggestion, and I prefer either to plain `recenter'. But I think it's
unlikely that you will get a consensus for change on `C-l': preferences are
likely to vary, and habit with `recenter' will pull toward the status quo (I
almost said pull toward the center).
^ permalink raw reply [flat|nested] 58+ messages in thread
* RE: recenter-top-bottom
2007-11-12 8:34 ` recenter-top-bottom Drew Adams
@ 2007-11-12 8:50 ` Drew Adams
2007-11-12 13:15 ` recenter-top-bottom Bastien
2007-11-12 21:57 ` recenter-top-bottom Juri Linkov
2007-11-13 5:10 ` recenter-top-bottom Richard Stallman
2 siblings, 1 reply; 58+ messages in thread
From: Drew Adams @ 2007-11-12 8:50 UTC (permalink / raw)
To: emacs-devel
> So I think your first suggestion is better, and I am still thinking
> of maybe installing it. If people are very enthusiastic about
> your second suggestion, I will say yes to it.
Just to make it easier for people who might want to try both and compare,
here again are the two definitions. Each is a possible alternative binding
for `C-l'. (I've added the `scroll-conservatively' feature to #1, as well as
#2.)
(defun recenter-top-bottom-1 (&optional arg)
"Move current line to window center, top, and bottom, successively.
With prefix ARG, move current line to window-line ARG.
Top and bottom destinations are actually `scroll-conservatively' lines
from true top and bottom."
(interactive "P")
(cond ((and (eq this-command last-command) (not arg))
(setq this-command 'recenter-top-bottom-top)
(recenter scroll-conservatively))
((and (eq 'recenter-top-bottom-top last-command) (not arg))
(setq this-command 'recenter-top-bottom-bottom)
(recenter (1- (- scroll-conservatively))))
(t (recenter arg))))
(defun recenter-top-bottom-2 (&optional arg)
"Move current line to line ARG, window center, top, or bottom.
With a prefix argument, this is the same as `recenter':
With numeric prefix ARG, move current line to window-line ARG.
With plain `C-u', move current line to window center.
Otherwise, the window starting position determines the next position:
If in the top third, move to bottom.
If in middle third, move to top.
If in bottom third, move tocenter.
Top and bottom destinations are actually `scroll-conservatively' lines
from true top and bottom."
(interactive "P")
(cond (arg (recenter arg))
(t
(let* ((top (1+ (count-lines 1 (window-start))))
(bottom (1+ (count-lines 1 (window-end))))
(current (1+ (count-lines 1 (point))))
(total (window-height)))
(cond ((< (- current top) (/ total 3))
(recenter (1- (- scroll-conservatively))))
((< (- bottom current) (/ total 3)) (recenter '(4)))
(t (recenter scroll-conservatively)))))))
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: recenter-top-bottom
2007-11-11 23:56 ` recenter-top-bottom Drew Adams
2007-11-12 4:56 ` recenter-top-bottom Bastien
@ 2007-11-12 12:06 ` Robert J. Chassell
2007-11-12 13:05 ` recenter-top-bottom Lennart Borgman (gmail)
1 sibling, 1 reply; 58+ messages in thread
From: Robert J. Chassell @ 2007-11-12 12:06 UTC (permalink / raw)
To: emacs-devel
> I often type C-l when to point is *near* the middle of the buffer, just
> to slightly adjust the display.
Just out of curiosity, why?
Sometimes I do that in order to bring an otherwise invisible line into
view at the bottom or top of the window.
... rebind `C-l' to `recenter' ...
That is what I plan to do. It is a minor bother that after all these
years, you are thinking of changing it. In my .emacs file, that
binding will go along with the definitions using (recenter 0) and
(recenter -1) which I have long called `line-to-top-of-window' and
`line-to-bottom-of-window'.
(Interestingly, I often use `line-to-top-of-window', which is on a
function key.)
--
Robert J. Chassell GnuPG Key ID: 004B4AC8
bob@rattlesnake.com bob@gnu.org
http://www.rattlesnake.com http://www.teak.cc
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: recenter-top-bottom
2007-11-12 8:33 ` recenter-top-bottom Drew Adams
@ 2007-11-12 13:01 ` Bastien
2007-11-12 13:06 ` recenter-top-bottom Bastien
0 siblings, 1 reply; 58+ messages in thread
From: Bastien @ 2007-11-12 13:01 UTC (permalink / raw)
To: Drew Adams; +Cc: emacs-devel
"Drew Adams" <drew.adams@oracle.com> writes:
> So, for me, the window point being near the middle or at the middle is
> the same goal. Why is it important for you to move the window point
> precisely to the center (from nearby)?
Because it would surprise me otherwise, and I would be surprised that
other users wouldn't be surprised by this. As I said, I mentionned a
habit of mine, but I guess for command like C-l we all share the same
background of fundamental habits.
> (You can still do that, but `C-u C-l' is not as handy, if you want
> such precision often.)
Yes. Again, I am just trying to make my point very clear so that other
users thinking the same can say: I like recenter-top-bottom but I also
expect the point to jump to the center when it's nearby, so I prefer
recenter-top-bottom #2 over #1.
> It sounds like that is what you prefer. I have no idea what most
> people prefer - I was guessing that they would prefer what I proposed,
> but life can be full of surprises.
So we should spare us Emacs specific surprises :)
Lets give time to people to see what they think.
> Sure. Anyway, as I said, I don't have a preference for Emacs about
> this. I use this as a personal preference, and I don't care whether it
> becomes the default behavior or is even added to Emacs as an option. I
> am curious about the range of opinion though.
Note that it is much easier to have an "opinion" on C-l than to have one
on whether Rimbaud should have delayed his retirement. Much easier, but
much also.
--
Bastien
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: recenter-top-bottom
2007-11-12 12:06 ` recenter-top-bottom Robert J. Chassell
@ 2007-11-12 13:05 ` Lennart Borgman (gmail)
0 siblings, 0 replies; 58+ messages in thread
From: Lennart Borgman (gmail) @ 2007-11-12 13:05 UTC (permalink / raw)
To: emacs-devel
Robert J. Chassell wrote:
> (Interestingly, I often use `line-to-top-of-window', which is on a
> function key.)
I often do that too, but in the Viper vi emulation:
z RET viper-line-to-top
z . viper-line-to-middle
z - viper-line-to-bottom
z H viper-line-to-top
z M viper-line-to-middle
z L viper-line-to-bottom
H viper-window-top
M viper-window-middle
L viper-window-buttom
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: recenter-top-bottom
2007-11-12 13:01 ` recenter-top-bottom Bastien
@ 2007-11-12 13:06 ` Bastien
0 siblings, 0 replies; 58+ messages in thread
From: Bastien @ 2007-11-12 13:06 UTC (permalink / raw)
To: Drew Adams; +Cc: emacs-devel
Bastien <bzg@altern.org> writes:
> Yes. Again, I am just trying to make my point very clear so that other
> users thinking the same can say: I like recenter-top-bottom but I also
> expect the point to jump to the center when it's nearby, so I prefer
> recenter-top-bottom #2 over #1.
Sorry, should read: "#1 over #2" ...
--
Bastien
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: recenter-top-bottom
2007-11-12 8:50 ` recenter-top-bottom Drew Adams
@ 2007-11-12 13:15 ` Bastien
0 siblings, 0 replies; 58+ messages in thread
From: Bastien @ 2007-11-12 13:15 UTC (permalink / raw)
To: Drew Adams; +Cc: emacs-devel
"Drew Adams" <drew.adams@oracle.com> writes:
>> So I think your first suggestion is better, and I am still thinking
>> of maybe installing it. If people are very enthusiastic about
>> your second suggestion, I will say yes to it.
>
> Just to make it easier for people who might want to try both and compare,
> here again are the two definitions. Each is a possible alternative binding
> for `C-l'. (I've added the `scroll-conservatively' feature to #1, as well as
> #2.)
Thanks for summing up.
Another problem with #2 is this: if the window height is 60 and the
point is at 19, people might not be *sure* that the point is in the
first third of the window. Pressing C-l will then put the point at the
bottom, while there were expecting it to jump on the top. Note that in
this case, C-l will do the exact *opposite* of what they want, which is
not only surprising, but rather disappointing!
Relying on the fact that user is able to spot the position of the point
very precisely is not a good thing, especially for large windows, and
especially when the point is between two thirds, where it is the more
difficult to evaluate the position visually.
In fact, I often use C-l to spare me the cost of being sure where the
point is.
--
Bastien
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: recenter-top-bottom
2007-11-12 8:34 ` recenter-top-bottom Drew Adams
2007-11-12 8:50 ` recenter-top-bottom Drew Adams
@ 2007-11-12 21:57 ` Juri Linkov
2007-11-12 23:00 ` recenter-top-bottom Drew Adams
2007-11-13 5:10 ` recenter-top-bottom Richard Stallman
2 siblings, 1 reply; 58+ messages in thread
From: Juri Linkov @ 2007-11-12 21:57 UTC (permalink / raw)
To: Drew Adams; +Cc: alan.mackenzie_jwa, emacs-devel
>> If people are very enthusiastic about your second suggestion,
>> I will say yes to it.
>
> I'm neutral. My personal preference (for myself, not for Emacs) is the
> second suggestion, and I prefer either to plain `recenter'. But I think it's
> unlikely that you will get a consensus for change on `C-l': preferences are
> likely to vary, and habit with `recenter' will pull toward the status quo (I
> almost said pull toward the center).
The status quo that satisfies everyone is to use `C-0 C-l' (just two
keystrokes) to put point to the top, and `C-- C-l' (again two keystrokes)
to the bottom.
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 58+ messages in thread
* RE: recenter-top-bottom
2007-11-12 21:57 ` recenter-top-bottom Juri Linkov
@ 2007-11-12 23:00 ` Drew Adams
2007-11-13 13:35 ` recenter-top-bottom Bastien
0 siblings, 1 reply; 58+ messages in thread
From: Drew Adams @ 2007-11-12 23:00 UTC (permalink / raw)
To: Juri Linkov; +Cc: alan.mackenzie_jwa, emacs-devel
> The status quo that satisfies everyone is to use `C-0 C-l' (just two
> keystrokes) to put point to the top, and `C-- C-l' (again two keystrokes)
> to the bottom.
OK by me. It's been good enough for many years.
I'll still use my `C-l', because it's easier for me (same key, even if
repeated), but your point is valid.
As I said from the beginning, the proposed behavior is only a minor
convenience. And it is (now) obviously not seen as a convenience by
everyone.
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: recenter-top-bottom
2007-11-12 8:34 ` recenter-top-bottom Drew Adams
2007-11-12 8:50 ` recenter-top-bottom Drew Adams
2007-11-12 21:57 ` recenter-top-bottom Juri Linkov
@ 2007-11-13 5:10 ` Richard Stallman
2007-11-14 21:57 ` recenter-top-bottom Drew Adams
2 siblings, 1 reply; 58+ messages in thread
From: Richard Stallman @ 2007-11-13 5:10 UTC (permalink / raw)
To: Drew Adams; +Cc: alan.mackenzie_jwa, emacs-devel
The only things it doesn't let you do are:
1. Hit `C-l' only once to move from top to center. (Top moves to bottom.)
2. Hit `C-l' only once to move from near center to exact center.
I think that is unacceptable. If just about everyone else loves it
I will reconsider; otherwise I don't want it.
I am still interested in your original design, which I think is good.
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: recenter-top-bottom
2007-11-12 23:00 ` recenter-top-bottom Drew Adams
@ 2007-11-13 13:35 ` Bastien
0 siblings, 0 replies; 58+ messages in thread
From: Bastien @ 2007-11-13 13:35 UTC (permalink / raw)
To: emacs-devel
"Drew Adams" <drew.adams@oracle.com> writes:
>> The status quo that satisfies everyone is to use `C-0 C-l' (just two
>> keystrokes) to put point to the top, and `C-- C-l' (again two keystrokes)
>> to the bottom.
>
> I'll still use my `C-l', because it's easier for me (same key, even if
> repeated), but your point is valid.
>
> As I said from the beginning, the proposed behavior is only a minor
> convenience. And it is (now) obviously not seen as a convenience by
> everyone.
Let me state again that I *do* like recenter-top-bottom-1. I am just
sceptical about recenter-top-bottom-2.
--
Bastien
^ permalink raw reply [flat|nested] 58+ messages in thread
* RE: recenter-top-bottom
2007-11-13 5:10 ` recenter-top-bottom Richard Stallman
@ 2007-11-14 21:57 ` Drew Adams
2007-11-14 22:07 ` recenter-top-bottom Lennart Borgman (gmail)
` (4 more replies)
0 siblings, 5 replies; 58+ messages in thread
From: Drew Adams @ 2007-11-14 21:57 UTC (permalink / raw)
To: rms; +Cc: emacs-devel
> I am still interested in your original design, which I think is good.
I think the version below combines the best of each and should satisfy most
people. It is the same as the original design, except that the cycling order
is appropriate for where you start out.
1. An explicit arg (plain `C-u' or numeric) is always respected, whenever it
is used.
2. Otherwise, the first `C-l' always recenters.
3. Otherwise, successive `C-l' cycles among top, middle, and bottom (top and
bottom are modulo `scroll-conservatively'). The initial position (top,
middle, or bottom third of the window) determines the cycling order:
middle -> bottom -> top versus middle -> top -> bottom.
#1 and #2 mean that unless you repeat `C-l' you get the normal `recenter'
behavior.
#3 means that cycling never repeats the same destination twice in a row -
the order fits the initial cursor position.
(defun recenter-top-bottom (&optional arg)
"Move current line to window center, top, and bottom, successively.
With a prefix argument, this is the same as `recenter':
With numeric prefix ARG, move current line to window-line ARG.
With plain `C-u', move current line to window center.
Otherwise move current line to window center on first call, and to
top, middle, or bottom on successive calls.
The starting position of the window determines the cycling order:
If initially in the top or middle third: top -> middle -> bottom.
If initially in the bottom third: bottom -> middle -> top.
Top and bottom destinations are actually `scroll-conservatively' lines
from true window top and bottom."
(interactive "P")
(if arg ; Always respect ARG.
(recenter arg)
(case last-command
(recenter-tb-top ; Top -> middle -> bottom
(setq this-command 'recenter-tb-middle)
(recenter))
(recenter-tb-middle
(setq this-command 'recenter-tb-bottom)
(recenter (1- (- scroll-conservatively))))
(recenter-tb-bottom
(setq this-command 'recenter-tb-top)
(recenter scroll-conservatively))
(recenter-tb-bottom-1 ; Bottom -> middle -> top
(setq this-command 'recenter-tb-middle-1)
(recenter))
(recenter-tb-middle-1
(setq this-command 'recenter-tb-top-1)
(recenter scroll-conservatively))
(recenter-tb-top-1
(setq this-command 'recenter-tb-bottom-1)
(recenter (1- (- scroll-conservatively))))
(otherwise ; First time - save mode and recenter.
(let ((bottom (1+ (count-lines 1 (window-end))))
(current (1+ (count-lines 1 (point))))
(total (window-height)))
(if (< (- bottom current) (/ total 3))
(setq this-command 'recenter-tb-middle-1)
(setq this-command 'recenter-tb-middle)))
(recenter)))))
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: recenter-top-bottom
2007-11-14 21:57 ` recenter-top-bottom Drew Adams
@ 2007-11-14 22:07 ` Lennart Borgman (gmail)
2007-11-14 22:51 ` recenter-top-bottom Bastien
` (3 subsequent siblings)
4 siblings, 0 replies; 58+ messages in thread
From: Lennart Borgman (gmail) @ 2007-11-14 22:07 UTC (permalink / raw)
To: Drew Adams; +Cc: rms, emacs-devel
Drew Adams wrote:
>> I am still interested in your original design, which I think is good.
>
> I think the version below combines the best of each and should satisfy most
> people. It is the same as the original design, except that the cycling order
> is appropriate for where you start out.
>
> 1. An explicit arg (plain `C-u' or numeric) is always respected, whenever it
> is used.
>
> 2. Otherwise, the first `C-l' always recenters.
>
> 3. Otherwise, successive `C-l' cycles among top, middle, and bottom (top and
> bottom are modulo `scroll-conservatively'). The initial position (top,
> middle, or bottom third of the window) determines the cycling order:
> middle -> bottom -> top versus middle -> top -> bottom.
I like this new version. It is useful and inituitive and easy to
remember IMO.
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: recenter-top-bottom
2007-11-14 21:57 ` recenter-top-bottom Drew Adams
2007-11-14 22:07 ` recenter-top-bottom Lennart Borgman (gmail)
@ 2007-11-14 22:51 ` Bastien
2007-11-14 23:51 ` recenter-top-bottom Juri Linkov
` (2 subsequent siblings)
4 siblings, 0 replies; 58+ messages in thread
From: Bastien @ 2007-11-14 22:51 UTC (permalink / raw)
To: Drew Adams; +Cc: rms, emacs-devel
"Drew Adams" <drew.adams@oracle.com> writes:
>> I am still interested in your original design, which I think is good.
>
> I think the version below combines the best of each and should satisfy
> most people.
I like it, thanks for the changes.
--
Bastien
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: recenter-top-bottom
2007-11-14 21:57 ` recenter-top-bottom Drew Adams
2007-11-14 22:07 ` recenter-top-bottom Lennart Borgman (gmail)
2007-11-14 22:51 ` recenter-top-bottom Bastien
@ 2007-11-14 23:51 ` Juri Linkov
2007-11-15 0:23 ` recenter-top-bottom Lennart Borgman (gmail)
2007-11-15 0:58 ` recenter-top-bottom Drew Adams
2007-11-15 13:07 ` recenter-top-bottom Richard Stallman
2007-11-15 15:16 ` recenter-top-bottom Stefan Monnier
4 siblings, 2 replies; 58+ messages in thread
From: Juri Linkov @ 2007-11-14 23:51 UTC (permalink / raw)
To: Drew Adams; +Cc: emacs-devel
> The starting position of the window determines the cycling order:
> If initially in the top or middle third: top -> middle -> bottom.
> If initially in the bottom third: bottom -> middle -> top.
But why it does `middle -> bottom -> top' if initially in the middle third?
I think `middle -> top -> bottom' would be much more convenient!
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: recenter-top-bottom
2007-11-14 23:51 ` recenter-top-bottom Juri Linkov
@ 2007-11-15 0:23 ` Lennart Borgman (gmail)
2007-11-15 0:58 ` recenter-top-bottom Drew Adams
1 sibling, 0 replies; 58+ messages in thread
From: Lennart Borgman (gmail) @ 2007-11-15 0:23 UTC (permalink / raw)
To: Juri Linkov; +Cc: Drew Adams, emacs-devel
Juri Linkov wrote:
>> The starting position of the window determines the cycling order:
>> If initially in the top or middle third: top -> middle -> bottom.
>> If initially in the bottom third: bottom -> middle -> top.
>
> But why it does `middle -> bottom -> top' if initially in the middle third?
> I think `middle -> top -> bottom' would be much more convenient!
Agreed.
^ permalink raw reply [flat|nested] 58+ messages in thread
* RE: recenter-top-bottom
2007-11-14 23:51 ` recenter-top-bottom Juri Linkov
2007-11-15 0:23 ` recenter-top-bottom Lennart Borgman (gmail)
@ 2007-11-15 0:58 ` Drew Adams
2007-11-15 8:36 ` recenter-top-bottom Lennart Borgman (gmail)
1 sibling, 1 reply; 58+ messages in thread
From: Drew Adams @ 2007-11-15 0:58 UTC (permalink / raw)
To: Juri Linkov; +Cc: emacs-devel
> > The starting position of the window determines the cycling order:
> > If initially in the top or middle third: top -> middle -> bottom.
> > If initially in the bottom third: bottom -> middle -> top.
>
> But why it does `middle -> bottom -> top' if initially in the
> middle third? I think `middle -> top -> bottom' would be
> much more convenient!
It's a toss-up, IMO.
I have no preference, in any case.
If that's preferred by most, then just switch it:
(otherwise
(let ((top (1+ (count-lines 1 (window-start))))
(current (1+ (count-lines 1 (point))))
(total (window-height)))
(if (< (- current top) (/ total 3))
(setq this-command 'recenter-tb-middle)
(setq this-command 'recenter-tb-middle-1)))
(recenter))
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: recenter-top-bottom
2007-11-15 0:58 ` recenter-top-bottom Drew Adams
@ 2007-11-15 8:36 ` Lennart Borgman (gmail)
0 siblings, 0 replies; 58+ messages in thread
From: Lennart Borgman (gmail) @ 2007-11-15 8:36 UTC (permalink / raw)
To: Drew Adams; +Cc: Juri Linkov, emacs-devel
Drew Adams wrote:
>>> The starting position of the window determines the cycling order:
>>> If initially in the top or middle third: top -> middle -> bottom.
>>> If initially in the bottom third: bottom -> middle -> top.
>> But why it does `middle -> bottom -> top' if initially in the
>> middle third? I think `middle -> top -> bottom' would be
>> much more convenient!
>
> It's a toss-up, IMO.
> I have no preference, in any case.
I think that you most often want to see something further down since
writing pushes text downwards and also since reading is from the top to
the bottom.
> If that's preferred by most, then just switch it:
>
> (otherwise
> (let ((top (1+ (count-lines 1 (window-start))))
> (current (1+ (count-lines 1 (point))))
> (total (window-height)))
> (if (< (- current top) (/ total 3))
> (setq this-command 'recenter-tb-middle)
> (setq this-command 'recenter-tb-middle-1)))
> (recenter))
Thanks.
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: recenter-top-bottom
2007-11-14 21:57 ` recenter-top-bottom Drew Adams
` (2 preceding siblings ...)
2007-11-14 23:51 ` recenter-top-bottom Juri Linkov
@ 2007-11-15 13:07 ` Richard Stallman
2007-11-15 15:16 ` recenter-top-bottom Stefan Monnier
4 siblings, 0 replies; 58+ messages in thread
From: Richard Stallman @ 2007-11-15 13:07 UTC (permalink / raw)
To: Drew Adams; +Cc: emacs-devel
It looks good to me, but it needs a comment explaining the precise
meaning of each of the specific values used for this-command.
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: recenter-top-bottom
2007-11-14 21:57 ` recenter-top-bottom Drew Adams
` (3 preceding siblings ...)
2007-11-15 13:07 ` recenter-top-bottom Richard Stallman
@ 2007-11-15 15:16 ` Stefan Monnier
2007-11-15 15:52 ` recenter-top-bottom Drew Adams
` (2 more replies)
4 siblings, 3 replies; 58+ messages in thread
From: Stefan Monnier @ 2007-11-15 15:16 UTC (permalink / raw)
To: Drew Adams; +Cc: rms, emacs-devel
> (defun recenter-top-bottom (&optional arg)
> "Move current line to window center, top, and bottom, successively.
> With a prefix argument, this is the same as `recenter':
> With numeric prefix ARG, move current line to window-line ARG.
> With plain `C-u', move current line to window center.
> Otherwise move current line to window center on first call, and to
> top, middle, or bottom on successive calls.
> The starting position of the window determines the cycling order:
> If initially in the top or middle third: top -> middle -> bottom.
> If initially in the bottom third: bottom -> middle -> top.
> Top and bottom destinations are actually `scroll-conservatively' lines
> from true window top and bottom."
> (interactive "P")
> (if arg ; Always respect ARG.
> (recenter arg)
> (case last-command
> (recenter-tb-top ; Top -> middle -> bottom
> (setq this-command 'recenter-tb-middle)
> (recenter))
> (recenter-tb-middle
> (setq this-command 'recenter-tb-bottom)
> (recenter (1- (- scroll-conservatively))))
> (recenter-tb-bottom
> (setq this-command 'recenter-tb-top)
> (recenter scroll-conservatively))
> (recenter-tb-bottom-1 ; Bottom -> middle -> top
> (setq this-command 'recenter-tb-middle-1)
> (recenter))
> (recenter-tb-middle-1
> (setq this-command 'recenter-tb-top-1)
> (recenter scroll-conservatively))
> (recenter-tb-top-1
> (setq this-command 'recenter-tb-bottom-1)
> (recenter (1- (- scroll-conservatively))))
> (otherwise ; First time - save mode and recenter.
> (let ((bottom (1+ (count-lines 1 (window-end))))
> (current (1+ (count-lines 1 (point))))
> (total (window-height)))
> (if (< (- bottom current) (/ total 3))
> (setq this-command 'recenter-tb-middle-1)
> (setq this-command 'recenter-tb-middle)))
> (recenter)))))
Looks OK, except I'd rather not fool around with last-command and
this-command:
(defvar recenter-last-op nil)
(defun recenter-top-bottom (&optional arg)
"Move current line to window center, top, and bottom, successively.
With a prefix argument, this is the same as `recenter':
With numeric prefix ARG, move current line to window-line ARG.
With plain `C-u', move current line to window center.
Otherwise move current line to window center on first call, and to
top, middle, or bottom on successive calls.
The starting position of the window determines the cycling order:
If initially in the top or middle third: top -> middle -> bottom.
If initially in the bottom third: bottom -> middle -> top.
Top and bottom destinations are actually `scroll-conservatively' lines
from true window top and bottom."
(interactive "P")
(cond
(arg (recenter arg)) ; Always respect ARG.
((not (eq this-command last-command))
;; First time - save mode and recenter.
(let ((bottom (1+ (count-lines 1 (window-end))))
(current (1+ (count-lines 1 (point))))
(total (window-height)))
(setq recenter-last-op (if (< (- bottom current) (/ total 3))
'recenter-tb-middle-1)
'recenter-tb-middle)
(recenter)))
(t ;; repeat: loop through various options.
(ecase recenter-last-op
(recenter-tb-top ; Top -> middle -> bottom
(setq recenter-last-op 'recenter-tb-middle)
(recenter))
(recenter-tb-middle
(setq recenter-last-op 'recenter-tb-bottom)
(recenter (1- (- scroll-conservatively))))
(recenter-tb-bottom
(setq recenter-last-op 'recenter-tb-top)
(recenter scroll-conservatively))
(recenter-tb-bottom-1 ; Bottom -> middle -> top
(setq recenter-last-op 'recenter-tb-middle-1)
(recenter))
(recenter-tb-middle-1
(setq recenter-last-op 'recenter-tb-top-1)
(recenter scroll-conservatively))
(recenter-tb-top-1
(setq recenter-last-op 'recenter-tb-bottom-1)
(recenter (1- (- scroll-conservatively))))))))
-- Stefan
^ permalink raw reply [flat|nested] 58+ messages in thread
* RE: recenter-top-bottom
2007-11-15 15:16 ` recenter-top-bottom Stefan Monnier
@ 2007-11-15 15:52 ` Drew Adams
2007-11-16 4:29 ` recenter-top-bottom Richard Stallman
2007-12-01 13:55 ` recenter-top-bottom Johan Bockgård
2 siblings, 0 replies; 58+ messages in thread
From: Drew Adams @ 2007-11-15 15:52 UTC (permalink / raw)
To: Stefan Monnier; +Cc: rms, emacs-devel
> Looks OK, except I'd rather not fool around with last-command and
> this-command:
>
> (defvar recenter-last-op nil)
>
> ;; First time - save mode and recenter.
> (let ((bottom (1+ (count-lines 1 (window-end))))
> (current (1+ (count-lines 1 (point))))
> (total (window-height)))
> (setq recenter-last-op (if (< (- bottom current) (/ total 3))
> 'recenter-tb-middle-1)
> 'recenter-tb-middle)
I was specifically trying to avoid a new global variable, thinking setting
`this-command' was cleaner. Doesn't matter to me, though - go for it, and
please add whatever comments RMS wants.
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: recenter-top-bottom
2007-11-15 15:16 ` recenter-top-bottom Stefan Monnier
2007-11-15 15:52 ` recenter-top-bottom Drew Adams
@ 2007-11-16 4:29 ` Richard Stallman
2007-11-16 18:51 ` recenter-top-bottom Stefan Monnier
2007-12-01 13:55 ` recenter-top-bottom Johan Bockgård
2 siblings, 1 reply; 58+ messages in thread
From: Richard Stallman @ 2007-11-16 4:29 UTC (permalink / raw)
To: Stefan Monnier; +Cc: drew.adams, emacs-devel
Looks OK, except I'd rather not fool around with last-command and
this-command:
That is clean too. But this version too needs a comment to expain the values
of recenter-last-op.
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: recenter-top-bottom
2007-11-16 4:29 ` recenter-top-bottom Richard Stallman
@ 2007-11-16 18:51 ` Stefan Monnier
0 siblings, 0 replies; 58+ messages in thread
From: Stefan Monnier @ 2007-11-16 18:51 UTC (permalink / raw)
To: rms; +Cc: drew.adams, emacs-devel
> Looks OK, except I'd rather not fool around with last-command and
> this-command:
> That is clean too. But this version too needs a comment to expain the values
> of recenter-last-op.
I've installed a slightly simpler version.
Stefan
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: recenter-top-bottom
2007-11-15 15:16 ` recenter-top-bottom Stefan Monnier
2007-11-15 15:52 ` recenter-top-bottom Drew Adams
2007-11-16 4:29 ` recenter-top-bottom Richard Stallman
@ 2007-12-01 13:55 ` Johan Bockgård
2007-12-01 14:28 ` recenter-top-bottom Leo
2007-12-01 16:22 ` recenter-top-bottom Drew Adams
2 siblings, 2 replies; 58+ messages in thread
From: Johan Bockgård @ 2007-12-01 13:55 UTC (permalink / raw)
To: emacs-devel
Stefan Monnier <monnier@iro.umontreal.ca> writes:
> Top and bottom destinations are actually `scroll-conservatively' lines
> from true window top and bottom."
I don't think this is right. `scroll-conservatively' is commonly set to
"a large value".
--
Johan Bockgård
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: recenter-top-bottom
2007-12-01 13:55 ` recenter-top-bottom Johan Bockgård
@ 2007-12-01 14:28 ` Leo
2007-12-01 15:48 ` recenter-top-bottom Eli Zaretskii
2007-12-01 23:41 ` recenter-top-bottom Richard Stallman
2007-12-01 16:22 ` recenter-top-bottom Drew Adams
1 sibling, 2 replies; 58+ messages in thread
From: Leo @ 2007-12-01 14:28 UTC (permalink / raw)
To: emacs-devel
On 2007-12-01 13:55 +0000, Johan Bockgård wrote:
> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>
>> Top and bottom destinations are actually `scroll-conservatively' lines
>> from true window top and bottom."
>
> I don't think this is right. `scroll-conservatively' is commonly set to
> "a large value".
I can not understand the doc string of `scroll-conservatively' at all.
--
.: Leo :. [ sdl.web AT gmail.com ] .: [ GPG Key: 9283AA3F ] :.
Use the best OS -- http://www.fedoraproject.org/
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: recenter-top-bottom
2007-12-01 14:28 ` recenter-top-bottom Leo
@ 2007-12-01 15:48 ` Eli Zaretskii
2007-12-01 18:33 ` recenter-top-bottom Leo
2007-12-01 23:41 ` recenter-top-bottom Richard Stallman
1 sibling, 1 reply; 58+ messages in thread
From: Eli Zaretskii @ 2007-12-01 15:48 UTC (permalink / raw)
To: Leo; +Cc: emacs-devel
> From: Leo <sdl.web@gmail.com>
> Date: Sat, 01 Dec 2007 14:28:13 +0000
>
> I can not understand the doc string of `scroll-conservatively' at all.
Please explain what is confusing there. To me, the doc string sounds
crystal clear.
Maybe if you replace "up to" with "upto", the intent will become more
clear?
^ permalink raw reply [flat|nested] 58+ messages in thread
* RE: recenter-top-bottom
2007-12-01 13:55 ` recenter-top-bottom Johan Bockgård
2007-12-01 14:28 ` recenter-top-bottom Leo
@ 2007-12-01 16:22 ` Drew Adams
2007-12-01 23:41 ` recenter-top-bottom Richard Stallman
2007-12-02 0:47 ` recenter-top-bottom Johan Bockgård
1 sibling, 2 replies; 58+ messages in thread
From: Drew Adams @ 2007-12-01 16:22 UTC (permalink / raw)
To: emacs-devel
> > Top and bottom destinations are actually `scroll-conservatively' lines
> > from true window top and bottom."
>
> I don't think this is right. `scroll-conservatively' is commonly set to
> "a large value".
Well, the code could certainly be changed to use a different user option from `scroll-conservatively' - perhaps a new option. I said in a previous post:
> I don't think it is worthwhile to have a new, separate
> option for this, since the purpose of `scroll-conservatively'
> is about the same - it seems like a good fit.
FWIW, I still think that's the case. Why do you think that `scroll-conservatively' is commonly set to a large value? The default value is 0, and the Emacs manual says this:
"if you set `scroll-conservatively' to a small number N,
then if you move point just a little off the screen--less
than N lines--then Emacs scrolls the text just far enough
to bring point back on screen."
That suggests that using a small number is not uncommon; it might even be said to suggest that a small number be used.
Why would someone typically use a large number? More importantly, why would a number that is appropriate for normal use of `scroll-conservatively' not also be appropriate for `recenter-top-bottom'?
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: recenter-top-bottom
2007-12-01 15:48 ` recenter-top-bottom Eli Zaretskii
@ 2007-12-01 18:33 ` Leo
2007-12-01 21:07 ` recenter-top-bottom Eli Zaretskii
0 siblings, 1 reply; 58+ messages in thread
From: Leo @ 2007-12-01 18:33 UTC (permalink / raw)
To: emacs-devel
On 2007-12-01 15:48 +0000, Eli Zaretskii wrote:
>> From: Leo <sdl.web@gmail.com>
>> Date: Sat, 01 Dec 2007 14:28:13 +0000
>>
>> I can not understand the doc string of `scroll-conservatively' at all.
>
> Please explain what is confusing there. To me, the doc string sounds
> crystal clear.
>
> Maybe if you replace "up to" with "upto", the intent will become more
> clear?
"*Scroll up to this many lines..."
This sounds like a description of a function. The doc string is not
clear at all for a variable.
For example, what's the difference setting it to 1, 100, 10000?
--
.: Leo :. [ sdl.web AT gmail.com ] .: [ GPG Key: 9283AA3F ] :.
Use the best OS -- http://www.fedoraproject.org/
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: recenter-top-bottom
2007-12-01 18:33 ` recenter-top-bottom Leo
@ 2007-12-01 21:07 ` Eli Zaretskii
0 siblings, 0 replies; 58+ messages in thread
From: Eli Zaretskii @ 2007-12-01 21:07 UTC (permalink / raw)
To: Leo; +Cc: emacs-devel
> From: Leo <sdl.web@gmail.com>
> Date: Sat, 01 Dec 2007 18:33:05 +0000
>
> "*Scroll up to this many lines..."
>
> This sounds like a description of a function. The doc string is not
> clear at all for a variable.
You mean, you'd like the doc string to mention the names of functions
affected by this variable?
> For example, what's the difference setting it to 1, 100, 10000?
If you set it to 10000, then moving point 10000 lines below the lowest
screen edge will scroll so as to bring the point's line to the last
line of the window. If you move more than 10000 lines, the point's
line will be centered (by default, unless you also change
scroll-*-aggressively).
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: recenter-top-bottom
2007-12-01 16:22 ` recenter-top-bottom Drew Adams
@ 2007-12-01 23:41 ` Richard Stallman
2007-12-02 0:47 ` recenter-top-bottom Johan Bockgård
1 sibling, 0 replies; 58+ messages in thread
From: Richard Stallman @ 2007-12-01 23:41 UTC (permalink / raw)
To: Drew Adams; +Cc: emacs-devel
I set `scroll-conservatively' to a large value just so it will always
be bigger than the screen height. This means, more or less, that if
Emacs can bring point onto the screen by scrolling, with even one line
of overlap with the old screen, it should do so.
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: recenter-top-bottom
2007-12-01 14:28 ` recenter-top-bottom Leo
2007-12-01 15:48 ` recenter-top-bottom Eli Zaretskii
@ 2007-12-01 23:41 ` Richard Stallman
1 sibling, 0 replies; 58+ messages in thread
From: Richard Stallman @ 2007-12-01 23:41 UTC (permalink / raw)
To: Leo; +Cc: emacs-devel
I can not understand the doc string of `scroll-conservatively' at all.
I clarified it in EMACS_22_BASE. Thanks.
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: recenter-top-bottom
2007-12-01 16:22 ` recenter-top-bottom Drew Adams
2007-12-01 23:41 ` recenter-top-bottom Richard Stallman
@ 2007-12-02 0:47 ` Johan Bockgård
2007-12-02 4:53 ` recenter-top-bottom Drew Adams
1 sibling, 1 reply; 58+ messages in thread
From: Johan Bockgård @ 2007-12-02 0:47 UTC (permalink / raw)
To: emacs-devel
"Drew Adams" <drew.adams@oracle.com> writes:
> Why do you think that `scroll-conservatively' is commonly set to a
> large value? The default value is 0,
I mean what values people usually set it to when they change it. How
common it is to change it in the first place, I don't know.
> and the Emacs manual says this:
And the doc string of scroll-step says this:
"If you want scrolling to always be a line at a time, you should set
`scroll-conservatively' to a large value rather than set this to 1."
When scroll-conservatively is changed, it's usually for this reason, I
think. (See Richard's explanation.)
--
Johan Bockgård
^ permalink raw reply [flat|nested] 58+ messages in thread
* RE: recenter-top-bottom
2007-12-02 0:47 ` recenter-top-bottom Johan Bockgård
@ 2007-12-02 4:53 ` Drew Adams
0 siblings, 0 replies; 58+ messages in thread
From: Drew Adams @ 2007-12-02 4:53 UTC (permalink / raw)
To: emacs-devel
> the doc string of scroll-step says this:
>
> "If you want scrolling to always be a line at a time, you should set
> `scroll-conservatively' to a large value rather than set this to 1."
Where "this" refers to `scroll-step', not `scroll-conservatively', presumably. That could be made clearer, BTW. And "a large value" could be made clearer also: example? What's large?
> When scroll-conservatively is changed, it's usually for this reason, I
> think. (See Richard's explanation.)
1. Then change the `recenter-top-bottom' code to use a new user option, or some other existing option that is more appropriate than `scroll-conservatively'.
2. FWIW, the manual, the `scroll-step' doc string, and Richard seem to be saying different things. The manual (Emacs, node Auto Scrolling) says that you can use "a small number" for `scroll-conservatively' to scroll "the text just far enough to bring point back on screen". The doc string of `scroll-step' says that you can use "a large value" for `scroll-conservatively' to scroll "a line at a time". Those can both be true, but they would seem to be different uses of the option.
Richard says that he sets `scroll-conservatively' to a large value to "bring point onto the screen by scrolling, with even one line of overlap". That doesn't seem to be the same thing as scrolling "a line at a time".
I'm not saying that anyone is wrong or that the doc should be changed (I don't know). And I'm no longer claiming that `scroll-conservatively' is appropriate for `recenter-top-bottom' (use some other option, if you like). I'm saying only that the uses or interpretations of `scroll-conservatively' seem various.
^ permalink raw reply [flat|nested] 58+ messages in thread
end of thread, other threads:[~2007-12-02 4:53 UTC | newest]
Thread overview: 58+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <OF7E920891.667E3D64-ONC125738C.0058D24D-C125738C.00587C7B@philips.com>
2007-11-07 17:24 ` recenter-top-bottom Lennart Borgman (gmail)
2007-11-07 20:44 ` recenter-top-bottom Lennart Borgman (gmail)
2007-11-07 21:54 ` recenter-top-bottom Lennart Borgman (gmail)
2007-11-08 17:39 ` recenter-top-bottom Richard Stallman
2007-11-07 13:16 recenter-top-bottom Alan Mackenzie_JWA
2007-11-07 14:09 ` recenter-top-bottom Lennart Borgman (gmail)
2007-11-08 4:42 ` recenter-top-bottom Richard Stallman
2007-11-11 20:16 ` recenter-top-bottom Drew Adams
2007-11-11 21:47 ` recenter-top-bottom Juri Linkov
2007-11-11 22:38 ` recenter-top-bottom Drew Adams
2007-11-11 22:59 ` recenter-top-bottom Juri Linkov
2007-11-11 23:06 ` recenter-top-bottom Drew Adams
2007-11-12 0:12 ` recenter-top-bottom Bastien
2007-11-11 23:56 ` recenter-top-bottom Drew Adams
2007-11-12 4:56 ` recenter-top-bottom Bastien
2007-11-12 8:33 ` recenter-top-bottom Drew Adams
2007-11-12 13:01 ` recenter-top-bottom Bastien
2007-11-12 13:06 ` recenter-top-bottom Bastien
2007-11-12 12:06 ` recenter-top-bottom Robert J. Chassell
2007-11-12 13:05 ` recenter-top-bottom Lennart Borgman (gmail)
2007-11-12 5:59 ` recenter-top-bottom Richard Stallman
2007-11-12 7:17 ` recenter-top-bottom Bastien
2007-11-12 8:34 ` recenter-top-bottom Drew Adams
2007-11-12 8:50 ` recenter-top-bottom Drew Adams
2007-11-12 13:15 ` recenter-top-bottom Bastien
2007-11-12 21:57 ` recenter-top-bottom Juri Linkov
2007-11-12 23:00 ` recenter-top-bottom Drew Adams
2007-11-13 13:35 ` recenter-top-bottom Bastien
2007-11-13 5:10 ` recenter-top-bottom Richard Stallman
2007-11-14 21:57 ` recenter-top-bottom Drew Adams
2007-11-14 22:07 ` recenter-top-bottom Lennart Borgman (gmail)
2007-11-14 22:51 ` recenter-top-bottom Bastien
2007-11-14 23:51 ` recenter-top-bottom Juri Linkov
2007-11-15 0:23 ` recenter-top-bottom Lennart Borgman (gmail)
2007-11-15 0:58 ` recenter-top-bottom Drew Adams
2007-11-15 8:36 ` recenter-top-bottom Lennart Borgman (gmail)
2007-11-15 13:07 ` recenter-top-bottom Richard Stallman
2007-11-15 15:16 ` recenter-top-bottom Stefan Monnier
2007-11-15 15:52 ` recenter-top-bottom Drew Adams
2007-11-16 4:29 ` recenter-top-bottom Richard Stallman
2007-11-16 18:51 ` recenter-top-bottom Stefan Monnier
2007-12-01 13:55 ` recenter-top-bottom Johan Bockgård
2007-12-01 14:28 ` recenter-top-bottom Leo
2007-12-01 15:48 ` recenter-top-bottom Eli Zaretskii
2007-12-01 18:33 ` recenter-top-bottom Leo
2007-12-01 21:07 ` recenter-top-bottom Eli Zaretskii
2007-12-01 23:41 ` recenter-top-bottom Richard Stallman
2007-12-01 16:22 ` recenter-top-bottom Drew Adams
2007-12-01 23:41 ` recenter-top-bottom Richard Stallman
2007-12-02 0:47 ` recenter-top-bottom Johan Bockgård
2007-12-02 4:53 ` recenter-top-bottom Drew Adams
-- strict thread matches above, loose matches on Subject: below --
2007-11-06 16:53 recenter-top-bottom Drew Adams
2007-11-06 17:02 ` recenter-top-bottom Lennart Borgman (gmail)
2007-11-07 7:55 ` recenter-top-bottom Richard Stallman
2007-11-07 9:25 ` recenter-top-bottom Tassilo Horn
2007-11-08 0:41 ` recenter-top-bottom Juri Linkov
2007-11-11 8:27 ` recenter-top-bottom Alan Mackenzie
2007-11-11 23:54 ` recenter-top-bottom Richard Stallman
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.