diff options
| author | Miles Bader | 2000-10-03 17:32:34 +0000 |
|---|---|---|
| committer | Miles Bader | 2000-10-03 17:32:34 +0000 |
| commit | 8dc3ba7d01dc99b9be1de4b8989950199c45fe70 (patch) | |
| tree | af6fc3262c6b3fc373946e68e8a2ad6714c22cb5 | |
| parent | 657b2c659bf14036ca9cc5c8b167b737eb995bac (diff) | |
| download | emacs-8dc3ba7d01dc99b9be1de4b8989950199c45fe70.tar.gz emacs-8dc3ba7d01dc99b9be1de4b8989950199c45fe70.zip | |
(minibuffer-temporary-goal-position):
New variable.
(next-history-element):
Try to keep the position of point in the input string constant.
| -rw-r--r-- | lisp/simple.el | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index 82b2d52f5cb..c7032941235 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -778,6 +778,8 @@ An uppercase letter in REGEXP makes the search case-sensitive." | |||
| 778 | (prefix-numeric-value current-prefix-arg)))) | 778 | (prefix-numeric-value current-prefix-arg)))) |
| 779 | (previous-matching-history-element regexp (- n))) | 779 | (previous-matching-history-element regexp (- n))) |
| 780 | 780 | ||
| 781 | (defvar minibuffer-temporary-goal-position nil) | ||
| 782 | |||
| 781 | (defun next-history-element (n) | 783 | (defun next-history-element (n) |
| 782 | "Insert the next element of the minibuffer history into the minibuffer." | 784 | "Insert the next element of the minibuffer history into the minibuffer." |
| 783 | (interactive "p") | 785 | (interactive "p") |
| @@ -794,6 +796,13 @@ An uppercase letter in REGEXP makes the search case-sensitive." | |||
| 794 | (error "End of history; no default available"))) | 796 | (error "End of history; no default available"))) |
| 795 | (if (> narg (length (symbol-value minibuffer-history-variable))) | 797 | (if (> narg (length (symbol-value minibuffer-history-variable))) |
| 796 | (error "Beginning of history; no preceding item")) | 798 | (error "Beginning of history; no preceding item")) |
| 799 | (unless (or (eq last-command 'next-history-element) | ||
| 800 | (eq last-command 'previous-history-element)) | ||
| 801 | (let ((prompt-end (field-beginning (point-max)))) | ||
| 802 | (set (make-local-variable 'minibuffer-temporary-goal-position) | ||
| 803 | (cond ((<= (point) prompt-end) prompt-end) | ||
| 804 | ((eobp) nil) | ||
| 805 | (t (point)))))) | ||
| 797 | (goto-char (point-max)) | 806 | (goto-char (point-max)) |
| 798 | (delete-field) | 807 | (delete-field) |
| 799 | (setq minibuffer-history-position narg) | 808 | (setq minibuffer-history-position narg) |
| @@ -811,7 +820,7 @@ An uppercase letter in REGEXP makes the search case-sensitive." | |||
| 811 | (let ((print-level nil)) | 820 | (let ((print-level nil)) |
| 812 | (prin1-to-string elt)) | 821 | (prin1-to-string elt)) |
| 813 | elt)) | 822 | elt)) |
| 814 | (goto-char (field-beginning))))) | 823 | (goto-char (or minibuffer-temporary-goal-position (point-max)))))) |
| 815 | 824 | ||
| 816 | (defun previous-history-element (n) | 825 | (defun previous-history-element (n) |
| 817 | "Inserts the previous element of the minibuffer history into the minibuffer." | 826 | "Inserts the previous element of the minibuffer history into the minibuffer." |