From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kai Grossjohann Newsgroups: gmane.emacs.devel Subject: Re: a simple convenience function Date: Mon, 15 Nov 2004 10:29:32 +0100 Message-ID: <86pt2fo3yb.fsf@ketchup.de.uu.net> References: <200411142336.00131.pogonyshev@gmx.net> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1100511106 25222 80.91.229.6 (15 Nov 2004 09:31:46 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 15 Nov 2004 09:31:46 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Nov 15 10:31:38 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CTdCz-0002ld-00 for ; Mon, 15 Nov 2004 10:31:38 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CTdLg-0003Fh-F6 for ged-emacs-devel@m.gmane.org; Mon, 15 Nov 2004 04:40:36 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CTdK9-0002pu-Mm for emacs-devel@gnu.org; Mon, 15 Nov 2004 04:39:01 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CTdK8-0002oo-8h for emacs-devel@gnu.org; Mon, 15 Nov 2004 04:39:00 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CTdK7-0002oP-LM for emacs-devel@gnu.org; Mon, 15 Nov 2004 04:38:59 -0500 Original-Received: from [80.91.229.2] (helo=main.gmane.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1CTdB7-0003ia-Hv for emacs-devel@gnu.org; Mon, 15 Nov 2004 04:29:41 -0500 Original-Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 1CTdB6-0002zs-00 for ; Mon, 15 Nov 2004 10:29:40 +0100 Original-Received: from ketchup.de.uu.net ([139.4.38.244]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 15 Nov 2004 10:29:40 +0100 Original-Received: from kai by ketchup.de.uu.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 15 Nov 2004 10:29:40 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-To: emacs-devel@gnu.org Original-Lines: 32 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: ketchup.de.uu.net User-Agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3.50 (gnu/linux) Cancel-Lock: sha1:0xVSBCSJ72zIiVEHXDyzHGV7lpk= 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: main.gmane.org gmane.emacs.devel:29864 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:29864 Paul Pogonyshev writes: > +(defun beginning-of-line-smart (&optional n) > + "Move to the beginning of the text on this line, or to the beginning of the line. > +More exactly, if the point is already at the beginning of the > +line's text (as defined by `beginning-of-line-text'), it is > +placed at the very beginning of the line. Otherwise it is moved > +to the text beginning. > + > +With optional argument, different from 1, behave identically to > +`beginning-of-line-text'." I used to have something similar, except that I changed the key to move to beginning of line, then beginning of window, then beginning of buffer. But the behavior of that function was different: where it moved depended on how often you hit the key. When you first hit it, it moved to beginning of line, if you then immediately press it again, it moves to beginning of window, and so on. I found this to be better because I knew I could always hit twice to end up at the beginning of the window, and I didn't have to check whether point was already at the beginning of the line. But for the proposed binding, it's more difficult: one would expect C-a to move to the left, so its behavior needs to depend on the position of point, I think. What do others think about the tradeoff between the "never move right" and the "make behavior predictable without looking at text" constraints? Kai