diff options
author | Juri Linkov <juri@linkov.net> | 2018-02-10 23:46:13 +0200 |
---|---|---|
committer | Juri Linkov <juri@linkov.net> | 2018-02-10 23:46:13 +0200 |
commit | aaeb101d899a09e18630466c348041a172cd5d91 (patch) | |
tree | 60e9c355ac70a3f01e5b09dfa69048405ab02559 /lisp/comint.el | |
parent | 7f6153d9563cfe7753083996f59eacc9f4c694df (diff) | |
download | emacs-aaeb101d899a09e18630466c348041a172cd5d91.tar.gz |
* lisp/comint.el (comint-after-pmark-p): Check if buffer has a live process.
Return nil if not.
(comint-history-isearch-setup): Don't check if process is live.
Always check if shell prompt is empty regardless of the value
of comint-history-isearch. (Bug#30187)
Diffstat (limited to 'lisp/comint.el')
-rw-r--r-- | lisp/comint.el | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/lisp/comint.el b/lisp/comint.el index b4fbfc86ed9..3163afeff40 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -1448,17 +1448,18 @@ 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 (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)))))) + (when (and + ;; Prompt is not empty like in Async Shell Command buffers + ;; or in finished shell buffers + (not (eq (save-excursion + (goto-char (comint-line-beginning-position)) + (forward-line 0) + (point)) + (comint-line-beginning-position))) + (or (eq comint-history-isearch t) + (and (eq comint-history-isearch 'dwim) + ;; Point is at command line. + (comint-after-pmark-p)))) (setq isearch-message-prefix-add "history ") (setq-local isearch-search-fun-function #'comint-history-isearch-search) @@ -2288,8 +2289,10 @@ If this takes us past the end of the current line, don't skip at all." (defun comint-after-pmark-p () "Return t if point is after the process output marker." - (let ((pmark (process-mark (get-buffer-process (current-buffer))))) - (<= (marker-position pmark) (point)))) + (let ((process (get-buffer-process (current-buffer)))) + (when process + (let ((pmark (process-mark process))) + (<= (marker-position pmark) (point)))))) (defun comint-simple-send (proc string) "Default function for sending to PROC input STRING. |