]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/comint.el (comint-history-isearch-setup): Check if process is live.
authorJuri Linkov <juri@linkov.net>
Tue, 6 Feb 2018 21:39:00 +0000 (23:39 +0200)
committerJuri Linkov <juri@linkov.net>
Tue, 6 Feb 2018 21:39:00 +0000 (23:39 +0200)
Don't activate comint-history isearch when shell prompt is empty
like in all *Async Shell Command* buffers. (Bug#30187)

lisp/comint.el

index 8dba317099c914979f9476191ee867f3bf7db1e3..b4fbfc86ed99c7c8f7f5232fe02aef75c5e8052a 100644 (file)
@@ -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)