From unknown Tue Jun 24 10:33:44 2025 X-Loop: help-debbugs@gnu.org Subject: bug#19824: 25.0.50; Support goal column in multi-line minibuffer Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 10 Feb 2015 00:50:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 19824 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 19824@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.142352939918586 (code B ref -1); Tue, 10 Feb 2015 00:50:01 +0000 Received: (at submit) by debbugs.gnu.org; 10 Feb 2015 00:49:59 +0000 Received: from localhost ([127.0.0.1]:38634 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YKz1a-0004pg-Ex for submit@debbugs.gnu.org; Mon, 09 Feb 2015 19:49:58 -0500 Received: from eggs.gnu.org ([208.118.235.92]:33320) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YKz1Y-0004pT-Hd for submit@debbugs.gnu.org; Mon, 09 Feb 2015 19:49:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YKz1S-0002Mb-6w for submit@debbugs.gnu.org; Mon, 09 Feb 2015 19:49:51 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:53090) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKz1S-0002MX-3h for submit@debbugs.gnu.org; Mon, 09 Feb 2015 19:49:50 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35031) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKz1R-0001bR-2X for bug-gnu-emacs@gnu.org; Mon, 09 Feb 2015 19:49:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YKz1N-0002MC-Sp for bug-gnu-emacs@gnu.org; Mon, 09 Feb 2015 19:49:49 -0500 Received: from ps18281.dreamhost.com ([69.163.222.226]:56868 helo=ps18281.dreamhostps.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKz1N-0002Ly-ND for bug-gnu-emacs@gnu.org; Mon, 09 Feb 2015 19:49:45 -0500 Received: from localhost.linkov.net (ps18281.dreamhostps.com [69.163.222.226]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 0FFB037E696606 for ; Mon, 9 Feb 2015 16:49:42 -0800 (PST) From: Juri Linkov Organization: LINKOV.NET Date: Tue, 10 Feb 2015 02:45:33 +0200 Message-ID: <871tlyppaq.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Tags: patch In the single-line minibuffer the goal column was handled by using the point's absolute position that is the same as the column on the single line. However, this doesn't work on the multi-line minibuffer. This patch adds support for the goal column on multi-line input in the minibuffer: diff --git a/lisp/simple.el b/lisp/simple.el index 25293ed..58b4870 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -1990,7 +1990,14 @@ (defun next-line-or-history-element (&optional arg) next element of the minibuffer history in the minibuffer." (interactive "^p") (or arg (setq arg 1)) - (let ((old-point (point))) + (let* ((old-point (point)) + ;; Remember the original goal column of possibly multi-line input + ;; excluding the length of the prompt on the first line. + (prompt-end (minibuffer-prompt-end)) + (old-column (unless (and (eolp) (> (point) prompt-end)) + (if (= (line-number-at-pos) 1) + (max (- (current-column) (1- prompt-end)) 0) + (current-column))))) (condition-case nil (with-no-warnings (next-line arg)) @@ -1998,7 +2005,14 @@ (defun next-line-or-history-element (&optional arg) ;; Restore old position since `line-move-visual' moves point to ;; the end of the line when it fails to go to the next line. (goto-char old-point) - (next-history-element arg))))) + (next-history-element arg) + ;; Restore the original goal column on the last line + ;; of possibly multi-line input. + (goto-char (point-max)) + (when old-column + (if (= (line-number-at-pos) 1) + (move-to-column (+ old-column (1- (minibuffer-prompt-end)))) + (move-to-column old-column))))))) (defun previous-line-or-history-element (&optional arg) "Move cursor vertically up ARG lines, or to the previous history element. @@ -2006,7 +2020,14 @@ (defun previous-line-or-history-element (&optional arg) previous element of the minibuffer history in the minibuffer." (interactive "^p") (or arg (setq arg 1)) - (let ((old-point (point))) + (let* ((old-point (point)) + ;; Remember the original goal column of possibly multi-line input + ;; excluding the length of the prompt on the first line. + (prompt-end (minibuffer-prompt-end)) + (old-column (unless (and (eolp) (> (point) prompt-end)) + (if (= (line-number-at-pos) 1) + (max (- (current-column) (1- prompt-end)) 0) + (current-column))))) (condition-case nil (with-no-warnings (previous-line arg)) @@ -2014,7 +2035,15 @@ (defun previous-line-or-history-element (&optional arg) ;; Restore old position since `line-move-visual' moves point to ;; the beginning of the line when it fails to go to the previous line. (goto-char old-point) - (previous-history-element arg))))) + (previous-history-element arg) + ;; Restore the original goal column on the first line + ;; of possibly multi-line input. + (goto-char (minibuffer-prompt-end)) + (if old-column + (if (= (line-number-at-pos) 1) + (move-to-column (+ old-column (1- (minibuffer-prompt-end)))) + (move-to-column old-column)) + (goto-char (line-end-position))))))) (defun next-complete-history-element (n) "Get next history element which completes the minibuffer before the point. From unknown Tue Jun 24 10:33:44 2025 X-Loop: help-debbugs@gnu.org Subject: bug#19824: 25.0.50; Support goal column in multi-line minibuffer Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 10 Feb 2015 15:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19824 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Juri Linkov Cc: 19824@debbugs.gnu.org Reply-To: Eli Zaretskii Received: via spool by 19824-submit@debbugs.gnu.org id=B19824.142358384428406 (code B ref 19824); Tue, 10 Feb 2015 15:58:02 +0000 Received: (at 19824) by debbugs.gnu.org; 10 Feb 2015 15:57:24 +0000 Received: from localhost ([127.0.0.1]:39502 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YLDBk-0007O6-6r for submit@debbugs.gnu.org; Tue, 10 Feb 2015 10:57:24 -0500 Received: from mtaout22.012.net.il ([80.179.55.172]:52737) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YLDBg-0007No-M2 for 19824@debbugs.gnu.org; Tue, 10 Feb 2015 10:57:22 -0500 Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0NJK00400C54GZ00@a-mtaout22.012.net.il> for 19824@debbugs.gnu.org; Tue, 10 Feb 2015 17:57:14 +0200 (IST) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NJK004Z9CBD0SA0@a-mtaout22.012.net.il>; Tue, 10 Feb 2015 17:57:14 +0200 (IST) Date: Tue, 10 Feb 2015 17:57:02 +0200 From: Eli Zaretskii In-reply-to: <871tlyppaq.fsf@mail.linkov.net> X-012-Sender: halo1@inter.net.il Message-id: <837fvp92up.fsf@gnu.org> References: <871tlyppaq.fsf@mail.linkov.net> X-Spam-Score: 1.0 (+) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) > From: Juri Linkov > Date: Tue, 10 Feb 2015 02:45:33 +0200 > > In the single-line minibuffer the goal column was handled by using the point's > absolute position that is the same as the column on the single line. > However, this doesn't work on the multi-line minibuffer. This patch adds > support for the goal column on multi-line input in the minibuffer: Thanks. > - (let ((old-point (point))) > + (let* ((old-point (point)) > + ;; Remember the original goal column of possibly multi-line input > + ;; excluding the length of the prompt on the first line. > + (prompt-end (minibuffer-prompt-end)) > + (old-column (unless (and (eolp) (> (point) prompt-end)) > + (if (= (line-number-at-pos) 1) > + (max (- (current-column) (1- prompt-end)) 0) > + (current-column))))) Why do you use current-column and move-to-column here, instead of using the line-move-visual methods we use by default in any other buffer? Is there some technical problem to use visual-line movement in the minibuffer? If not, I think we should do that for consistency of the user experience. From unknown Tue Jun 24 10:33:44 2025 X-Loop: help-debbugs@gnu.org Subject: bug#19824: 25.0.50; Support goal column in multi-line minibuffer Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 10 Feb 2015 23:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19824 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Eli Zaretskii Cc: 19824@debbugs.gnu.org Received: via spool by 19824-submit@debbugs.gnu.org id=B19824.142361182113876 (code B ref 19824); Tue, 10 Feb 2015 23:44:02 +0000 Received: (at 19824) by debbugs.gnu.org; 10 Feb 2015 23:43:41 +0000 Received: from localhost ([127.0.0.1]:39699 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YLKSy-0003bj-TH for submit@debbugs.gnu.org; Tue, 10 Feb 2015 18:43:41 -0500 Received: from ps18281.dreamhost.com ([69.163.222.226]:55538 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YLKSw-0003bZ-Ik for 19824@debbugs.gnu.org; Tue, 10 Feb 2015 18:43:39 -0500 Received: from localhost.linkov.net (ps18281.dreamhostps.com [69.163.222.226]) by ps18281.dreamhostps.com (Postfix) with ESMTP id C1825394FFD774; Tue, 10 Feb 2015 15:43:36 -0800 (PST) From: Juri Linkov Organization: LINKOV.NET References: <871tlyppaq.fsf@mail.linkov.net> <837fvp92up.fsf@gnu.org> Date: Wed, 11 Feb 2015 01:38:03 +0200 In-Reply-To: <837fvp92up.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 10 Feb 2015 17:57:02 +0200") Message-ID: <87mw4l72xw.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) > Why do you use current-column and move-to-column here, instead of > using the line-move-visual methods we use by default in any other > buffer? Is there some technical problem to use visual-line movement > in the minibuffer? If not, I think we should do that for consistency > of the user experience. line-move-visual is still used while moving point inside the minibuffer, but when moving to another history element, the whole contents of the minibuffer is erased, and new text is inserted, in which the column should be positioned correctly. From unknown Tue Jun 24 10:33:44 2025 X-Loop: help-debbugs@gnu.org Subject: bug#19824: 25.0.50; Support goal column in multi-line minibuffer Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 11 Feb 2015 15:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19824 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Juri Linkov Cc: 19824@debbugs.gnu.org Reply-To: Eli Zaretskii Received: via spool by 19824-submit@debbugs.gnu.org id=B19824.14236691771494 (code B ref 19824); Wed, 11 Feb 2015 15:40:02 +0000 Received: (at 19824) by debbugs.gnu.org; 11 Feb 2015 15:39:37 +0000 Received: from localhost ([127.0.0.1]:40259 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YLZO4-0000O2-UX for submit@debbugs.gnu.org; Wed, 11 Feb 2015 10:39:37 -0500 Received: from mtaout26.012.net.il ([80.179.55.182]:44301) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YLZO2-0000Nl-9V for 19824@debbugs.gnu.org; Wed, 11 Feb 2015 10:39:35 -0500 Received: from conversion-daemon.mtaout26.012.net.il by mtaout26.012.net.il (HyperSendmail v2007.08) id <0NJM0070064IW200@mtaout26.012.net.il> for 19824@debbugs.gnu.org; Wed, 11 Feb 2015 17:39:36 +0200 (IST) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout26.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NJM00OI46606480@mtaout26.012.net.il>; Wed, 11 Feb 2015 17:39:36 +0200 (IST) Date: Wed, 11 Feb 2015 17:39:18 +0200 From: Eli Zaretskii In-reply-to: <87mw4l72xw.fsf@mail.linkov.net> X-012-Sender: halo1@inter.net.il Message-id: <83iof87909.fsf@gnu.org> References: <871tlyppaq.fsf@mail.linkov.net> <837fvp92up.fsf@gnu.org> <87mw4l72xw.fsf@mail.linkov.net> X-Spam-Score: 1.0 (+) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) > From: Juri Linkov > Cc: 19824@debbugs.gnu.org > Date: Wed, 11 Feb 2015 01:38:03 +0200 > > > Why do you use current-column and move-to-column here, instead of > > using the line-move-visual methods we use by default in any other > > buffer? Is there some technical problem to use visual-line movement > > in the minibuffer? If not, I think we should do that for consistency > > of the user experience. > > line-move-visual is still used while moving point inside the minibuffer, > but when moving to another history element, the whole contents of the > minibuffer is erased, and new text is inserted, in which the column > should be positioned correctly. Right, sorry. So I guess now I don't understand why we try keeping the horizontal position across history elements. Why not reset the position to just after the prompt? There's nothing in common between the history elements, in general. From unknown Tue Jun 24 10:33:44 2025 X-Loop: help-debbugs@gnu.org Subject: bug#19824: 25.0.50; Support goal column in multi-line minibuffer Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 12 Feb 2015 01:18:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19824 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Eli Zaretskii Cc: 19824@debbugs.gnu.org Received: via spool by 19824-submit@debbugs.gnu.org id=B19824.142370384428403 (code B ref 19824); Thu, 12 Feb 2015 01:18:01 +0000 Received: (at 19824) by debbugs.gnu.org; 12 Feb 2015 01:17:24 +0000 Received: from localhost ([127.0.0.1]:40424 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YLiPD-0007Ny-C0 for submit@debbugs.gnu.org; Wed, 11 Feb 2015 20:17:23 -0500 Received: from ps18281.dreamhost.com ([69.163.222.226]:58130 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YLiPA-0007Nn-W8 for 19824@debbugs.gnu.org; Wed, 11 Feb 2015 20:17:21 -0500 Received: from localhost.linkov.net (ps18281.dreamhostps.com [69.163.222.226]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 3F3F63947C7E7B; Wed, 11 Feb 2015 17:17:18 -0800 (PST) From: Juri Linkov Organization: LINKOV.NET References: <871tlyppaq.fsf@mail.linkov.net> <837fvp92up.fsf@gnu.org> <87mw4l72xw.fsf@mail.linkov.net> <83iof87909.fsf@gnu.org> Date: Thu, 12 Feb 2015 02:54:59 +0200 In-Reply-To: <83iof87909.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 11 Feb 2015 17:39:18 +0200") Message-ID: <8761b8q6b0.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) > Right, sorry. So I guess now I don't understand why we try keeping > the horizontal position across history elements. Why not reset the > position to just after the prompt? There's nothing in common between > the history elements, in general. This is for backward-compatibility with the traditional behavior that existed from the beginning that kept the horizontal position for single-line history elements. And it's really convenient when the history is navigated the same way as a normal buffer where line-move-visual keeps the column. From unknown Tue Jun 24 10:33:44 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.503 (Entity 5.503) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Juri Linkov Subject: bug#19824: closed (Re: bug#19824: 25.0.50; Support goal column in multi-line minibuffer) Message-ID: References: <87sidaarml.fsf@mail.linkov.net> <871tlyppaq.fsf@mail.linkov.net> X-Gnu-PR-Message: they-closed 19824 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 19824@debbugs.gnu.org Date: Thu, 12 Mar 2015 20:28:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1426192082-12265-1" This is a multi-part message in MIME format... ------------=_1426192082-12265-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #19824: 25.0.50; Support goal column in multi-line minibuffer which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 19824@debbugs.gnu.org. --=20 19824: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D19824 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1426192082-12265-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 19824-done) by debbugs.gnu.org; 12 Mar 2015 20:27:52 +0000 Received: from localhost ([127.0.0.1]:44297 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YW9hw-0003BT-CW for submit@debbugs.gnu.org; Thu, 12 Mar 2015 16:27:52 -0400 Received: from ps18281.dreamhost.com ([69.163.222.226]:41481 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YW9hu-0003BK-UQ for 19824-done@debbugs.gnu.org; Thu, 12 Mar 2015 16:27:51 -0400 Received: from localhost.linkov.net (ps18281.dreamhostps.com [69.163.222.226]) by ps18281.dreamhostps.com (Postfix) with ESMTP id B7170302C975B2 for <19824-done@debbugs.gnu.org>; Thu, 12 Mar 2015 13:27:49 -0700 (PDT) From: Juri Linkov To: 19824-done@debbugs.gnu.org Subject: Re: bug#19824: 25.0.50; Support goal column in multi-line minibuffer Organization: LINKOV.NET References: <871tlyppaq.fsf@mail.linkov.net> Date: Thu, 12 Mar 2015 22:27:14 +0200 In-Reply-To: <871tlyppaq.fsf@mail.linkov.net> (Juri Linkov's message of "Tue, 10 Feb 2015 02:45:33 +0200") Message-ID: <87sidaarml.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 19824-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) Done. ------------=_1426192082-12265-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 10 Feb 2015 00:49:59 +0000 Received: from localhost ([127.0.0.1]:38634 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YKz1a-0004pg-Ex for submit@debbugs.gnu.org; Mon, 09 Feb 2015 19:49:58 -0500 Received: from eggs.gnu.org ([208.118.235.92]:33320) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YKz1Y-0004pT-Hd for submit@debbugs.gnu.org; Mon, 09 Feb 2015 19:49:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YKz1S-0002Mb-6w for submit@debbugs.gnu.org; Mon, 09 Feb 2015 19:49:51 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:53090) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKz1S-0002MX-3h for submit@debbugs.gnu.org; Mon, 09 Feb 2015 19:49:50 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35031) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKz1R-0001bR-2X for bug-gnu-emacs@gnu.org; Mon, 09 Feb 2015 19:49:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YKz1N-0002MC-Sp for bug-gnu-emacs@gnu.org; Mon, 09 Feb 2015 19:49:49 -0500 Received: from ps18281.dreamhost.com ([69.163.222.226]:56868 helo=ps18281.dreamhostps.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKz1N-0002Ly-ND for bug-gnu-emacs@gnu.org; Mon, 09 Feb 2015 19:49:45 -0500 Received: from localhost.linkov.net (ps18281.dreamhostps.com [69.163.222.226]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 0FFB037E696606 for ; Mon, 9 Feb 2015 16:49:42 -0800 (PST) From: Juri Linkov To: bug-gnu-emacs@gnu.org Subject: 25.0.50; Support goal column in multi-line minibuffer Organization: LINKOV.NET Date: Tue, 10 Feb 2015 02:45:33 +0200 Message-ID: <871tlyppaq.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Tags: patch In the single-line minibuffer the goal column was handled by using the point's absolute position that is the same as the column on the single line. However, this doesn't work on the multi-line minibuffer. This patch adds support for the goal column on multi-line input in the minibuffer: diff --git a/lisp/simple.el b/lisp/simple.el index 25293ed..58b4870 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -1990,7 +1990,14 @@ (defun next-line-or-history-element (&optional arg) next element of the minibuffer history in the minibuffer." (interactive "^p") (or arg (setq arg 1)) - (let ((old-point (point))) + (let* ((old-point (point)) + ;; Remember the original goal column of possibly multi-line input + ;; excluding the length of the prompt on the first line. + (prompt-end (minibuffer-prompt-end)) + (old-column (unless (and (eolp) (> (point) prompt-end)) + (if (= (line-number-at-pos) 1) + (max (- (current-column) (1- prompt-end)) 0) + (current-column))))) (condition-case nil (with-no-warnings (next-line arg)) @@ -1998,7 +2005,14 @@ (defun next-line-or-history-element (&optional arg) ;; Restore old position since `line-move-visual' moves point to ;; the end of the line when it fails to go to the next line. (goto-char old-point) - (next-history-element arg))))) + (next-history-element arg) + ;; Restore the original goal column on the last line + ;; of possibly multi-line input. + (goto-char (point-max)) + (when old-column + (if (= (line-number-at-pos) 1) + (move-to-column (+ old-column (1- (minibuffer-prompt-end)))) + (move-to-column old-column))))))) (defun previous-line-or-history-element (&optional arg) "Move cursor vertically up ARG lines, or to the previous history element. @@ -2006,7 +2020,14 @@ (defun previous-line-or-history-element (&optional arg) previous element of the minibuffer history in the minibuffer." (interactive "^p") (or arg (setq arg 1)) - (let ((old-point (point))) + (let* ((old-point (point)) + ;; Remember the original goal column of possibly multi-line input + ;; excluding the length of the prompt on the first line. + (prompt-end (minibuffer-prompt-end)) + (old-column (unless (and (eolp) (> (point) prompt-end)) + (if (= (line-number-at-pos) 1) + (max (- (current-column) (1- prompt-end)) 0) + (current-column))))) (condition-case nil (with-no-warnings (previous-line arg)) @@ -2014,7 +2035,15 @@ (defun previous-line-or-history-element (&optional arg) ;; Restore old position since `line-move-visual' moves point to ;; the beginning of the line when it fails to go to the previous line. (goto-char old-point) - (previous-history-element arg))))) + (previous-history-element arg) + ;; Restore the original goal column on the first line + ;; of possibly multi-line input. + (goto-char (minibuffer-prompt-end)) + (if old-column + (if (= (line-number-at-pos) 1) + (move-to-column (+ old-column (1- (minibuffer-prompt-end)))) + (move-to-column old-column)) + (goto-char (line-end-position))))))) (defun next-complete-history-element (n) "Get next history element which completes the minibuffer before the point. ------------=_1426192082-12265-1--