aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland McGrath1993-01-28 20:22:03 +0000
committerRoland McGrath1993-01-28 20:22:03 +0000
commitb5e6f936b9b76d07c5ef4831fe36da196774ef22 (patch)
treebc04ca486c2e2b3095c255c5be961b5f5308b45b
parent3def68cde89731976899606acd7c3f027bbfe26e (diff)
downloademacs-b5e6f936b9b76d07c5ef4831fe36da196774ef22.tar.gz
emacs-b5e6f936b9b76d07c5ef4831fe36da196774ef22.zip
(next-complete-history-element): Restore point after replacing the
buffer text with the appropriate history element.
-rw-r--r--lisp/simple.el21
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.")
438 (car key-and-command) 438 (car key-and-command)
439 (let ((command (cdr key-and-command))) 439 (let ((command (cdr key-and-command)))
440 (if (consp command) 440 (if (consp command)
441 (if (cdr keymap-and-completionp) 441 ;; (and ... nil) => ... turns back on the completion-oriented
442 ;; history commands which rms turned off since they seem to
443 ;; do things he doesn't like.
444 (if (and (cdr keymap-and-completionp) nil) ;XXX turned off
442 (cdr command) 445 (cdr command)
443 (car command)) 446 (car command))
444 command)))) 447 command))))
@@ -447,11 +450,8 @@ contains expressions rather than strings.")
447 (minibuffer-local-completion-map . t) 450 (minibuffer-local-completion-map . t)
448 (minibuffer-local-must-match-map . t) 451 (minibuffer-local-must-match-map . t)
449 (read-expression-map . nil)))) 452 (read-expression-map . nil))))
450 ;;; This was once set up to use the completion-oriented history commands 453 '(("\en" . (next-history-element . next-complete-history-element))
451 ;;; but I turned that off since they seem to do things I don't like. 454 ([next] . (next-history-element . next-complete-history-element))
452 ;;; - rms
453 '(("\en" . (next-history-element . next-history-element))
454 ([next] . (next-history-element . next-history-element))
455 ("\ep" . (previous-history-element . previous-history-element)) 455 ("\ep" . (previous-history-element . previous-history-element))
456 ([prior] . (previous-history-element . previous-history-element)) 456 ([prior] . (previous-history-element . previous-history-element))
457 ("\er" . previous-matching-history-element) 457 ("\er" . previous-matching-history-element)
@@ -541,8 +541,13 @@ If N is negative, find the previous or Nth previous match."
541 "\ 541 "\
542Get previous element of history which is a completion of minibuffer contents." 542Get previous element of history which is a completion of minibuffer contents."
543 (interactive "p") 543 (interactive "p")
544 (next-matching-history-element 544 (let ((point-at-start (point)))
545 (concat "^" (regexp-quote (buffer-substring (point-min) (point)))) n)) 545 (next-matching-history-element
546 (concat "^" (regexp-quote (buffer-substring (point-min) (point)))) n)
547 ;; next-matching-history-element always puts us at (point-min).
548 ;; Move to the position we were at before changing the buffer contents.
549 ;; This is still sensical, because the text before point has not changed.
550 (goto-char point-at-start)))
546 551
547(defun previous-complete-history-element (n) 552(defun previous-complete-history-element (n)
548 "Get next element of history which is a completion of minibuffer contents." 553 "Get next element of history which is a completion of minibuffer contents."