Function: comint-history-isearch-setup

comint-history-isearch-setup is a byte-compiled function defined in comint.el.gz.

Signature

(comint-history-isearch-setup)

Documentation

Set up a comint for using Isearch to search the input history.

Intended to be added to isearch-mode-hook in comint-mode.

Source Code

;; Defined in /usr/src/emacs/lisp/comint.el.gz
(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
         ;; 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 comint--force-history-isearch
             (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)
    (setq-local isearch-message-function
                #'comint-history-isearch-message)
    (setq-local isearch-wrap-function
                #'comint-history-isearch-wrap)
    (setq-local isearch-push-state-function
                #'comint-history-isearch-push-state)
    (setq-local isearch-lazy-count nil)
    (add-hook 'isearch-mode-end-hook #'comint-history-isearch-end nil t)))