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: Mon, 24 Dec 2012 14:27:14 -0800 Message-ID: <3C4C2163F22D425BBB0EE69834231C56@us.oracle.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0092_01CDE1E2.C543DD30" X-Trace: ger.gmane.org 1356388112 12293 80.91.229.3 (24 Dec 2012 22:28:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 24 Dec 2012 22:28:32 +0000 (UTC) To: 13273@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Dec 24 23:28:48 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 1TnGVr-0002PV-U7 for geb-bug-gnu-emacs@m.gmane.org; Mon, 24 Dec 2012 23:28:48 +0100 Original-Received: from localhost ([::1]:57454 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TnGVd-0006KI-Jv for geb-bug-gnu-emacs@m.gmane.org; Mon, 24 Dec 2012 17:28:33 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:35839) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TnGVb-0006KD-4d for bug-gnu-emacs@gnu.org; Mon, 24 Dec 2012 17:28:32 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TnGVa-0005X8-4C for bug-gnu-emacs@gnu.org; Mon, 24 Dec 2012 17:28:31 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:48252) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TnGVa-0005X4-0W for bug-gnu-emacs@gnu.org; Mon, 24 Dec 2012 17:28:30 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TnGW5-0007Am-Uz for bug-gnu-emacs@gnu.org; Mon, 24 Dec 2012 17:29:02 -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: Mon, 24 Dec 2012 22:29:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 13273 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: Original-Received: via spool by submit@debbugs.gnu.org id=B.135638809227506 (code B ref -1); Mon, 24 Dec 2012 22:29:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 24 Dec 2012 22:28:12 +0000 Original-Received: from localhost ([127.0.0.1]:58502 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TnGVH-00079a-JP for submit@debbugs.gnu.org; Mon, 24 Dec 2012 17:28:12 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:52594) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TnGVD-00079Q-Sv for submit@debbugs.gnu.org; Mon, 24 Dec 2012 17:28:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TnGUg-0005QJ-0N for submit@debbugs.gnu.org; Mon, 24 Dec 2012 17:27:34 -0500 Original-Received: from lists.gnu.org ([208.118.235.17]:38795) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TnGUf-0005QF-U9 for submit@debbugs.gnu.org; Mon, 24 Dec 2012 17:27:33 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:35717) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TnGUd-00069l-TR for bug-gnu-emacs@gnu.org; Mon, 24 Dec 2012 17:27:33 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TnGUc-0005Pq-U9 for bug-gnu-emacs@gnu.org; Mon, 24 Dec 2012 17:27:31 -0500 Original-Received: from aserp1040.oracle.com ([141.146.126.69]:27977) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TnGUc-0005Pm-M1 for bug-gnu-emacs@gnu.org; Mon, 24 Dec 2012 17:27:30 -0500 Original-Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by aserp1040.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id qBOMRTj9006453 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 24 Dec 2012 22:27:29 GMT Original-Received: from acsmt357.oracle.com (acsmt357.oracle.com [141.146.40.157]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id qBOMRS1L010492 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 24 Dec 2012 22:27:29 GMT Original-Received: from abhmt116.oracle.com (abhmt116.oracle.com [141.146.116.68]) by acsmt357.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id qBOMRSn8001648 for ; Mon, 24 Dec 2012 16:27:28 -0600 Original-Received: from dradamslap1 (/71.202.147.44) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 24 Dec 2012 14:27:28 -0800 X-Mailer: Microsoft Office Outlook 11 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Thread-Index: Ac3iJdLrse46d2Y3TIOIzPpldYp4kw== X-Source-IP: acsinet22.oracle.com [141.146.126.238] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x 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:69020 Archived-At: This is a multi-part message in MIME format. ------=_NextPart_000_0092_01CDE1E2.C543DD30 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit The attached patch does the following: 1. Redefines commands `beginning-of-visual-line' and `end-of-visual-line', so that they are repeatable. 2. Redefines commands `beginning-of-line' and `end-of-line', so that they are repeatable. 3. Removes the remapping of commands `move-beginning-of-line' and `move-end-of-line' to `beginning-of-visual-line' and `end-of-visual-line' - see next. 4. In place of those remappings, makes these key bindings for `visual-line-mode': * `home' - `beginning-of-line' * `end' - `end-of-line' * `C-a' - `beginning-of-visual-line' * `C-e' - `end-of-visual-line' Each of these keys gets a repeatable command. `home' and `end' move among logical lines. `C-a' and `C-e' move among visual lines. Both kinds of movement are useful in `visual-line-mode'. NOTE: The attatched patch does not remove the C source code definitions of `beginning-of-line' and `end-of-line', but that would need to be done. I do not have the C sources and do not want to fiddle with C. I assume it will be easy for someone else to remove those definitions. (These commands do not belong in C anyway.) In GNU Emacs 24.3.50.1 (i386-mingw-nt5.1.2600) of 2012-12-18 on MS-W7-DANI Bzr revision: 111265 eliz@gnu.org-20121218190556-x9wmq083vwecgu0f Windowing system distributor `Microsoft Corp.', version 5.1.2600 Configured using: `configure --with-gcc (4.7) --no-opt --enable-checking --cflags -Ic:/emacs/libs/libXpm-3.5.10/include -Ic:/emacs/libs/libXpm-3.5.10/src -Ic:/emacs/libs/libpng-dev_1.4.3-1_win32/include -Ic:/emacs/libs/zlib-dev_1.2.5-2_win32/include -Ic:/emacs/libs/giflib-4.1.4-1-lib/include -Ic:/emacs/libs/jpeg-6b-4-lib/include -Ic:/emacs/libs/tiff-3.8.2-1-lib/include -Ic:/emacs/libs/libxml2-2.7.8-w32-bin/include/libxml2 -Ic:/emacs/libs/gnutls-3.0.9-w32-bin/include -Ic:/emacs/libs/libiconv-1.9.2-1-lib/include' ------=_NextPart_000_0092_01CDE1E2.C543DD30 Content-Type: application/octet-stream; name="simple-2012-12-24.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="simple-2012-12-24.patch" diff -c c\:/foo/simple.el c\:/foo/simple-patched-2012-12-24.el=0A= *** c:/foo/simple.el Mon Dec 24 13:48:06 2012=0A= --- c:/foo/simple-patched-2012-12-24.el Mon Dec 24 14:13:14 2012=0A= ***************=0A= *** 819,824 ****=0A= --- 819,854 ----=0A= (overlay-recenter (point))=0A= (recenter -3))))=0A= =0A= + (defun end-of-line (&optional n)=0A= + "Move cursor to end of current line or end of next line if repeated.=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 )."=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= + If called interactively with no prefix arg:=0A= + If the previous command was also `beginning-of-line' then move to the=0A= + beginning of the previous line. Else move to the beginning of the=0A= + current line.=0A= + Otherwise, move to the beginning of the Nth previous line (Nth next=0A= + line if N < 0)."=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= (defcustom delete-active-region t=0A= "Whether single-char deletion commands delete an active region.=0A= This has an effect only if Transient Mark mode is enabled, and=0A= ***************=0A= *** 5007,5036 ****=0A= ;;; Editing based on visual lines, as opposed to logical lines.=0A= =0A= (defun end-of-visual-line (&optional n)=0A= ! "Move point to end of current visual line.=0A= ! With argument N not nil or 1, move forward N - 1 visual lines first.=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= ! (interactive "^p")=0A= ! (or n (setq n 1))=0A= ! (if (/=3D n 1)=0A= ! (let ((line-move-visual t))=0A= ! (line-move (1- 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 point to beginning of current visual line.=0A= ! With argument N not nil or 1, move forward N - 1 visual lines first.=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= ! (interactive "^p")=0A= ! (or n (setq n 1))=0A= ! (let ((opoint (point)))=0A= ! (if (/=3D n 1)=0A= ! (let ((line-move-visual t))=0A= ! (line-move (1- 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= --- 5037,5083 ----=0A= ;;; Editing based on visual lines, as opposed to logical lines.=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, stop there.=0A= ! To ignore intangibility, bind `inhibit-point-motion-hooks' to t.=0A= ! =0A= ! If called interactively with no prefix argument:=0A= ! If the previous command was also `end-of-visual-line', then move to=0A= ! the end of the next visual line. Else move to end of current one.=0A= ! Otherwise, move to the end of the Nth next visual line (Nth previous=0A= ! one if N < 0)."=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= ! With argument N, move backward N visual lines.=0A= ! =0A= ! If called interactively with no prefix argument:=0A= ! If the previous command was also `beginning-of-visual-line', then=0A= ! move to the beginning of the previous visual line. Else move to the=0A= ! 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)."=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= *** 5098,5105 ****=0A= (defvar visual-line-mode-map=0A= (let ((map (make-sparse-keymap)))=0A= (define-key map [remap kill-line] 'kill-visual-line)=0A= ! (define-key map [remap move-beginning-of-line] = 'beginning-of-visual-line)=0A= ! (define-key map [remap move-end-of-line] 'end-of-visual-line)=0A= ;; These keybindings interfere with xterm function keys. Are=0A= ;; there any other suitable bindings?=0A= ;; (define-key map "\M-[" 'previous-logical-line)=0A= --- 5145,5154 ----=0A= (defvar visual-line-mode-map=0A= (let ((map (make-sparse-keymap)))=0A= (define-key map [remap kill-line] 'kill-visual-line)=0A= ! (define-key map [home] 'beginning-of-line)=0A= ! (define-key map [end] 'end-of-line)=0A= ! (define-key map "\C-a" 'beginning-of-visual-line)=0A= ! (define-key map "\C-e" 'end-of-visual-line)=0A= ;; These keybindings interfere with xterm function keys. Are=0A= ;; there any other suitable bindings?=0A= ;; (define-key map "\M-[" 'previous-logical-line)=0A= =0A= Diff finished. Mon Dec 24 21:13:36 2012=0A= ------=_NextPart_000_0092_01CDE1E2.C543DD30--