summaryrefslogtreecommitdiff
path: root/lisp/comint.el
diff options
context:
space:
mode:
authorJuri Linkov <juri@linkov.net>2018-02-06 23:39:00 +0200
committerJuri Linkov <juri@linkov.net>2018-02-06 23:39:00 +0200
commita710f8aa61ca73054109dc4f926d1ac6aabdd849 (patch)
tree2a1b0687a7024418a16101cd301e216e50dca8d7 /lisp/comint.el
parent03722339060c7654e839d586cd9facc69593ddce (diff)
downloademacs-a710f8aa61ca73054109dc4f926d1ac6aabdd849.tar.gz
* lisp/comint.el (comint-history-isearch-setup): Check if process is live.
Don't activate comint-history isearch when shell prompt is empty like in all *Async Shell Command* buffers. (Bug#30187)
Diffstat (limited to 'lisp/comint.el')
-rw-r--r--lisp/comint.el15
1 files changed, 11 insertions, 4 deletions
diff --git a/lisp/comint.el b/lisp/comint.el
index 8dba317099c..b4fbfc86ed9 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -1448,10 +1448,17 @@ If nil, Isearch operates on the whole comint buffer."
(defun comint-history-isearch-setup ()
"Set up a comint for using Isearch to search the input history.
Intended to be added to `isearch-mode-hook' in `comint-mode'."
- (when (or (eq comint-history-isearch t)
- (and (eq comint-history-isearch 'dwim)
- ;; Point is at command line.
- (comint-after-pmark-p)))
+ (when (and (get-buffer-process (current-buffer))
+ (or (eq comint-history-isearch t)
+ (and (eq comint-history-isearch 'dwim)
+ ;; Point is at command line.
+ (comint-after-pmark-p)
+ ;; Prompt is not empty like in Async Shell Command buffers
+ (not (eq (save-excursion
+ (goto-char (comint-line-beginning-position))
+ (forward-line 0)
+ (point))
+ (comint-line-beginning-position))))))
(setq isearch-message-prefix-add "history ")
(setq-local isearch-search-fun-function
#'comint-history-isearch-search)