|
From: | Lennart Borgman (gmail) |
Subject: | Re: recenter-top-bottom |
Date: | Wed, 07 Nov 2007 21:44:37 +0100 |
User-agent: | Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070728 Thunderbird/2.0.0.6 Mnenhy/0.7.5.666 |
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)))
[Prev in Thread] | Current Thread | [Next in Thread] |