]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/misearch.el: Use lexical-binding
authorStefan Monnier <monnier@iro.umontreal.ca>
Sat, 10 Apr 2021 21:07:58 +0000 (17:07 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Sat, 10 Apr 2021 21:08:11 +0000 (17:08 -0400)
(multi-isearch-read-buffers, multi-isearch-read-files):
Replace `add-to-list` with `cl-pushnew` for use on a local variable.

lisp/misearch.el

index 668c711922ac535b2af69904c6acf2d8c4bebace..8b6238a8266c17b617bcc61dc63b8106f795ad7b 100644 (file)
@@ -1,4 +1,4 @@
-;;; misearch.el --- isearch extensions for multi-buffer search
+;;; misearch.el --- isearch extensions for multi-buffer search  -*- lexical-binding: t; -*-
 
 ;; Copyright (C) 2007-2021 Free Software Foundation, Inc.
 
@@ -28,6 +28,8 @@
 
 ;;; Code:
 
+(require 'cl-lib)
+
 ;;; Search multiple buffers
 
 ;;;###autoload (add-hook 'isearch-mode-hook 'multi-isearch-setup)
@@ -40,8 +42,7 @@
 (defcustom multi-isearch-search t
   "Non-nil enables searching multiple related buffers, in certain modes."
   :type 'boolean
-  :version "23.1"
-  :group 'multi-isearch)
+  :version "23.1")
 
 (defcustom multi-isearch-pause t
   "A choice defining where to pause the search.
@@ -53,8 +54,7 @@ If t, pause in all buffers that contain the search string."
          (const :tag "Don't pause" nil)
          (const :tag "Only in initial buffer" initial)
          (const :tag "All buffers" t))
-  :version "23.1"
-  :group 'multi-isearch)
+  :version "23.1")
 
 ;;;###autoload
 (defvar multi-isearch-next-buffer-function nil
@@ -119,10 +119,10 @@ Intended to be added to `isearch-mode-hook'."
          (default-value 'isearch-wrap-function)
          multi-isearch-orig-push-state
          (default-value 'isearch-push-state-function))
-    (setq-default isearch-search-fun-function 'multi-isearch-search-fun
-                 isearch-wrap-function       'multi-isearch-wrap
-                 isearch-push-state-function 'multi-isearch-push-state)
-    (add-hook 'isearch-mode-end-hook  'multi-isearch-end)))
+    (setq-default isearch-search-fun-function #'multi-isearch-search-fun
+                 isearch-wrap-function       #'multi-isearch-wrap
+                 isearch-push-state-function #'multi-isearch-push-state)
+    (add-hook 'isearch-mode-end-hook #'multi-isearch-end)))
 
 (defun multi-isearch-end ()
   "Clean up the multi-buffer search after terminating isearch."
@@ -133,7 +133,7 @@ Intended to be added to `isearch-mode-hook'."
   (setq-default isearch-search-fun-function multi-isearch-orig-search-fun
                isearch-wrap-function       multi-isearch-orig-wrap
                isearch-push-state-function multi-isearch-orig-push-state)
-  (remove-hook 'isearch-mode-end-hook  'multi-isearch-end))
+  (remove-hook 'isearch-mode-end-hook #'multi-isearch-end))
 
 (defun multi-isearch-search-fun ()
   "Return the proper search function, for isearch in multiple buffers."
@@ -238,7 +238,7 @@ set in `multi-isearch-buffers' or `multi-isearch-buffers-regexp'."
     (while (not (string-equal
                 (setq buf (read-buffer (multi-occur--prompt) nil t))
                 ""))
-      (add-to-list 'bufs buf)
+      (cl-pushnew buf bufs)
       (setq ido-ignore-item-temp-list bufs))
     (nreverse bufs)))
 
@@ -322,7 +322,7 @@ Every next/previous file in the defined sequence is visited by
                             default-directory
                             default-directory))
                 default-directory))
-      (add-to-list 'files file))
+      (cl-pushnew file files :test #'equal))
     (nreverse files)))
 
 ;; A regexp is not the same thing as a file glob - does this matter?
@@ -381,7 +381,7 @@ whose file names match the specified wildcard."
 (defun multi-isearch-unload-function ()
   "Remove autoloaded variables from `unload-function-defs-list'.
 Also prevent the feature from being reloaded via `isearch-mode-hook'."
-  (remove-hook 'isearch-mode-hook 'multi-isearch-setup)
+  (remove-hook 'isearch-mode-hook #'multi-isearch-setup)
   (let ((defs (list (car unload-function-defs-list)))
        (auto '(multi-isearch-next-buffer-function
                multi-isearch-next-buffer-current-function
@@ -395,7 +395,7 @@ Also prevent the feature from being reloaded via `isearch-mode-hook'."
     ;; .
     nil))
 
-(defalias 'misearch-unload-function 'multi-isearch-unload-function)
+(defalias 'misearch-unload-function #'multi-isearch-unload-function)
 
 \f
 (provide 'multi-isearch)