From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.bugs Subject: bug#13273: 24.3.50; [PATCH] enhancement request: repeatable `visual-line-mode' line movements Date: Fri, 28 Dec 2012 13:05:35 -0800 Message-ID: <21617FC2DCBE461AAFB2992B48B70932@us.oracle.com> References: <3C4C2163F22D425BBB0EE69834231C56@us.oracle.com><87623mgif3.fsf@gmail.com><87y5gif0ce.fsf@gmail.com><2EEA1AD1B23B425DB6980D54D5B7BB79@us.oracle.com> <87k3s1gbm6.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0059_01CDE4FC.07199120" X-Trace: ger.gmane.org 1356728774 22399 80.91.229.3 (28 Dec 2012 21:06:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 28 Dec 2012 21:06:14 +0000 (UTC) Cc: 13273@debbugs.gnu.org To: "'Vitalie Spinu'" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Dec 28 22:06:30 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1Toh8O-0005Uj-KQ for geb-bug-gnu-emacs@m.gmane.org; Fri, 28 Dec 2012 22:06:28 +0100 Original-Received: from localhost ([::1]:57926 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Toh89-00076W-Om for geb-bug-gnu-emacs@m.gmane.org; Fri, 28 Dec 2012 16:06:13 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:56569) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Toh86-00075D-9g for bug-gnu-emacs@gnu.org; Fri, 28 Dec 2012 16:06:12 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Toh83-0006HM-LN for bug-gnu-emacs@gnu.org; Fri, 28 Dec 2012 16:06:10 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:53231) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Toh83-0006HC-Go for bug-gnu-emacs@gnu.org; Fri, 28 Dec 2012 16:06:07 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1Toh8v-0004Rm-ME for bug-gnu-emacs@gnu.org; Fri, 28 Dec 2012 16:07:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: "Drew Adams" Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 28 Dec 2012 21:07:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13273 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 13273-submit@debbugs.gnu.org id=B13273.135672879817057 (code B ref 13273); Fri, 28 Dec 2012 21:07:01 +0000 Original-Received: (at 13273) by debbugs.gnu.org; 28 Dec 2012 21:06:38 +0000 Original-Received: from localhost ([127.0.0.1]:35249 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Toh8Y-0004R4-5C for submit@debbugs.gnu.org; Fri, 28 Dec 2012 16:06:38 -0500 Original-Received: from aserp1040.oracle.com ([141.146.126.69]:31331) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Toh8W-0004Qv-2V for 13273@debbugs.gnu.org; Fri, 28 Dec 2012 16:06:37 -0500 Original-Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by aserp1040.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id qBSL5ed6023159 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 28 Dec 2012 21:05:40 GMT Original-Received: from acsmt357.oracle.com (acsmt357.oracle.com [141.146.40.157]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id qBSL5d3Y013927 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 28 Dec 2012 21:05:40 GMT Original-Received: from abhmt119.oracle.com (abhmt119.oracle.com [141.146.116.71]) by acsmt357.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id qBSL5d49021692; Fri, 28 Dec 2012 15:05:39 -0600 Original-Received: from dradamslap1 (/10.159.169.98) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 28 Dec 2012 13:05:39 -0800 X-Mailer: Microsoft Office Outlook 11 Thread-Index: Ac3lOqtl1XadL2YPSI2Udv9WslEI2AAAqDBg X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 In-reply-to: <87k3s1gbm6.fsf@gmail.com> X-Source-IP: acsinet21.oracle.com [141.146.126.237] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:69128 Archived-At: This is a multi-part message in MIME format. ------=_NextPart_000_0059_01CDE4FC.07199120 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit > > Try just evaluating the new definitions and key bindings, > > instead of trying to apply a patch etc. That will show you > > the proposed behavior. You should not see any errors, > > inflooping etc. > > > Someone intending to install the change to Emacs itself > > can worry about applying the patch. If you just want to > > evaluate the behavior, you need not do that. > > I just did that, and as Eli said, this is a bad idea for built-in > functions. Not if you just want to check the new behavior. I made it clear in my original post that if the new, Lisp definitions from the patch are to be applied then the C versions need to be removed. > But the problem with your function is far more simple: > (defun end-of-line (&optional n) > (let ((inhibit-field-text-motion t)) (end-of-line))) > How is this not an infloop? ----------------^^^^^^^^^^^ About that you are right. The patch is not correct in that regard, sorry. I took the definition from my `end-of-line+' and just renamed it to `end-of-line', without paying attention to the fact that it calls the original C-coded function. For the function to be renamed that way, it would have to call the equivalent of the current C function (to be renamed), or some other change would be needed. My point to you remains, but with a change wrt the names: if you want to evaluate the proposed behavior, then just evaluate the attached code (which is the same as what I sent to emacs-devel for people to try this). The attached definitions are the same as what I included in the patch, except for the doc strings and the command names. (And to repeat, yes, the patch is incorrect because of the name-capture. HTH. ------=_NextPart_000_0059_01CDE4FC.07199120 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_0059_01CDE4FC.07199120--