-;;; 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.
;;; Code:
+(require 'cl-lib)
+
;;; Search multiple buffers
;;;###autoload (add-hook 'isearch-mode-hook 'multi-isearch-setup)
(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.
(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
(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."
(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."
(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)))
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?
(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
;; .
nil))
-(defalias 'misearch-unload-function 'multi-isearch-unload-function)
+(defalias 'misearch-unload-function #'multi-isearch-unload-function)
\f
(provide 'multi-isearch)