From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: recenter-top-bottom Date: Sun, 11 Nov 2007 08:27:39 +0000 Message-ID: <20071111082739.GA1038@muc.de> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1194772906 19343 80.91.229.12 (11 Nov 2007 09:21:46 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 11 Nov 2007 09:21:46 +0000 (UTC) Cc: Emacs-Devel To: Drew Adams Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Nov 11 10:21:50 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 1Ir90i-0005Nt-Hp for ged-emacs-devel@m.gmane.org; Sun, 11 Nov 2007 10:21:44 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ir90W-0008Gs-6v for ged-emacs-devel@m.gmane.org; Sun, 11 Nov 2007 04:21:32 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ir90N-00088Z-1c for emacs-devel@gnu.org; Sun, 11 Nov 2007 04:21:23 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ir90J-00082e-N7 for emacs-devel@gnu.org; Sun, 11 Nov 2007 04:21:20 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ir90J-00081q-CR for emacs-devel@gnu.org; Sun, 11 Nov 2007 04:21:19 -0500 Original-Received: from colin.muc.de ([193.149.48.1] helo=mail.muc.de) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Ir90I-0000dZ-S5 for emacs-devel@gnu.org; Sun, 11 Nov 2007 04:21:19 -0500 Original-Received: (qmail 75203 invoked by uid 3782); 11 Nov 2007 08:21:16 -0000 Original-Received: from acm.muc.de (p57B1D1A6.dip.t-dialin.net [87.177.209.166]) by colin2.muc.de (tmda-ofmipd) with ESMTP; Sun, 11 Nov 2007 09:21:14 +0100 Original-Received: (qmail 1273 invoked by uid 1000); 11 Nov 2007 08:27:39 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.9i X-Delivery-Agent: TMDA/1.1.5 (Fettercairn) X-Primary-Address: acm@muc.de X-detected-kernel: by monty-python.gnu.org: FreeBSD 4.6-4.9 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:82935 Archived-At: 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).