unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* 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-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
[parent not found: <OF7E920891.667E3D64-ONC125738C.0058D24D-C125738C.00587C7B@philips.com>]

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 --
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
  -- strict thread matches above, loose matches on Subject: below --
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
     [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

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).