changeset 70352:f98b5ff9f3ce

(isearch-update-ring): Take history-delete-duplicates into consideration. Replace one arm ifs with whens.
author Dan Nicolaescu <dann@ics.uci.edu>
date Wed, 03 May 2006 21:36:20 +0000
parents 8e55901472d6
children ecf86801649d
files lisp/ChangeLog lisp/isearch.el
diffstat 2 files changed, 19 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Wed May 03 00:17:35 2006 +0000
+++ b/lisp/ChangeLog	Wed May 03 21:36:20 2006 +0000
@@ -1,3 +1,8 @@
+2006-05-03  Dan Nicolaescu  <dann@ics.uci.edu>
+
+	* isearch.el (isearch-update-ring): Take history-delete-duplicates
+	into consideration. Replace one arm ifs with whens.
+
 2006-05-03  Nick Roberts  <nickrob@snap.net.nz>
 
 	* progmodes/gdb-ui.el (gud-watch): Let user select an expression.
--- a/lisp/isearch.el	Wed May 03 00:17:35 2006 +0000
+++ b/lisp/isearch.el	Wed May 03 21:36:20 2006 +0000
@@ -832,19 +832,20 @@
   "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= string (car regexp-search-ring))))
-	  (progn
-	    (push 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= string (car search-ring))))
-	(progn
-	  (push string search-ring)
-	  (if (> (length search-ring) search-ring-max)
-	      (setcdr (nthcdr (1- search-ring-max) search-ring) nil))))))
+      (when (or (null regexp-search-ring)
+		(not (string= string (car regexp-search-ring))))
+	(when history-delete-duplicates
+	  (setq regexp-search-ring (delete string regexp-search-ring)))
+	(push string regexp-search-ring)
+	(when (> (length regexp-search-ring) regexp-search-ring-max)
+	  (setcdr (nthcdr (1- search-ring-max) regexp-search-ring) nil)))
+    (when (or (null search-ring)
+	      (not (string= string (car search-ring))))
+      (when history-delete-duplicates
+	(setq search-ring (delete string search-ring)))
+      (push string search-ring)
+      (when (> (length search-ring) search-ring-max)
+	(setcdr (nthcdr (1- search-ring-max) search-ring) nil)))))
 
 ;; Switching buffers should first terminate isearch-mode.
 ;; ;; For Emacs 19, the frame switch event is handled.