diff options
| -rw-r--r-- | lisp/isearch.el | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/lisp/isearch.el b/lisp/isearch.el index 79f2c5d11ce..013e4b11c32 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | ;; Author: Daniel LaLiberte <liberte@cs.uiuc.edu> | 5 | ;; Author: Daniel LaLiberte <liberte@cs.uiuc.edu> |
| 6 | 6 | ||
| 7 | ;; |$Date: 1995/03/16 23:31:39 $|$Revision: 1.84 $ | 7 | ;; |$Date: 1995/03/18 18:10:21 $|$Revision: 1.85 $ |
| 8 | 8 | ||
| 9 | ;; This file is part of GNU Emacs. | 9 | ;; This file is part of GNU Emacs. |
| 10 | 10 | ||
| @@ -588,25 +588,30 @@ is treated as a regexp. See \\[isearch-forward] for more info." | |||
| 588 | 588 | ||
| 589 | (if (and (> (length isearch-string) 0) (not nopush)) | 589 | (if (and (> (length isearch-string) 0) (not nopush)) |
| 590 | ;; Update the ring data. | 590 | ;; Update the ring data. |
| 591 | (if isearch-regexp | 591 | (isearch-update-ring isearch-string isearch-regexp)) |
| 592 | (if (or (null regexp-search-ring) | ||
| 593 | (not (string= isearch-string (car regexp-search-ring)))) | ||
| 594 | (progn | ||
| 595 | (setq regexp-search-ring | ||
| 596 | (cons isearch-string regexp-search-ring)) | ||
| 597 | (if (> (length regexp-search-ring) regexp-search-ring-max) | ||
| 598 | (setcdr (nthcdr (1- search-ring-max) regexp-search-ring) | ||
| 599 | nil)))) | ||
| 600 | (if (or (null search-ring) | ||
| 601 | (not (string= isearch-string (car search-ring)))) | ||
| 602 | (progn | ||
| 603 | (setq search-ring (cons isearch-string search-ring)) | ||
| 604 | (if (> (length search-ring) search-ring-max) | ||
| 605 | (setcdr (nthcdr (1- search-ring-max) search-ring) nil)))))) | ||
| 606 | 592 | ||
| 607 | (run-hooks 'isearch-mode-end-hook) | 593 | (run-hooks 'isearch-mode-end-hook) |
| 608 | (and (not edit) isearch-recursive-edit (exit-recursive-edit))) | 594 | (and (not edit) isearch-recursive-edit (exit-recursive-edit))) |
| 609 | 595 | ||
| 596 | (defun isearch-update-ring (string &optional regexp) | ||
| 597 | "Add STRING to the beginning of the search ring. | ||
| 598 | REGEXP says which ring to use." | ||
| 599 | (if regexp | ||
| 600 | (if (or (null regexp-search-ring) | ||
| 601 | (not (string= isearch-string (car regexp-search-ring)))) | ||
| 602 | (progn | ||
| 603 | (setq regexp-search-ring | ||
| 604 | (cons isearch-string regexp-search-ring)) | ||
| 605 | (if (> (length regexp-search-ring) regexp-search-ring-max) | ||
| 606 | (setcdr (nthcdr (1- search-ring-max) regexp-search-ring) | ||
| 607 | nil)))) | ||
| 608 | (if (or (null search-ring) | ||
| 609 | (not (string= isearch-string (car search-ring)))) | ||
| 610 | (progn | ||
| 611 | (setq search-ring (cons isearch-string search-ring)) | ||
| 612 | (if (> (length search-ring) search-ring-max) | ||
| 613 | (setcdr (nthcdr (1- search-ring-max) search-ring) nil)))))) | ||
| 614 | |||
| 610 | ;;;======================================================= | 615 | ;;;======================================================= |
| 611 | ;;; Switching buffers should first terminate isearch-mode. | 616 | ;;; Switching buffers should first terminate isearch-mode. |
| 612 | ;;; This is done quite differently for each variant of emacs. | 617 | ;;; This is done quite differently for each variant of emacs. |