diff --git a/etc/NEWS b/etc/NEWS index 8bf1da470fc..87c3950b1e3 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 f66e40b150b..82c547c9760 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)))