Function: term-backward-matching-input

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

Signature

(term-backward-matching-input REGEXP N)

Documentation

Search backward through buffer for match for REGEXP.

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