Function: mail-hist-retrieve-and-insert
mail-hist-retrieve-and-insert is a byte-compiled function defined in
mail-hist.el.gz.
Signature
(mail-hist-retrieve-and-insert HEADER ACCESS-FUNC)
Documentation
Helper for mail-hist-previous-input and mail-hist-next-input.
Source Code
;; Defined in /usr/src/emacs/lisp/mail/mail-hist.el.gz
(defun mail-hist-retrieve-and-insert (header access-func)
"Helper for `mail-hist-previous-input' and `mail-hist-next-input'."
(setq header (downcase header))
(let* ((ring (cdr (assoc header mail-hist-header-ring-alist)))
(len (ring-length ring))
(repeat (eq last-command 'mail-hist-input-access)))
(if repeat
(setq mail-hist-access-count
(funcall access-func mail-hist-access-count len))
(setq mail-hist-access-count 0))
(if (null ring)
(progn
(ding)
(message "No history for \"%s\"." header))
(if (ring-empty-p ring)
(error "\"%s\" ring is empty" header)
(and repeat
(delete-region (car mail-hist-last-bounds)
(cdr mail-hist-last-bounds)))
(let ((start (point)))
(insert (ring-ref ring mail-hist-access-count))
(setq mail-hist-last-bounds (cons start (point)))
(setq this-command 'mail-hist-input-access)
;; Special case: when flipping through message bodies, it's
;; usually most useful for point to stay at the top. This
;; is because the unique part of a message in a thread is
;; more likely to be at the top than the bottom, as the
;; bottom is often just the same quoted history for every
;; message in the thread, differing only in indentation
;; level.
(if (string-equal header "body")
(goto-char start)))
))))