diff options
author | Roland McGrath <roland@gnu.org> | 1993-01-28 20:22:03 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 1993-01-28 20:22:03 +0000 |
commit | b5e6f936b9b76d07c5ef4831fe36da196774ef22 (patch) | |
tree | bc04ca486c2e2b3095c255c5be961b5f5308b45b /lisp/simple.el | |
parent | 3def68cde89731976899606acd7c3f027bbfe26e (diff) | |
download | emacs-b5e6f936b9b76d07c5ef4831fe36da196774ef22.tar.gz |
(next-complete-history-element): Restore point after replacing the
buffer text with the appropriate history element.
Diffstat (limited to 'lisp/simple.el')
-rw-r--r-- | lisp/simple.el | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index baff3286af6..2a47c9d54cd 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -438,7 +438,10 @@ contains expressions rather than strings.") (car key-and-command) (let ((command (cdr key-and-command))) (if (consp command) - (if (cdr keymap-and-completionp) + ;; (and ... nil) => ... turns back on the completion-oriented + ;; history commands which rms turned off since they seem to + ;; do things he doesn't like. + (if (and (cdr keymap-and-completionp) nil) ;XXX turned off (cdr command) (car command)) command)))) @@ -447,11 +450,8 @@ contains expressions rather than strings.") (minibuffer-local-completion-map . t) (minibuffer-local-must-match-map . t) (read-expression-map . nil)))) - ;;; This was once set up to use the completion-oriented history commands - ;;; but I turned that off since they seem to do things I don't like. - ;;; - rms - '(("\en" . (next-history-element . next-history-element)) - ([next] . (next-history-element . next-history-element)) + '(("\en" . (next-history-element . next-complete-history-element)) + ([next] . (next-history-element . next-complete-history-element)) ("\ep" . (previous-history-element . previous-history-element)) ([prior] . (previous-history-element . previous-history-element)) ("\er" . previous-matching-history-element) @@ -541,8 +541,13 @@ If N is negative, find the previous or Nth previous match." "\ Get previous element of history which is a completion of minibuffer contents." (interactive "p") - (next-matching-history-element - (concat "^" (regexp-quote (buffer-substring (point-min) (point)))) n)) + (let ((point-at-start (point))) + (next-matching-history-element + (concat "^" (regexp-quote (buffer-substring (point-min) (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 sensical, because the text before point has not changed. + (goto-char point-at-start))) (defun previous-complete-history-element (n) "Get next element of history which is a completion of minibuffer contents." |