Function: eshell-backward-matching-input

eshell-backward-matching-input is an interactive and byte-compiled function defined in em-prompt.el.gz.

Signature

(eshell-backward-matching-input REGEXP ARG)

Documentation

Search backward through buffer for match for REGEXP.

Matches are searched for on lines that match eshell-prompt-regexp. With prefix argument N, search for Nth previous match. If N is negative, find the next or Nth next match.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/eshell/em-prompt.el.gz
(defun eshell-backward-matching-input (regexp arg)
  "Search backward through buffer for match for REGEXP.
Matches are searched for on lines that match `eshell-prompt-regexp'.
With prefix argument N, search for Nth previous match.
If N is negative, find the next or Nth next match."
  (interactive (eshell-regexp-arg "Backward input matching (regexp): "))
  (let* ((re (concat eshell-prompt-regexp ".*" regexp))
	 (pos (save-excursion (end-of-line (if (> arg 0) 0 1))
			      (if (re-search-backward re nil t arg)
				  (point)))))
    (if (null pos)
	(progn (message "Not found")
	       (ding))
      (goto-char pos)
      (eshell-bol))))