all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#21737: 24.5; Minor feature request: `comint-previous-matching-input-from-input' and point
@ 2015-10-22 20:29 Eli Barzilay
       [not found] ` <handler.21737.B.14455457715661.ack@debbugs.gnu.org>
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Eli Barzilay @ 2015-10-22 20:29 UTC (permalink / raw)
  To: 21737; +Cc: Chong Yidong, Le Wang

`comint-previous-matching-input-from-input' used to insert a match and
leave the point at the end of the line.  I found that behavior much
better than zsh and bash since when recalling old commands I edit the
last part of the command much more often.  (In fact, I think that
comint used to leave the point where it was years ago, since I
remember having to tweak emacs to put it at the end.)

A few years ago, there was a bug & a patch reported by Le Wang about
keeping the point at the same place -- something that I find really
annoying...  The problem with this patch is that it has no option to
leave the point at the end, forcing me to duplicate the whole function
if I want that behavior.

So, this is a feature request to add such an option with a new custom
variable.

-- 
                    ((x=>x(x))(x=>x(x)))                   Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#21737: Acknowledgement (24.5; Minor feature request: `comint-previous-matching-input-from-input' and point)
       [not found] ` <handler.21737.B.14455457715661.ack@debbugs.gnu.org>
@ 2015-10-22 20:42   ` Eli Barzilay
  0 siblings, 0 replies; 10+ messages in thread
From: Eli Barzilay @ 2015-10-22 20:42 UTC (permalink / raw)
  To: 21737

On Thu, Oct 22, 2015 at 4:30 PM, GNU bug Tracking System
<help-debbugs@gnu.org> wrote:
> If you wish to submit further information on this problem, please
> send it to 21737@debbugs.gnu.org.

I forgot to also note that this bit from the mentioned bug report:

| The point should not be moved so that I can press M-p again to find
| the next match.

is wrong: `comint-previous-matching-input-from-input' already had that
functionality using `comint-matching-input-from-input-string' to keep
the same search string on consequent searches regardless of the point
position.

(I tend to think that because of this the default behavior should be
kept as it was, but in practice I'm guessing that most people expect the
zsh/bash thing.)

-- 
                    ((x=>x(x))(x=>x(x)))                   Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#21737: 24.5; Minor feature request: `comint-previous-matching-input-from-input' and point
  2015-10-22 20:29 bug#21737: 24.5; Minor feature request: `comint-previous-matching-input-from-input' and point Eli Barzilay
       [not found] ` <handler.21737.B.14455457715661.ack@debbugs.gnu.org>
@ 2015-10-23  6:26 ` Eli Zaretskii
  2015-11-13 22:30 ` bug#21737: Acknowledgement (24.5; Minor feature request: `comint-previous-matching-input-from-input' and point) Stephen Perry
  2 siblings, 0 replies; 10+ messages in thread
From: Eli Zaretskii @ 2015-10-23  6:26 UTC (permalink / raw)
  To: Eli Barzilay; +Cc: 21737, cyd, l26wang

> From: Eli Barzilay <eli@barzilay.org>
> Date: Thu, 22 Oct 2015 16:29:15 -0400
> Cc: Chong Yidong <cyd@gnu.org>, Le Wang <l26wang@gmail.com>
> 
> `comint-previous-matching-input-from-input' used to insert a match and
> leave the point at the end of the line.  I found that behavior much
> better than zsh and bash since when recalling old commands I edit the
> last part of the command much more often.  (In fact, I think that
> comint used to leave the point where it was years ago, since I
> remember having to tweak emacs to put it at the end.)
> 
> A few years ago, there was a bug & a patch reported by Le Wang about
> keeping the point at the same place -- something that I find really
> annoying...  The problem with this patch is that it has no option to
> leave the point at the end, forcing me to duplicate the whole function
> if I want that behavior.
> 
> So, this is a feature request to add such an option with a new custom
> variable.

Thanks.  Would you like to prepare a patch along these lines?





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#21737: Acknowledgement (24.5; Minor feature request: `comint-previous-matching-input-from-input' and point)
  2015-10-22 20:29 bug#21737: 24.5; Minor feature request: `comint-previous-matching-input-from-input' and point Eli Barzilay
       [not found] ` <handler.21737.B.14455457715661.ack@debbugs.gnu.org>
  2015-10-23  6:26 ` bug#21737: 24.5; Minor feature request: `comint-previous-matching-input-from-input' and point Eli Zaretskii
@ 2015-11-13 22:30 ` Stephen Perry
  2015-11-16 16:50   ` John Wiegley
  2 siblings, 1 reply; 10+ messages in thread
From: Stephen Perry @ 2015-11-13 22:30 UTC (permalink / raw)
  To: 21737

How about this for a patch?  It’s my first so be kind :-)

diff --git a/lisp/comint.el b/lisp/comint.el
index e70fe88..8d61226 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -283,6 +283,14 @@ comint-move-point-for-output
 		 (const others))
   :group 'comint)
 
