Mercurial > emacs
annotate lisp/misearch.el @ 103179:fb77a6b5c2f6
(encoded-kbd-setup-keymap): Fix for big5.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Fri, 08 May 2009 02:24:30 +0000 |
parents | a9dc0e7c3f2b |
children | 490704d92623 |
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 |
100908 | 3 ;; Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc. |
96950
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 |
100737
ee29f2a93b76
(multi-isearch-next-buffer-function): Doc fix.
Juri Linkov <juri@jurta.org>
parents:
96950
diff
changeset
|
69 This function should return the next buffer (it doesn't need to switch |
ee29f2a93b76
(multi-isearch-next-buffer-function): Doc fix.
Juri Linkov <juri@jurta.org>
parents:
96950
diff
changeset
|
70 to it), or nil if it can't find the next buffer (when it reaches the |
ee29f2a93b76
(multi-isearch-next-buffer-function): Doc fix.
Juri Linkov <juri@jurta.org>
parents:
96950
diff
changeset
|
71 end of the search space). |
ee29f2a93b76
(multi-isearch-next-buffer-function): Doc fix.
Juri Linkov <juri@jurta.org>
parents:
96950
diff
changeset
|
72 |
96950
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
73 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
|
74 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
|
75 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
|
76 direction is backward (when `isearch-forward' is nil), this function |
100737
ee29f2a93b76
(multi-isearch-next-buffer-function): Doc fix.
Juri Linkov <juri@jurta.org>
parents:
96950
diff
changeset
|
77 should return the previous buffer to search. |
ee29f2a93b76
(multi-isearch-next-buffer-function): Doc fix.
Juri Linkov <juri@jurta.org>
parents:
96950
diff
changeset
|
78 |
ee29f2a93b76
(multi-isearch-next-buffer-function): Doc fix.
Juri Linkov <juri@jurta.org>
parents:
96950
diff
changeset
|
79 If the second argument of this function WRAP is non-nil, then it |
ee29f2a93b76
(multi-isearch-next-buffer-function): Doc fix.
Juri Linkov <juri@jurta.org>
parents:
96950
diff
changeset
|
80 should return the first buffer in the series; and for the backward |
ee29f2a93b76
(multi-isearch-next-buffer-function): Doc fix.
Juri Linkov <juri@jurta.org>
parents:
96950
diff
changeset
|
81 search, it should return the last buffer in the series.") |
96950
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
82 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
83 ;;;###autoload |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
84 (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
|
85 "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
|
86 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
|
87 Isearch starts.") |
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 ;;;###autoload |
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-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
|
91 "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
|
92 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
|
93 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
94 (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
|
95 (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
|
96 (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
|
97 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
98 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
99 ;;;###autoload |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
100 (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
|
101 "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
|
102 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
|
103 (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
|
104 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
|
105 (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
|
106 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
|
107 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
|
108 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
|
109 (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
|
110 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
|
111 (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
|
112 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
|
113 (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
|
114 (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
|
115 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
|
116 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
|
117 (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
|
118 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
119 (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
|
120 "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
|
121 (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
|
122 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
|
123 (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
|
124 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
|
125 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
|
126 (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
|
127 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
128 (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
|
129 "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
|
130 (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
|
131 (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
|
132 ;; 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
|
133 (cond |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
134 (isearch-word |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
135 (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
|
136 (isearch-regexp |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
137 (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
|
138 (t |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
139 (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
|
140 found buffer) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
141 (or |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
142 ;; 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
|
143 (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
|
144 ;; 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
|
145 (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
|
146 (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
|
147 res) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
148 ;; 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
|
149 ;; 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
|
150 ;; 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
|
151 ;; 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
|
152 (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
|
153 ;; 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
|
154 (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
|
155 (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
|
156 (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
|
157 (progn |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
158 (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
|
159 ;; 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
|
160 (setq buffer (funcall multi-isearch-next-buffer-current-function |
100737
ee29f2a93b76
(multi-isearch-next-buffer-function): Doc fix.
Juri Linkov <juri@jurta.org>
parents:
96950
diff
changeset
|
161 buffer nil)) |
96950
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
162 (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
|
163 (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
|
164 (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
|
165 ;; 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
|
166 ;; 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
|
167 ;; 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
|
168 ;; 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
|
169 (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
|
170 ;; 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
|
171 (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
|
172 ;; 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
|
173 found) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
174 ;; Return nil when multi-isearch-next-buffer-current-function fails |
100737
ee29f2a93b76
(multi-isearch-next-buffer-function): Doc fix.
Juri Linkov <juri@jurta.org>
parents:
96950
diff
changeset
|
175 ;; (`with-current-buffer' raises an error for nil returned from it). |
96950
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
176 (error nil)) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
177 (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
|
178 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
179 (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
|
180 "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
|
181 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
|
182 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
|
183 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
|
184 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
|
185 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
|
186 (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
|
187 (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
|
188 (progn |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
189 (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
|
190 (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
|
191 (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
|
192 (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
|
193 (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
|
194 (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
|
195 (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
|
196 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
197 (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
|
198 "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
|
199 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
|
200 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 `(lambda (cmd) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
202 (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
|
203 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
204 (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
|
205 "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
|
206 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
|
207 (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
|
208 (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
|
209 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
210 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
211 ;;; 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
|
212 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
213 (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
|
214 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
215 (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
|
216 "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
|
217 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
|
218 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
|
219 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
|
220 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
|
221 (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
|
222 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
|
223 (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
|
224 (if wrap |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
225 (car buffers) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
226 (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
|
227 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
228 ;;;###autoload |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
229 (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
|
230 "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
|
231 (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
|
232 '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
|
233 (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
|
234 (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
|
235 (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
|
236 (isearch-forward))) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
237 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
238 ;;;###autoload |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
239 (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
|
240 "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
|
241 (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
|
242 '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
|
243 (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
|
244 (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
|
245 (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
|
246 (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
|
247 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
248 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
249 ;;; 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
|
250 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
251 (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
|
252 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
253 (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
|
254 "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
|
255 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
|
256 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
|
257 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
|
258 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
|
259 (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
|
260 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
|
261 (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
|
262 (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
|
263 (if wrap |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
264 (car files) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
265 (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
|
266 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
267 ;;;###autoload |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
268 (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
|
269 "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
|
270 (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
|
271 '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
|
272 (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
|
273 (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
|
274 (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
|
275 (isearch-forward))) |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
276 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
277 ;;;###autoload |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
278 (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
|
279 "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
|
280 (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
|
281 '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
|
282 (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
|
283 (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
|
284 (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
|
285 (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
|
286 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
287 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
288 (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
|
289 |
2e007ba78796
Initial revision for a new file with most content from isearch-multi.el.
Juri Linkov <juri@jurta.org>
parents:
diff
changeset
|
290 ;; 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
|
291 ;;; misearch.el ends here |