Function: comint-previous-matching-input-from-input
comint-previous-matching-input-from-input is an interactive and
byte-compiled function defined in comint.el.gz.
Signature
(comint-previous-matching-input-from-input N)
Documentation
Search backwards through input history for match for current input.
(Previous history elements are earlier commands.)
With prefix argument N, search for Nth previous match.
If N is negative, search forwards for the -Nth following match.
Probably introduced at or before Emacs version 20.3.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/comint.el.gz
(defun comint-previous-matching-input-from-input (n)
"Search backwards through input history for match for current input.
\(Previous history elements are earlier commands.)
With prefix argument N, search for Nth previous match.
If N is negative, search forwards for the -Nth following match."
(interactive "p" comint-mode)
(let ((opoint (point)))
(unless (memq last-command '(comint-previous-matching-input-from-input
comint-next-matching-input-from-input))
;; Starting a new search
(setq comint-matching-input-from-input-string
(buffer-substring
(or (marker-position comint-accum-marker)
(process-mark (get-buffer-process (current-buffer))))
(point))
comint-input-ring-index nil))
(comint-previous-matching-input
(concat "^" (regexp-quote comint-matching-input-from-input-string))
n t)
(when (eq comint-move-point-for-matching-input 'after-input)
(goto-char opoint))))