unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com>
To: Alan Mackenzie_JWA <alan.mackenzie_jwa@nxp.com>
Cc: Drew Adams <drew.adams@oracle.com>, emacs-devel@gnu.org
Subject: Re: recenter-top-bottom
Date: Wed, 07 Nov 2007 22:54:06 +0100	[thread overview]
Message-ID: <473233FE.6000206@gmail.com> (raw)
In-Reply-To: <473223B5.7070900@gmail.com>

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

  reply	other threads:[~2007-11-07 21:54 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [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     ` Lennart Borgman (gmail) [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=473233FE.6000206@gmail.com \
    --to=lennart.borgman@gmail.com \
    --cc=alan.mackenzie_jwa@nxp.com \
    --cc=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).