+(defcustom comint-move-point-to-end-on-match nil
+  "Controls whether point moves to the end of the matched input.
+If nil, then point remains in the current position.
+If t, point moves to the end of matched input."
+  :type '(choice (const :tag "off" nil)
+                 (const t))
+  :group 'comint)
+
 (defvaralias 'comint-scroll-to-bottom-on-output 'comint-move-point-for-output)
 
 (defcustom comint-scroll-show-maximum-output t
@@ -1220,7 +1228,8 @@ comint-previous-matching-input-from-input
     (comint-previous-matching-input
      (concat "^" (regexp-quote comint-matching-input-from-input-string))
      n)
-    (goto-char opoint)))
+    (unless comint-move-point-to-end-on-match
+      (goto-char opoint))))
 
 (defun comint-next-matching-input-from-input (n)
   "Search forwards through input history for match for current input.








^ permalink raw reply related	[flat|nested] 10+ messages in thread

* bug#21737: Acknowledgement (24.5; Minor feature request: `comint-previous-matching-input-from-input' and point)
  2015-11-13 22:30 ` bug#21737: Acknowledgement (24.5; Minor feature request: `comint-previous-matching-input-from-input' and point) Stephen Perry
@ 2015-11-16 16:50   ` John Wiegley
  2015-11-16 18:55     ` Stephen Perry
  0 siblings, 1 reply; 10+ messages in thread
From: John Wiegley @ 2015-11-16 16:50 UTC (permalink / raw)
  To: Stephen Perry; +Cc: 21737

>>>>> Stephen Perry <stevoooo@gmail.com> writes:

> How about this for a patch?  It’s my first so be kind :-)

Hi Stephen,

I think that using ":type 'boolean" is better than specifiying a custom
version.

Otherwise, it looks good to me.

John





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#21737: Acknowledgement (24.5; Minor feature request: `comint-previous-matching-input-from-input' and point)
  2015-11-16 16:50   ` John Wiegley
@ 2015-11-16 18:55     ` Stephen Perry
  2015-11-17  0:58       ` Juri Linkov
  2020-09-17 17:42       ` Lars Ingebrigtsen
  0 siblings, 2 replies; 10+ messages in thread
From: Stephen Perry @ 2015-11-16 18:55 UTC (permalink / raw)
  To: John Wiegley; +Cc: 21737

Updated patch:

diff --git a/lisp/comint.el b/lisp/comint.el
index e70fe88..b7a906e 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -283,6 +283,13 @@ comint-move-point-for-output
 		 (const others))
   :group 'comint)
 
+(defcustom comint-move-point-to-end-on-match nil
+  "Controls whether point moves to the end of the matched input.
+If nil, then point remains in the current position.
+If t, point moves to the end of matched input."
+  :type 'boolean
+  :group 'comint)
+
 (defvaralias 'comint-scroll-to-bottom-on-output 'comint-move-point-for-output)
 
 (defcustom comint-scroll-show-maximum-output t
@@ -1220,7 +1227,8 @@ comint-previous-matching-input-from-input
     (comint-previous-matching-input
      (concat "^" (regexp-quote comint-matching-input-from-input-string))
      n)
-    (goto-char opoint)))
+    (unless comint-move-point-to-end-on-match
+      (goto-char opoint))))
 
 (defun comint-next-matching-input-from-input (n)
   "Search forwards through input history for match for current input.







^ permalink raw reply related	[flat|nested] 10+ messages in thread

* bug#21737: Acknowledgement (24.5; Minor feature request: `comint-previous-matching-input-from-input' and point)
  2015-11-16 18:55     ` Stephen Perry
@ 2015-11-17  0:58       ` Juri Linkov
  2015-11-17 13:08         ` Stephen Perry
  2020-09-17 17:42       ` Lars Ingebrigtsen
  1 sibling, 1 reply; 10+ messages in thread
From: Juri Linkov @ 2015-11-17  0:58 UTC (permalink / raw)
  To: Stephen Perry; +Cc: John Wiegley, 21737

> +(defcustom comint-move-point-to-end-on-match nil
> +  "Controls whether point moves to the end of the matched input.
> +If nil, then point remains in the current position.
> +If t, point moves to the end of matched input."
> +  :type 'boolean
> +  :group 'comint)
> +
>  (defvaralias 'comint-scroll-to-bottom-on-output 'comint-move-point-for-output)
>
>  (defcustom comint-scroll-show-maximum-output t
> @@ -1220,7 +1227,8 @@ comint-previous-matching-input-from-input
>      (comint-previous-matching-input
>       (concat "^" (regexp-quote comint-matching-input-from-input-string))
>       n)
> -    (goto-char opoint)))
> +    (unless comint-move-point-to-end-on-match
> +      (goto-char opoint))))

