emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master ba2ddad 2/2: comint-insert-previous-argument doesn'


From: Dima Kogan
Subject: [Emacs-diffs] master ba2ddad 2/2: comint-insert-previous-argument doesn't detect and ignore trailing &
Date: Mon, 18 Jun 2018 02:02:08 -0400 (EDT)

branch: master
commit ba2ddadb5378351e8003c8e172b52bfabaa27554
Author: Dima Kogan <address@hidden>
Commit: Dima Kogan <address@hidden>

    comint-insert-previous-argument doesn't detect and ignore trailing &
    
    This function is invoked in shell-mode by the user, and is meant to
    emulate what M-. does in zsh and bash: it inserts an argument from a
    previous command.  Neither zsh nor bash treat a trailing & specially:
    M-. simply inserts it if it is encountered.  Emacs DID have extra
    logic to detect and discard trailing &, but this logic was buggy, and
    a && anywhere in the sequence would confuse it.  This patch simply
    removes that logic to fix the bug and to emulate zsh and bash more
    closely
    
    * lisp/comint.el (comint-insert-previous-argument): don't detect and
      ignore trailing &
      (Bug#25271)
    * etc/NEWS: Document this.
---
 etc/NEWS       | 5 +++++
 lisp/comint.el | 3 ---
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 8bf1da4..87c3950 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -191,6 +191,11 @@ It now treats the optional 2nd argument to mean that the 
URL should be
 shown in the currently selected window.
 
 ** Comint
+*** 'comint-insert-previous-argument' no longer interprets &.
+This worked strangely in shell-mode in the presence of &&.  And omitting this
+logic makes sense since 'comint-insert-previous-argument' exists to emulate M-.
+in bash and zsh, and neither of those treat & specially.
+
 *** 'comint-insert-previous-argument' knows how to count args
 from the beginning or from the end.  This is useful because
 'comint-insert-previous-argument' exists to emulate M-. in bash and zsh; and
diff --git a/lisp/comint.el b/lisp/comint.el
index f66e40b..82c547c 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -2705,9 +2705,6 @@ is the last argument.  This command is like `M-.' in bash 
and zsh."
   (set-marker comint-insert-previous-argument-last-start-pos (point))
   ;; Insert the argument.
   (let ((input-string (comint-previous-input-string 0)))
-    (when (string-match "[ \t\n]*&" input-string)
-      ;; strip terminating '&'
-      (setq input-string (substring input-string 0 (match-beginning 0))))
     (insert (comint-arguments input-string index index)))
   ;; Make next invocation return arg from previous input
   (setq comint-input-ring-index (1+ (or comint-input-ring-index 0)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]