From 994a51ac778826811e2d01eaf161b0745fbb0912 Mon Sep 17 00:00:00 2001 From: Dan Nicolaescu Date: Wed, 3 May 2006 21:36:20 +0000 Subject: (isearch-update-ring): Take history-delete-duplicates into consideration. Replace one arm ifs with whens. --- lisp/isearch.el | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'lisp/isearch.el') diff --git a/lisp/isearch.el b/lisp/isearch.el index 7e491c378ab..e82f47f37e4 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -832,19 +832,20 @@ NOPUSH is t and EDIT is t." "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. -- cgit v1.2.1 From f5013a353c424b0ba0c7b4417f88f1d34bba283d Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Wed, 3 May 2006 23:27:53 +0000 Subject: (isearch-update-ring): Doc fix. --- lisp/isearch.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lisp/isearch.el') diff --git a/lisp/isearch.el b/lisp/isearch.el index e82f47f37e4..69ffcdd55f6 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -830,7 +830,7 @@ NOPUSH is t and EDIT is t." (defun isearch-update-ring (string &optional regexp) "Add STRING to the beginning of the search ring. -REGEXP says which ring to use." +REGEXP if non-nil says use the regexp search ring." (if regexp (when (or (null regexp-search-ring) (not (string= string (car regexp-search-ring)))) -- cgit v1.2.1