I wonder could we use the logic of 'track-eol' here?  This means that going
to the previous command lines starting at the end of the command line will
keep to the ends of command lines.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#21737: Acknowledgement (24.5; Minor feature request: `comint-previous-matching-input-from-input' and point)
  2015-11-17  0:58       ` Juri Linkov
@ 2015-11-17 13:08         ` Stephen Perry
  2015-11-19  0:33           ` Juri Linkov
  0 siblings, 1 reply; 10+ messages in thread
From: Stephen Perry @ 2015-11-17 13:08 UTC (permalink / raw)
  To: Juri Linkov; +Cc: John Wiegley, 21737


> On 17 Nov 2015, at 00:58, Juri Linkov <juri@linkov.net> wrote:
> 
>> +(defcustom comint-move-point-to-end-on-match nil
>> +  "Controls whether point moves to the end of the matched input.
>> +If nil, then point remains in the current position.
>> +If t, point moves to the end of matched input."
>> +  :type 'boolean
>> +  :group 'comint)
>> +
>> (defvaralias 'comint-scroll-to-bottom-on-output 'comint-move-point-for-output)
>> 
>> (defcustom comint-scroll-show-maximum-output t
>> @@ -1220,7 +1227,8 @@ comint-previous-matching-input-from-input
>>     (comint-previous-matching-input
>>      (concat "^" (regexp-quote comint-matching-input-from-input-string))
>>      n)
>> -    (goto-char opoint)))
>> +    (unless comint-move-point-to-end-on-match
>> +      (goto-char opoint))))
> 
> I wonder could we use the logic of 'track-eol' here?  This means that going
> to the previous command lines starting at the end of the command line will
> keep to the ends of command lines.

It’s a trivial change to make, but I’m not sure if having it do
the same thing will be annoying for people who don’t want
track-eol turned on everywhere?






^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#21737: Acknowledgement (24.5; Minor feature request: `comint-previous-matching-input-from-input' and point)
  2015-11-17 13:08         ` Stephen Perry
@ 2015-11-19  0:33           ` Juri Linkov
  0 siblings, 0 replies; 10+ messages in thread
From: Juri Linkov @ 2015-11-19  0:33 UTC (permalink / raw)
  To: Stephen Perry; +Cc: John Wiegley, 21737

>> I wonder could we use the logic of 'track-eol' here?  This means that going
>> to the previous command lines starting at the end of the command line will
>> keep to the ends of command lines.
>
> It’s a trivial change to make, but I’m not sure if having it do
> the same thing will be annoying for people who don’t want
> track-eol turned on everywhere?

We have it working this way in navigating the minibuffer's history,
so users are already accustomed to this behavior.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#21737: Acknowledgement (24.5; Minor feature request: `comint-previous-matching-input-from-input' and point)
  2015-11-16 18:55     ` Stephen Perry
  2015-11-17  0:58       ` Juri Linkov
@ 2020-09-17 17:42       ` Lars Ingebrigtsen
  1 sibling, 0 replies; 10+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-17 17:42 UTC (permalink / raw)
  To: Stephen Perry; +Cc: John Wiegley, 21737

Stephen Perry <stevoooo@gmail.com> writes:

> +(defcustom comint-move-point-to-end-on-match nil
> +  "Controls whether point moves to the end of the matched input.
> +If nil, then point remains in the current position.
> +If t, point moves to the end of matched input."
> +  :type 'boolean
> +  :group 'comint)

It seems like this was fixed by a somewhat similar patch the year
after, so I'm closing this bug report:


commit afe2997119a5e6b108851f2e236037da1d4acef2
Author:     Philipp Stephani <phst@google.com>
AuthorDate: Thu Oct 27 00:28:34 2016 +0200

    Comint: new user option for C-c M-r and C-c M-s
    
    This option allows the user to specify where to place point after these
    commands.
    
    * comint.el (comint-move-point-for-matching-input): New user option.
    (comint-previous-matching-input-from-input): Use user option.


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-09-17 17:42 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-22 20:29 bug#21737: 24.5; Minor feature request: `comint-previous-matching-input-from-input' and point Eli Barzilay
     [not found] ` <handler.21737.B.14455457715661.ack@debbugs.gnu.org>
2015-10-22 20:42   ` bug#21737: Acknowledgement (24.5; Minor feature request: `comint-previous-matching-input-from-input' and point) Eli Barzilay
2015-10-23  6:26 ` bug#21737: 24.5; Minor feature request: `comint-previous-matching-input-from-input' and point Eli Zaretskii
2015-11-13 22:30 ` bug#21737: Acknowledgement (24.5; Minor feature request: `comint-previous-matching-input-from-input' and point) Stephen Perry
2015-11-16 16:50   ` John Wiegley
2015-11-16 18:55     ` Stephen Perry
2015-11-17  0:58       ` Juri Linkov
2015-11-17 13:08         ` Stephen Perry
2015-11-19  0:33           ` Juri Linkov
2020-09-17 17:42       ` Lars Ingebrigtsen

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.