all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Customization option for https://debbugs.gnu.org/cgi/bugreport.cgi?bug=13404
@ 2016-10-26 22:33 Philipp Stephani
  2016-11-22 12:50 ` Philipp Stephani
  0 siblings, 1 reply; 2+ messages in thread
From: Philipp Stephani @ 2016-10-26 22:33 UTC (permalink / raw)
  To: Emacs developers


[-- Attachment #1.1: Type: text/plain, Size: 497 bytes --]

Hi,

https://debbugs.gnu.org/cgi/bugreport.cgi?bug=13404 changed the behavior
of comint-previous-matching-input-from-input to keep point after the text
entered by the user instead of moving it to the end of the line. However, I
got reports that users prefer the old behavior (moving point to the end of
the line so they can immediately append text to the inserted history
entry). So I created a new customization option to switch between the old
and the new behavior. Please take a look.

Thanks.

[-- Attachment #1.2: Type: text/html, Size: 639 bytes --]

[-- Attachment #2: 0001-Comint-new-user-option-for-C-c-M-r-and-C-c-M-s.txt --]
[-- Type: text/plain, Size: 2395 bytes --]

From 8852d0ef4e473807d33c92b25877651173c00853 Mon Sep 17 00:00:00 2001
From: Philipp Stephani <phst@google.com>
Date: Thu, 27 Oct 2016 00:28:34 +0200
Subject: [PATCH] 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.
---
 etc/NEWS       |  6 ++++++
 lisp/comint.el | 14 +++++++++++++-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/etc/NEWS b/etc/NEWS
index a160f81..269ceeb 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -279,6 +279,12 @@ whose content matches a regexp; bound to '% g'.
 
 *** Support for opening links to man pages in Man or WoMan mode.
 
+** Comint
+
+---
+*** New user option 'comint-move-point-for-matching-input' to control
+where to place point after C-c M-r and C-c M-s.
+
 ** Compilation mode
 
 ---
diff --git a/lisp/comint.el b/lisp/comint.el
index 0319eeb..65f51d1 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -283,6 +283,17 @@ comint-move-point-for-output
 		 (const others))
   :group 'comint)
 
+(defcustom comint-move-point-for-matching-input 'after-input
+  "Controls where to place point after matching input.
+\\<comint-mode-map>This influences the commands \\[comint-previous-matching-input-from-input] and \\[comint-next-matching-input-from-input].
+If `after-input', point will be positioned after the input typed
+by the user, but before the rest of the history entry that has
+been inserted.  If `end-of-line', point will be positioned at the
+end of the current logical (not visual) line after insertion."
+  :type '(radio (const :tag "Stay after input" after-input)
+                (const :tag "Move to end of line" end-of-line))
+  :group 'comint)
+
 (defvaralias 'comint-scroll-to-bottom-on-output 'comint-move-point-for-output)
 
 (defcustom comint-scroll-show-maximum-output t
@@ -1222,7 +1233,8 @@ comint-previous-matching-input-from-input
     (comint-previous-matching-input
      (concat "^" (regexp-quote comint-matching-input-from-input-string))
      n)
-    (goto-char opoint)))
+    (when (eq comint-move-point-for-matching-input 'after-input)
+      (goto-char opoint))))
 
 (defun comint-next-matching-input-from-input (n)
   "Search forwards through input history for match for current input.
-- 
2.10.1


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

* Re: Customization option for https://debbugs.gnu.org/cgi/bugreport.cgi?bug=13404
  2016-10-26 22:33 Customization option for https://debbugs.gnu.org/cgi/bugreport.cgi?bug=13404 Philipp Stephani
@ 2016-11-22 12:50 ` Philipp Stephani
  0 siblings, 0 replies; 2+ messages in thread
From: Philipp Stephani @ 2016-11-22 12:50 UTC (permalink / raw)
  To: Emacs developers

[-- Attachment #1: Type: text/plain, Size: 631 bytes --]

Philipp Stephani <p.stephani2@gmail.com> schrieb am Do., 27. Okt. 2016 um
00:33 Uhr:

> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=13404 changed the behavior
> of comint-previous-matching-input-from-input to keep point after the text
> entered by the user instead of moving it to the end of the line. However, I
> got reports that users prefer the old behavior (moving point to the end of
> the line so they can immediately append text to the inserted history
> entry). So I created a new customization option to switch between the old
> and the new behavior. Please take a look.
>

Nobody complained, so I pushed it to master.

[-- Attachment #2: Type: text/html, Size: 1082 bytes --]

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

end of thread, other threads:[~2016-11-22 12:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-26 22:33 Customization option for https://debbugs.gnu.org/cgi/bugreport.cgi?bug=13404 Philipp Stephani
2016-11-22 12:50 ` Philipp Stephani

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.