Commit 26e1d854 authored by Stefan Monnier's avatar Stefan Monnier
Browse files

* lisp/misearch.el: Use lexical-binding

(multi-isearch-read-buffers, multi-isearch-read-files):
Replace `add-to-list` with `cl-pushnew` for use on a local variable.
parent 2db03e3e
Pipeline #10240 passed with stages
in 16 minutes and 49 seconds
;;; 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. ;; Copyright (C) 2007-2021 Free Software Foundation, Inc.
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
;;; Code: ;;; Code:
(require 'cl-lib)
;;; Search multiple buffers ;;; Search multiple buffers
;;;###autoload (add-hook 'isearch-mode-hook 'multi-isearch-setup) ;;;###autoload (add-hook 'isearch-mode-hook 'multi-isearch-setup)
...@@ -40,8 +42,7 @@ ...@@ -40,8 +42,7 @@
(defcustom multi-isearch-search t (defcustom multi-isearch-search t
"Non-nil enables searching multiple related buffers, in certain modes." "Non-nil enables searching multiple related buffers, in certain modes."
:type 'boolean :type 'boolean
:version "23.1" :version "23.1")
:group 'multi-isearch)
(defcustom multi-isearch-pause t (defcustom multi-isearch-pause t
"A choice defining where to pause the search. "A choice defining where to pause the search.
...@@ -53,8 +54,7 @@ If t, pause in all buffers that contain the search string." ...@@ -53,8 +54,7 @@ If t, pause in all buffers that contain the search string."
(const :tag "Don't pause" nil) (const :tag "Don't pause" nil)
(const :tag "Only in initial buffer" initial) (const :tag "Only in initial buffer" initial)
(const :tag "All buffers" t)) (const :tag "All buffers" t))
:version "23.1" :version "23.1")
:group 'multi-isearch)
;;;###autoload ;;;###autoload
(defvar multi-isearch-next-buffer-function nil (defvar multi-isearch-next-buffer-function nil
...@@ -119,10 +119,10 @@ Intended to be added to `isearch-mode-hook'." ...@@ -119,10 +119,10 @@ Intended to be added to `isearch-mode-hook'."
(default-value 'isearch-wrap-function) (default-value 'isearch-wrap-function)
multi-isearch-orig-push-state multi-isearch-orig-push-state
(default-value 'isearch-push-state-function)) (default-value 'isearch-push-state-function))
(setq-default isearch-search-fun-function 'multi-isearch-search-fun (setq-default isearch-search-fun-function #'multi-isearch-search-fun
isearch-wrap-function 'multi-isearch-wrap isearch-wrap-function #'multi-isearch-wrap
isearch-push-state-function 'multi-isearch-push-state) isearch-push-state-function #'multi-isearch-push-state)
(add-hook 'isearch-mode-end-hook 'multi-isearch-end))) (add-hook 'isearch-mode-end-hook #'multi-isearch-end)))
(defun multi-isearch-end () (defun multi-isearch-end ()
"Clean up the multi-buffer search after terminating isearch." "Clean up the multi-buffer search after terminating isearch."
...@@ -133,7 +133,7 @@ Intended to be added to `isearch-mode-hook'." ...@@ -133,7 +133,7 @@ Intended to be added to `isearch-mode-hook'."
(setq-default isearch-search-fun-function multi-isearch-orig-search-fun (setq-default isearch-search-fun-function multi-isearch-orig-search-fun
isearch-wrap-function multi-isearch-orig-wrap isearch-wrap-function multi-isearch-orig-wrap
isearch-push-state-function multi-isearch-orig-push-state) 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 () (defun multi-isearch-search-fun ()
"Return the proper search function, for isearch in multiple buffers." "Return the proper search function, for isearch in multiple buffers."
...@@ -238,7 +238,7 @@ set in `multi-isearch-buffers' or `multi-isearch-buffers-regexp'." ...@@ -238,7 +238,7 @@ set in `multi-isearch-buffers' or `multi-isearch-buffers-regexp'."
(while (not (string-equal (while (not (string-equal
(setq buf (read-buffer (multi-occur--prompt) nil t)) (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)) (setq ido-ignore-item-temp-list bufs))
(nreverse bufs))) (nreverse bufs)))
...@@ -322,7 +322,7 @@ Every next/previous file in the defined sequence is visited by ...@@ -322,7 +322,7 @@ Every next/previous file in the defined sequence is visited by
default-directory default-directory
default-directory)) default-directory))
default-directory)) default-directory))
(add-to-list 'files file)) (cl-pushnew file files :test #'equal))
(nreverse files))) (nreverse files)))
;; A regexp is not the same thing as a file glob - does this matter? ;; 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." ...@@ -381,7 +381,7 @@ whose file names match the specified wildcard."
(defun multi-isearch-unload-function () (defun multi-isearch-unload-function ()
"Remove autoloaded variables from `unload-function-defs-list'. "Remove autoloaded variables from `unload-function-defs-list'.
Also prevent the feature from being reloaded via `isearch-mode-hook'." 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))) (let ((defs (list (car unload-function-defs-list)))
(auto '(multi-isearch-next-buffer-function (auto '(multi-isearch-next-buffer-function
multi-isearch-next-buffer-current-function multi-isearch-next-buffer-current-function
...@@ -395,7 +395,7 @@ Also prevent the feature from being reloaded via `isearch-mode-hook'." ...@@ -395,7 +395,7 @@ Also prevent the feature from being reloaded via `isearch-mode-hook'."
;; . ;; .
nil)) nil))
(defalias 'misearch-unload-function 'multi-isearch-unload-function) (defalias 'misearch-unload-function #'multi-isearch-unload-function)
(provide 'multi-isearch) (provide 'multi-isearch)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment