Mercurial > emacs
changeset 32105:f80262435e6c
(minibuffer-temporary-goal-position):
New variable.
(next-history-element):
Try to keep the position of point in the input string constant.
author | Miles Bader <miles@gnu.org> |
---|---|
date | Tue, 03 Oct 2000 17:32:34 +0000 |
parents | d40f5543b08b |
children | d559924db6ba |
files | lisp/simple.el |
diffstat | 1 files changed, 10 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/simple.el Tue Oct 03 16:13:36 2000 +0000 +++ b/lisp/simple.el Tue Oct 03 17:32:34 2000 +0000 @@ -778,6 +778,8 @@ (prefix-numeric-value current-prefix-arg)))) (previous-matching-history-element regexp (- n))) +(defvar minibuffer-temporary-goal-position nil) + (defun next-history-element (n) "Insert the next element of the minibuffer history into the minibuffer." (interactive "p") @@ -794,6 +796,13 @@ (error "End of history; no default available"))) (if (> narg (length (symbol-value minibuffer-history-variable))) (error "Beginning of history; no preceding item")) + (unless (or (eq last-command 'next-history-element) + (eq last-command 'previous-history-element)) + (let ((prompt-end (field-beginning (point-max)))) + (set (make-local-variable 'minibuffer-temporary-goal-position) + (cond ((<= (point) prompt-end) prompt-end) + ((eobp) nil) + (t (point)))))) (goto-char (point-max)) (delete-field) (setq minibuffer-history-position narg) @@ -811,7 +820,7 @@ (let ((print-level nil)) (prin1-to-string elt)) elt)) - (goto-char (field-beginning))))) + (goto-char (or minibuffer-temporary-goal-position (point-max)))))) (defun previous-history-element (n) "Inserts the previous element of the minibuffer history into the minibuffer."