Function: next-complete-history-element

next-complete-history-element is an interactive and byte-compiled function defined in simple.el.gz.

Signature

(next-complete-history-element N)

Documentation

Get next history element that completes the minibuffer before the point.

The contents of the minibuffer after the point are deleted and replaced by the new completion.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/simple.el.gz
(defun next-complete-history-element (n)
  "Get next history element that completes the minibuffer before the point.
The contents of the minibuffer after the point are deleted and replaced
by the new completion."
  (interactive "p")
  (let ((point-at-start (point)))
    (next-matching-history-element
     (concat
      "^" (regexp-quote (buffer-substring (minibuffer-prompt-end) (point))))
     n)
    ;; next-matching-history-element always puts us at (point-min).
    ;; Move to the position we were at before changing the buffer contents.
    ;; This is still sensible, because the text before point has not changed.
    (goto-char point-at-start)))