summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1995-03-23 02:25:55 +0000
committerRichard M. Stallman <rms@gnu.org>1995-03-23 02:25:55 +0000
commit2a67bff15e1a638cfdf13ffa3cfd01aed6598ae8 (patch)
tree1fc2bd71a81706f25cc32173c3508b3a97b1312a
parenta77cfc19a9b4dfc6583d6e98c009ce5a5dc011c9 (diff)
downloademacs-2a67bff15e1a638cfdf13ffa3cfd01aed6598ae8.tar.gz
(isearch-update-ring): New subroutine.
(isearch-done): Use that.
-rw-r--r--lisp/isearch.el37
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 @@
;; Author: Daniel LaLiberte <liberte@cs.uiuc.edu>
-;; |$Date: 1995/03/16 23:31:39 $|$Revision: 1.84 $
+;; |$Date: 1995/03/18 18:10:21 $|$Revision: 1.85 $
;; This file is part of GNU Emacs.
@@ -588,25 +588,30 @@ is treated as a regexp. See \\[isearch-forward] for more info."
(if (and (> (length isearch-string) 0) (not nopush))
;; Update the ring data.
- (if isearch-regexp
- (if (or (null regexp-search-ring)
- (not (string= isearch-string (car regexp-search-ring))))
- (progn
- (setq regexp-search-ring
- (cons isearch-string regexp-search-ring))
- (if (> (length regexp-search-ring) regexp-search-ring-max)
- (setcdr (nthcdr (1- search-ring-max) regexp-search-ring)
- nil))))
- (if (or (null search-ring)
- (not (string= isearch-string (car search-ring))))
- (progn
- (setq search-ring (cons isearch-string search-ring))
- (if (> (length search-ring) search-ring-max)
- (setcdr (nthcdr (1- search-ring-max) search-ring) nil))))))
+ (isearch-update-ring isearch-string isearch-regexp))
(run-hooks 'isearch-mode-end-hook)
(and (not edit) isearch-recursive-edit (exit-recursive-edit)))
+(defun isearch-update-ring (string &optional regexp)
+ "Add STRING to the beginning of the search ring.
+REGEXP says which ring to use."
+ (if regexp
+ (if (or (null regexp-search-ring)
+ (not (string= isearch-string (car regexp-search-ring))))
+ (progn
+ (setq regexp-search-ring
+ (cons isearch-string regexp-search-ring))
+ (if (> (length regexp-search-ring) regexp-search-ring-max)
+ (setcdr (nthcdr (1- search-ring-max) regexp-search-ring)
+ nil))))
+ (if (or (null search-ring)
+ (not (string= isearch-string (car search-ring))))
+ (progn
+ (setq search-ring (cons isearch-string search-ring))
+ (if (> (length search-ring) search-ring-max)
+ (setcdr (nthcdr (1- search-ring-max) search-ring) nil))))))
+
;;;=======================================================
;;; Switching buffers should first terminate isearch-mode.
;;; This is done quite differently for each variant of emacs.