Mercurial > emacs
annotate lisp/misearch.el @ 99697:4d2232791f45
(window--frame-usable-p): Consider dedicated windows as usable.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Tue, 18 Nov 2008 20:45:21 +0000 |
parents | 2e007ba78796 |
children | ee29f2a93b76 |
rev | line source |
---|---|
96950
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
1 ;;; misearch.el --- isearch extensions for multi-buffer search |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
2 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
3 ;; Copyright (C) 2007, 2008 Free Software Foundation, Inc. |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
4 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
5 ;; Author: Juri Linkov <juri@jurta.org> |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
6 ;; Keywords: matching |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
7 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
8 ;; This file is part of GNU Emacs. |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
9 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
10 ;; GNU Emacs is free software: you can redistribute it and/or modify |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
11 ;; it under the terms of the GNU General Public License as published by |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
12 ;; the Free Software Foundation, either version 3 of the License, or |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
13 ;; (at your option) any later version. |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
14 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
15 ;; GNU Emacs is distributed in the hope that it will be useful, |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
18 ;; GNU General Public License for more details. |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
19 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
20 ;; You should have received a copy of the GNU General Public License |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
22 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
23 ;;; Commentary: |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
24 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
25 ;; This file adds more dimensions to the search space. It implements |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
26 ;; various features that extend isearch. One of them is an ability to |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
27 ;; search through multiple buffers. |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
28 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
29 ;;; Code: |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
30 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
31 ;;; Search multiple buffers |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
32 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
33 ;;;###autoload (add-hook 'isearch-mode-hook 'multi-isearch-setup) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
34 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
35 (defgroup multi-isearch nil |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
36 "Using isearch to search through multiple buffers." |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
37 :version "23.1" |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
38 :group 'isearch) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
39 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
40 (defcustom multi-isearch-search t |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
41 "Non-nil enables searching multiple related buffers, in certain modes." |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
42 :type 'boolean |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
43 :version "23.1" |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
44 :group 'multi-isearch) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
45 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
46 (defcustom multi-isearch-pause t |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
47 "A choice defining where to pause the search. |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
48 If the value is nil, don't pause before going to the next buffer. |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
49 If the value is `initial', pause only after a failing search in the |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
50 initial buffer. |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
51 If t, pause in all buffers that contain the search string." |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
52 :type '(choice |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
53 (const :tag "Don't pause" nil) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
54 (const :tag "Only in initial buffer" initial) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
55 (const :tag "All buffers" t)) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
56 :version "23.1" |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
57 :group 'multi-isearch) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
58 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
59 ;;;###autoload |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
60 (defvar multi-isearch-next-buffer-function nil |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
61 "Function to call to get the next buffer to search. |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
62 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
63 When this variable is set to a function that returns a buffer, then |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
64 after typing another \\[isearch-forward] or \\[isearch-backward] \ |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
65 at a failing search, the search goes |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
66 to the next buffer in the series and continues searching for the |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
67 next occurrence. |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
68 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
69 The first argument of this function is the current buffer where the |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
70 search is currently searching. It defines the base buffer relative to |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
71 which this function should find the next buffer. When the isearch |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
72 direction is backward (when `isearch-forward' is nil), this function |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
73 should return the previous buffer to search. If the second argument of |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
74 this function WRAP is non-nil, then it should return the first buffer |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
75 in the series; and for the backward search, it should return the last |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
76 buffer in the series.") |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
77 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
78 ;;;###autoload |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
79 (defvar multi-isearch-next-buffer-current-function nil |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
80 "The currently active function to get the next buffer to search. |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
81 Initialized from `multi-isearch-next-buffer-function' when |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
82 Isearch starts.") |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
83 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
84 ;;;###autoload |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
85 (defvar multi-isearch-current-buffer nil |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
86 "The buffer where the search is currently searching. |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
87 The value is nil when the search still is in the initial buffer.") |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
88 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
89 (defvar multi-isearch-orig-search-fun nil) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
90 (defvar multi-isearch-orig-wrap nil) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
91 (defvar multi-isearch-orig-push-state nil) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
92 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
93 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
94 ;;;###autoload |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
95 (defun multi-isearch-setup () |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
96 "Set up isearch to search multiple buffers. |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
97 Intended to be added to `isearch-mode-hook'." |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
98 (when (and multi-isearch-search |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
99 multi-isearch-next-buffer-function) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
100 (setq multi-isearch-current-buffer nil |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
101 multi-isearch-next-buffer-current-function |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
102 multi-isearch-next-buffer-function |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
103 multi-isearch-orig-search-fun |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
104 (default-value 'isearch-search-fun-function) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
105 multi-isearch-orig-wrap |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
106 (default-value 'isearch-wrap-function) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
107 multi-isearch-orig-push-state |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
108 (default-value 'isearch-push-state-function)) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
109 (setq-default isearch-search-fun-function 'multi-isearch-search-fun |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
110 isearch-wrap-function 'multi-isearch-wrap |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
111 isearch-push-state-function 'multi-isearch-push-state) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
112 (add-hook 'isearch-mode-end-hook 'multi-isearch-end))) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
113 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
114 (defun multi-isearch-end () |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
115 "Clean up the multi-buffer search after terminating isearch." |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
116 (setq multi-isearch-current-buffer nil |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
117 multi-isearch-next-buffer-current-function nil) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
118 (setq-default isearch-search-fun-function multi-isearch-orig-search-fun |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
119 isearch-wrap-function multi-isearch-orig-wrap |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
120 isearch-push-state-function multi-isearch-orig-push-state) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
121 (remove-hook 'isearch-mode-end-hook 'multi-isearch-end)) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
122 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
123 (defun multi-isearch-search-fun () |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
124 "Return the proper search function, for isearch in multiple buffers." |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
125 (lambda (string bound noerror) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
126 (let ((search-fun |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
127 ;; Use standard functions to search within one buffer |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
128 (cond |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
129 (isearch-word |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
130 (if isearch-forward 'word-search-forward 'word-search-backward)) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
131 (isearch-regexp |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
132 (if isearch-forward 're-search-forward 're-search-backward)) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
133 (t |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
134 (if isearch-forward 'search-forward 'search-backward)))) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
135 found buffer) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
136 (or |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
137 ;; 1. First try searching in the initial buffer |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
138 (let ((res (funcall search-fun string bound noerror))) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
139 ;; Reset wrapping for all-buffers pause after successful search |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
140 (if (and res (eq multi-isearch-pause t)) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
141 (setq multi-isearch-current-buffer nil)) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
142 res) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
143 ;; 2. If the above search fails, start visiting next/prev buffers |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
144 ;; successively, and search the string in them. Do this only |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
145 ;; when bound is nil (i.e. not while lazy-highlighting search |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
146 ;; strings in the current buffer). |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
147 (when (and (not bound) multi-isearch-search) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
148 ;; If no-pause or there was one attempt to leave the current buffer |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
149 (if (or (null multi-isearch-pause) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
150 (and multi-isearch-pause multi-isearch-current-buffer)) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
151 (condition-case nil |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
152 (progn |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
153 (while (not found) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
154 ;; Find the next buffer to search |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
155 (setq buffer (funcall multi-isearch-next-buffer-current-function |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
156 buffer)) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
157 (with-current-buffer buffer |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
158 (goto-char (if isearch-forward (point-min) (point-max))) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
159 (setq isearch-barrier (point) isearch-opoint (point)) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
160 ;; After visiting the next/prev buffer search the |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
161 ;; string in it again, until the function in |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
162 ;; multi-isearch-next-buffer-current-function raises |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
163 ;; an error at the beginning/end of the buffer sequence. |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
164 (setq found (funcall search-fun string bound noerror)))) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
165 ;; Set buffer for isearch-search-string to switch |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
166 (if buffer (setq multi-isearch-current-buffer buffer)) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
167 ;; Return point of the new search result |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
168 found) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
169 ;; Return nil when multi-isearch-next-buffer-current-function fails |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
170 (error nil)) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
171 (signal 'search-failed (list string "Repeat for next buffer")))))))) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
172 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
173 (defun multi-isearch-wrap () |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
174 "Wrap the multiple buffers search when search is failed. |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
175 Switch buffer to the first buffer for a forward search, |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
176 or to the last buffer for a backward search. |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
177 Set `multi-isearch-current-buffer' to the current buffer to display |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
178 the isearch suffix message [initial buffer] only when isearch leaves |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
179 the initial buffer." |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
180 (if (or (null multi-isearch-pause) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
181 (and multi-isearch-pause multi-isearch-current-buffer)) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
182 (progn |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
183 (switch-to-buffer |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
184 (setq multi-isearch-current-buffer |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
185 (funcall multi-isearch-next-buffer-current-function |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
186 (current-buffer) t))) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
187 (goto-char (if isearch-forward (point-min) (point-max)))) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
188 (setq multi-isearch-current-buffer (current-buffer)) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
189 (setq isearch-wrapped nil))) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
190 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
191 (defun multi-isearch-push-state () |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
192 "Save a function restoring the state of multiple buffers search. |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
193 Save the current buffer to the additional state parameter in the |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
194 search status stack." |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
195 `(lambda (cmd) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
196 (multi-isearch-pop-state cmd ,(current-buffer)))) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
197 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
198 (defun multi-isearch-pop-state (cmd buffer) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
199 "Restore the multiple buffers search state. |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
200 Switch to the buffer restored from the search status stack." |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
201 (unless (equal buffer (current-buffer)) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
202 (switch-to-buffer (setq multi-isearch-current-buffer buffer)))) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
203 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
204 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
205 ;;; Global multi-buffer search invocations |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
206 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
207 (defvar multi-isearch-buffer-list nil) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
208 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
209 (defun multi-isearch-next-buffer-from-list (&optional buffer wrap) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
210 "Return the next buffer in the series of ChangeLog file buffers. |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
211 This function is used for multiple buffers isearch. |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
212 A sequence of buffers is formed by ChangeLog files with decreasing |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
213 numeric file name suffixes in the directory of the initial ChangeLog |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
214 file were isearch was started." |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
215 (let ((buffers (if isearch-forward |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
216 multi-isearch-buffer-list |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
217 (reverse multi-isearch-buffer-list)))) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
218 (if wrap |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
219 (car buffers) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
220 (cadr (member (or buffer (current-buffer)) buffers))))) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
221 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
222 ;;;###autoload |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
223 (defun multi-isearch-buffers (buffers) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
224 "Start multi-buffer Isearch on a list of BUFFERS." |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
225 (let ((multi-isearch-next-buffer-function |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
226 'multi-isearch-next-buffer-from-list) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
227 (multi-isearch-buffer-list buffers)) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
228 (switch-to-buffer (car buffers)) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
229 (goto-char (if isearch-forward (point-min) (point-max))) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
230 (isearch-forward))) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
231 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
232 ;;;###autoload |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
233 (defun multi-isearch-buffers-regexp (buffers) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
234 "Start multi-buffer regexp Isearch on a list of BUFFERS." |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
235 (let ((multi-isearch-next-buffer-function |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
236 'multi-isearch-next-buffer-from-list) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
237 (multi-isearch-buffer-list buffers)) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
238 (switch-to-buffer (car buffers)) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
239 (goto-char (if isearch-forward (point-min) (point-max))) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
240 (isearch-forward-regexp))) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
241 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
242 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
243 ;;; Global multi-file search invocations |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
244 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
245 (defvar multi-isearch-file-list nil) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
246 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
247 (defun multi-isearch-next-file-buffer-from-list (&optional buffer wrap) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
248 "Return the next buffer in the series of ChangeLog file buffers. |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
249 This function is used for multiple buffers isearch. |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
250 A sequence of buffers is formed by ChangeLog files with decreasing |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
251 numeric file name suffixes in the directory of the initial ChangeLog |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
252 file were isearch was started." |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
253 (let ((files (if isearch-forward |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
254 multi-isearch-file-list |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
255 (reverse multi-isearch-file-list)))) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
256 (find-file-noselect |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
257 (if wrap |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
258 (car files) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
259 (cadr (member (buffer-file-name buffer) files)))))) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
260 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
261 ;;;###autoload |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
262 (defun multi-isearch-files (files) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
263 "Start multi-buffer Isearch on a list of FILES." |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
264 (let ((multi-isearch-next-buffer-function |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
265 'multi-isearch-next-file-buffer-from-list) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
266 (multi-isearch-file-list files)) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
267 (find-file (car files)) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
268 (goto-char (if isearch-forward (point-min) (point-max))) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
269 (isearch-forward))) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
270 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
271 ;;;###autoload |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
272 (defun multi-isearch-files-regexp (files) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
273 "Start multi-buffer regexp Isearch on a list of FILES." |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
274 (let ((multi-isearch-next-buffer-function |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
275 'multi-isearch-next-file-buffer-from-list) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
276 (multi-isearch-file-list files)) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
277 (find-file (car files)) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
278 (goto-char (if isearch-forward (point-min) (point-max))) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
279 (isearch-forward-regexp))) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
280 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
281 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
282 (provide 'multi-isearch) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
283 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
284 ;; arch-tag: a6d38ffa-4d14-4e39-8ac6-46af9d6a6773 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
285 ;;; misearch.el ends here |