changeset 11100:2ad1ba0ac825

(isearch-update-ring): New subroutine. (isearch-done): Use that.
author Richard M. Stallman <rms@gnu.org>
date Thu, 23 Mar 1995 02:25:55 +0000
parents 4d05376b5cb2
children 67231dca5f32
files lisp/isearch.el
diffstat 1 files changed, 21 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/isearch.el	Thu Mar 23 01:21:07 1995 +0000
+++ b/lisp/isearch.el	Thu Mar 23 02:25:55 1995 +0000
@@ -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 @@
 
   (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.