From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Lennart Borgman (gmail)" Newsgroups: gmane.emacs.devel Subject: Re: recenter-top-bottom Date: Wed, 07 Nov 2007 21:44:37 +0100 Message-ID: <473223B5.7070900@gmail.com> References: <4731F4BE.4000408@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1194468345 24217 80.91.229.12 (7 Nov 2007 20:45:45 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 7 Nov 2007 20:45:45 +0000 (UTC) Cc: Drew Adams , emacs-devel@gnu.org To: Alan Mackenzie_JWA Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Nov 07 21:45:48 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IprmT-0006Ir-4z for ged-emacs-devel@m.gmane.org; Wed, 07 Nov 2007 21:45:45 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IprmH-0007qS-TY for ged-emacs-devel@m.gmane.org; Wed, 07 Nov 2007 15:45:33 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IprmD-0007l6-8k for emacs-devel@gnu.org; Wed, 07 Nov 2007 15:45:29 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IprmB-0007hP-8q for emacs-devel@gnu.org; Wed, 07 Nov 2007 15:45:28 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IprmB-0007h4-4q for emacs-devel@gnu.org; Wed, 07 Nov 2007 15:45:27 -0500 Original-Received: from ch-smtp01.sth.basefarm.net ([80.76.149.212]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1IprmB-0001ad-39 for emacs-devel@gnu.org; Wed, 07 Nov 2007 15:45:27 -0500 Original-Received: from c83-254-148-228.bredband.comhem.se ([83.254.148.228]:64959 helo=[127.0.0.1]) by ch-smtp01.sth.basefarm.net with esmtp (Exim 4.68) (envelope-from ) id 1Iprls-0007Ip-5R; Wed, 07 Nov 2007 21:45:09 +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 In-Reply-To: <4731F4BE.4000408@gmail.com> X-Antivirus: avast! (VPS 071106-0, 2007-11-06), Outbound message X-Antivirus-Status: Clean X-Originating-IP: 83.254.148.228 X-Scan-Result: No virus found in message 1Iprls-0007Ip-5R. X-Scan-Signature: ch-smtp01.sth.basefarm.net 1Iprls-0007Ip-5R 7f5404ce59f83f3f76aac55084c2aa6e X-detected-kernel: by monty-python.gnu.org: Linux 2.6? (barebone, rare!) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:82767 Archived-At: 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-. 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)))