aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorJuri Linkov2018-02-10 23:46:13 +0200
committerJuri Linkov2018-02-10 23:46:13 +0200
commitaaeb101d899a09e18630466c348041a172cd5d91 (patch)
tree60e9c355ac70a3f01e5b09dfa69048405ab02559 /lisp
parent7f6153d9563cfe7753083996f59eacc9f4c694df (diff)
downloademacs-aaeb101d899a09e18630466c348041a172cd5d91.tar.gz
emacs-aaeb101d899a09e18630466c348041a172cd5d91.zip
* 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')
-rw-r--r--lisp/comint.el29
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."
1448(defun comint-history-isearch-setup () 1448(defun comint-history-isearch-setup ()
1449 "Set up a comint for using Isearch to search the input history. 1449 "Set up a comint for using Isearch to search the input history.
1450Intended to be added to `isearch-mode-hook' in `comint-mode'." 1450Intended to be added to `isearch-mode-hook' in `comint-mode'."
1451 (when (and (get-buffer-process (current-buffer)) 1451 (when (and
1452 (or (eq comint-history-isearch t) 1452 ;; Prompt is not empty like in Async Shell Command buffers
1453 (and (eq comint-history-isearch 'dwim) 1453 ;; or in finished shell buffers
1454 ;; Point is at command line. 1454 (not (eq (save-excursion
1455 (comint-after-pmark-p) 1455 (goto-char (comint-line-beginning-position))
1456 ;; Prompt is not empty like in Async Shell Command buffers 1456 (forward-line 0)
1457 (not (eq (save-excursion 1457 (point))
1458 (goto-char (comint-line-beginning-position)) 1458 (comint-line-beginning-position)))
1459 (forward-line 0) 1459 (or (eq comint-history-isearch t)
1460 (point)) 1460 (and (eq comint-history-isearch 'dwim)
1461 (comint-line-beginning-position)))))) 1461 ;; Point is at command line.
1462 (comint-after-pmark-p))))
1462 (setq isearch-message-prefix-add "history ") 1463 (setq isearch-message-prefix-add "history ")
1463 (setq-local isearch-search-fun-function 1464 (setq-local isearch-search-fun-function
1464 #'comint-history-isearch-search) 1465 #'comint-history-isearch-search)
@@ -2288,8 +2289,10 @@ If this takes us past the end of the current line, don't skip at all."
2288 2289
2289(defun comint-after-pmark-p () 2290(defun comint-after-pmark-p ()
2290 "Return t if point is after the process output marker." 2291 "Return t if point is after the process output marker."
2291 (let ((pmark (process-mark (get-buffer-process (current-buffer))))) 2292 (let ((process (get-buffer-process (current-buffer))))
2292 (<= (marker-position pmark) (point)))) 2293 (when process
2294 (let ((pmark (process-mark process)))
2295 (<= (marker-position pmark) (point))))))
2293 2296
2294(defun comint-simple-send (proc string) 2297(defun comint-simple-send (proc string)
2295 "Default function for sending to PROC input STRING. 2298 "Default function for sending to PROC input STRING.