From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: RE: Unuseful keybindings Date: Mon, 24 Dec 2012 13:43:50 -0800 Message-ID: References: <87sj73qzvl.fsf@gmail.com><87623zquvw.fsf@gmail.com><87ip7zdud3.fsf@gmail.com><87ehiiu5x7.fsf@gnu.org><876A7D1112084247AE53F7EE42B4587C@us.oracle.com><80ehih3hlj.fsf@somewhere.org><87pq21iwrw.fsf@yandex.ru><87AE81CEB91846DB94BC5F3B40C788DE@us.oracle.com><50D64318.5030501@yandex.ru><0FBA2D9ECA214D82B5C65E5A09E7EE19@us.oracle.com><50D71824.90601@yandex.ru><1C9978ED468E4CC8948C1B93D6806A18@us.oracle.com><50D7405E.5070604@yandex.ru><871ueg4hit.fsf@gnus.org> <8A240487C7BB4AABB55974CD69407C40@us.oracle.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0089_01CDE1DC.B56BAD80" X-Trace: ger.gmane.org 1356385451 25697 80.91.229.3 (24 Dec 2012 21:44:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 24 Dec 2012 21:44:11 +0000 (UTC) To: "'Lars Ingebrigtsen'" , Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Dec 24 22:44:27 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TnFow-0001rO-Qp for ged-emacs-devel@m.gmane.org; Mon, 24 Dec 2012 22:44:27 +0100 Original-Received: from localhost ([::1]:54273 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TnFoi-00011L-Kg for ged-emacs-devel@m.gmane.org; Mon, 24 Dec 2012 16:44:12 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:57118) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TnFog-00011G-3Z for emacs-devel@gnu.org; Mon, 24 Dec 2012 16:44:11 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TnFoe-0002wz-Q0 for emacs-devel@gnu.org; Mon, 24 Dec 2012 16:44:10 -0500 Original-Received: from aserp1040.oracle.com ([141.146.126.69]:41770) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TnFoe-0002wu-IJ for emacs-devel@gnu.org; Mon, 24 Dec 2012 16:44:08 -0500 Original-Received: from ucsinet21.oracle.com (ucsinet21.oracle.com [156.151.31.93]) by aserp1040.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id qBOLi66h017623 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 24 Dec 2012 21:44:07 GMT Original-Received: from acsmt358.oracle.com (acsmt358.oracle.com [141.146.40.158]) by ucsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id qBOLi50t009716 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 24 Dec 2012 21:44:05 GMT Original-Received: from abhmt106.oracle.com (abhmt106.oracle.com [141.146.116.58]) by acsmt358.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id qBOLi4S5021035; Mon, 24 Dec 2012 15:44:04 -0600 Original-Received: from dradamslap1 (/71.202.147.44) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 24 Dec 2012 13:44:04 -0800 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <8A240487C7BB4AABB55974CD69407C40@us.oracle.com> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Thread-Index: Ac3hT53RDqQj1G4OQQqxQFAqgabEPAAAaEVwADMn9nA= X-Source-IP: ucsinet21.oracle.com [156.151.31.93] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 141.146.126.69 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:155868 Archived-At: This is a multi-part message in MIME format. ------=_NextPart_000_0089_01CDE1DC.B56BAD80 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit > > Speaking of odd key bindings, I just noticed that `home' goes to > > the beginning of the line instead of the beginning of the buffer. > > Now if `home' were bound to something like the following, > which is repeatable, then it would be a lot more useful. > First time: bol, subsequently: next/previous line's bol. > > (defun beginning-of-line+ ... > http://www.emacswiki.org/emacs-en/download/misc-cmds.el The attached code puts useful, repeatable keys on `C-a', `C-e', `home' and `end' in `visual-line-mode'. The `home' and `end' actions are presumably similar to what is done in the greater world, except that you can repeat them to keep moving. Repeating `C-a' or `C-e' moves to the beginning/end of the previous/next visual line. Repeating `home' or `end' moves to the beginning/end of the previous/next full logical line. For non-repeated use, everything should be the same as usual, including the use of a prefix arg. IMHO, these commands are what Emacs should bind to `C-a', `C-e', `home', and `end' in `visual-line-mode'. I've added this code to `misc-cmds.el', in any case. ------=_NextPart_000_0089_01CDE1DC.B56BAD80 Content-Type: application/octet-stream; name="throw-beg-end.el" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="throw-beg-end.el" (defun end-of-line+ (&optional n)=0A= "Move cursor to end of current line or end of next line if repeated.=0A= This is similar to `end-of-line', but:=0A= If called interactively with no prefix arg:=0A= If the previous command was also `end-of-line+', then move to the=0A= end of the next line. Else, move to the end of the current line.=0A= Otherwise, move to the end of the Nth next line (Nth previous line=0A= if N<0). Command `end-of-line', by contrast, moves to the end of=0A= the (N-1)th next line."=0A= (interactive=0A= (list (if current-prefix-arg (prefix-numeric-value = current-prefix-arg) 0)))=0A= (unless n (setq n 0)) ; non-interactive with no arg=0A= (if (and (eq this-command last-command) (not current-prefix-arg))=0A= (forward-line 1)=0A= (forward-line n))=0A= (let ((inhibit-field-text-motion t)) (end-of-line)))=0A= =0A= (defun beginning-of-line+ (&optional n)=0A= "Move cursor to beginning of current line or next line if repeated.=0A= This is the similar to `beginning-of-line', but:=0A= 1. With arg N, the direction is the opposite: this command moves=0A= backward, not forward, N lines.=0A= 2. If called interactively with no prefix arg:=0A= If the previous command was also `beginning-of-line+', then move=0A= to the beginning of the previous line. Else, move to the=0A= beginning of the current line.=0A= Otherwise, move to the beginning of the Nth previous line (Nth next=0A= line if N<0). Command `beginning-of-line', by contrast, moves to=0A= the beginning of the (N-1)th next line."=0A= (interactive=0A= (list (if current-prefix-arg (prefix-numeric-value = current-prefix-arg) 0)))=0A= (unless n (setq n 0)) ; non-interactive with no arg=0A= (if (and (eq this-command last-command) (not current-prefix-arg))=0A= (forward-line -1)=0A= (forward-line (- n))))=0A= =0A= (defun end-of-visual-line+ (&optional n)=0A= "Move cursor to end of current visual line, or end of next if repeated.=0A= If point reaches the beginning or end of buffer, it stops there.=0A= To ignore intangibility, bind `inhibit-point-motion-hooks' to t.=0A= =0A= This is similar to `end-of-visual-line', but:=0A= If called interactively with no prefix arg:=0A= If the previous command was also `end-of-visual-line+', then move=0A= to the end of the next visual line. Else, end of current one.=0A= Otherwise, move to the end of the Nth next visual line (Nth previous=0A= one if N<0). Command `end-of-visual-line', by contrast, moves to=0A= the end of the (N-1)th next line."=0A= (interactive=0A= (list (if current-prefix-arg (prefix-numeric-value = current-prefix-arg) 0)))=0A= (unless n (setq n 0)) ; non-interactive with no arg =0A= (let ((line-move-visual t))=0A= (if (and (eq this-command last-command) (not current-prefix-arg))=0A= (line-move 1 t)=0A= (line-move n t)))=0A= ;; Unlike `move-beginning-of-line', `move-end-of-line' doesn't=0A= ;; constrain to field boundaries, so we don't either.=0A= (vertical-motion (cons (window-width) 0)))=0A= =0A= (defun beginning-of-visual-line+ (&optional n)=0A= "Move cursor to beginning of current visual line or next if repeated.=0A= If point reaches the beginning or end of buffer, it stops there.=0A= To ignore intangibility, bind `inhibit-point-motion-hooks' to t.=0A= =0A= This is the similar to `beginning-of-visual-line', but:=0A= 1. With arg N, the direction is the opposite: this command moves=0A= backward, not forward, N visual lines.=0A= 2. If called interactively with no prefix arg:=0A= If the previous command was also `beginning-of-visual-line+',=0A= then move to the beginning of the previous visual line. Else,=0A= move to the beginning of the current visual line.=0A= Otherwise, move to the beginning of the Nth previous visual line=0A= (Nth next one if N<0). Command `beginning-of-visual-line', by=0A= contrast, moves to the beginning of the (N-1)th next visual=0A= line."=0A= (interactive=0A= (list (if current-prefix-arg (prefix-numeric-value = current-prefix-arg) 0)))=0A= (unless n (setq n 0)) ; non-interactive with no arg=0A= (let ((opoint (point)))=0A= (let ((line-move-visual t))=0A= (if (and (eq this-command last-command) (not current-prefix-arg))=0A= (line-move -1 t)=0A= (line-move n t)))=0A= (vertical-motion 0)=0A= ;; Constrain to field boundaries, like `move-beginning-of-line'.=0A= (goto-char (constrain-to-field (point) opoint (/=3D n 1)))))=0A= =0A= (define-key visual-line-mode-map [remap move-beginning-of-line] nil)=0A= (define-key visual-line-mode-map [remap move-end-of-line] nil)=0A= (define-key visual-line-mode-map [home] 'beginning-of-line+)=0A= (define-key visual-line-mode-map [end] 'end-of-line+)=0A= (define-key visual-line-mode-map "\C-a" 'beginning-of-visual-line+)=0A= (define-key visual-line-mode-map "\C-e" 'end-of-visual-line+)=0A= ------=_NextPart_000_0089_01CDE1DC.B56BAD80--