comparison lisp/simple.el @ 2681:9ebd08f578f0

(previous-matching-history-element): If minibuf is empty, use the last regexp specified a the default. (next-matching-history-element): Likewise.
author Richard M. Stallman <rms@gnu.org>
date Thu, 06 May 1993 18:54:32 +0000
parents 0931cd677ff4
children e0a9c4815584
comparison
equal deleted inserted replaced
2680:ac4af95b962f 2681:9ebd08f578f0
476 "Find the previous history element that matches REGEXP. 476 "Find the previous history element that matches REGEXP.
477 \(Previous history elements refer to earlier actions.) 477 \(Previous history elements refer to earlier actions.)
478 With prefix argument N, search for Nth previous match. 478 With prefix argument N, search for Nth previous match.
479 If N is negative, find the next or Nth next match." 479 If N is negative, find the next or Nth next match."
480 (interactive 480 (interactive
481 (let ((enable-recursive-minibuffers t) 481 (let* ((enable-recursive-minibuffers t)
482 (minibuffer-history-sexp-flag nil)) 482 (minibuffer-history-sexp-flag nil)
483 (list (read-from-minibuffer "Previous element matching (regexp): " 483 (regexp (read-from-minibuffer "Previous element matching (regexp): "
484 nil 484 nil
485 minibuffer-local-map 485 minibuffer-local-map
486 nil 486 nil
487 'minibuffer-history-search-history) 487 'minibuffer-history-search-history)))
488 ;; Use the last regexp specified, by default, if input is empty.
489 (list (if (string= regexp "")
490 (setcar minibuffer-history-search-history
491 (nth 1 minibuffer-history-search-history))
492 regexp)
488 (prefix-numeric-value current-prefix-arg)))) 493 (prefix-numeric-value current-prefix-arg))))
489 (let ((history (symbol-value minibuffer-history-variable)) 494 (let ((history (symbol-value minibuffer-history-variable))
490 prevpos 495 prevpos
491 (pos minibuffer-history-position)) 496 (pos minibuffer-history-position))
492 (while (/= n 0) 497 (while (/= n 0)
516 "Find the next history element that matches REGEXP. 521 "Find the next history element that matches REGEXP.
517 \(The next history element refers to a more recent action.) 522 \(The next history element refers to a more recent action.)
518 With prefix argument N, search for Nth next match. 523 With prefix argument N, search for Nth next match.
519 If N is negative, find the previous or Nth previous match." 524 If N is negative, find the previous or Nth previous match."
520 (interactive 525 (interactive
521 (let ((enable-recursive-minibuffers t) 526 (let* ((enable-recursive-minibuffers t)
522 (minibuffer-history-sexp-flag nil)) 527 (minibuffer-history-sexp-flag nil)
523 (list (read-from-minibuffer "Next element matching (regexp): " 528 (regexp (read-from-minibuffer "Next element matching (regexp): "
524 nil 529 nil
525 minibuffer-local-map 530 minibuffer-local-map
526 nil 531 nil
527 'minibuffer-history-search-history) 532 'minibuffer-history-search-history)))
533 ;; Use the last regexp specified, by default, if input is empty.
534 (list (if (string= regexp "")
535 (setcar minibuffer-history-search-history
536 (nth 1 minibuffer-history-search-history))
537 regexp)
528 (prefix-numeric-value current-prefix-arg)))) 538 (prefix-numeric-value current-prefix-arg))))
529 (previous-matching-history-element regexp (- n))) 539 (previous-matching-history-element regexp (- n)))
530 540
531 (defun next-history-element (n) 541 (defun next-history-element (n)
532 "Insert the next element of the minibuffer history into the minibuffer." 542 "Insert the next element of the minibuffer history into the minibuffer."