Mercurial > emacs
annotate lisp/find-file.el @ 63858:379e37eca752
(default-frame-background-mode): New internal variable.
(frame-set-background-mode): Use it.
author | Juri Linkov <juri@jurta.org> |
---|---|
date | Wed, 29 Jun 2005 20:55:15 +0000 |
parents | 185136bab53f |
children | 8c8961dafdc6 b7da78284d4c |
rev | line source |
---|---|
10491 | 1 ;;; find-file.el --- find a file corresponding to this one given a pattern |
2 | |
18127 | 3 ;; Author: Henry Guillaume <henri@tibco.com, henry@c032.aone.net.au> |
21057 | 4 ;; Maintainer: FSF |
10491 | 5 ;; Keywords: c, matching, tools |
6 | |
52650
ccb0467830b0
(ff-special-constructs): Add autoload cookie.
Andreas Schwab <schwab@suse.de>
parents:
52401
diff
changeset
|
7 ;; Copyright (C) 1994, 1995, 2002, 2003 Free Software Foundation, Inc. |
10491 | 8 |
14169 | 9 ;; This file is part of GNU Emacs. |
10491 | 10 |
14169 | 11 ;; GNU Emacs is free software; you can redistribute it and/or modify |
12 ;; it under the terms of the GNU General Public License as published by | |
13 ;; the Free Software Foundation; either version 2, or (at your option) | |
14 ;; any later version. | |
10491 | 15 |
14169 | 16 ;; GNU Emacs is distributed in the hope that it will be useful, |
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 ;; GNU General Public License for more details. | |
10491 | 20 |
14169 | 21 ;; You should have received a copy of the GNU General Public License |
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
24 ;; Boston, MA 02111-1307, USA. | |
10491 | 25 |
26 ;;; Commentary: | |
27 | |
28 ;; PURPOSE: | |
30816 | 29 ;; This package features a function called ff-find-other-file, which performs |
30 ;; the following function: | |
10491 | 31 ;; |
32 ;; When in a .c file, find the first corresponding .h file in a set | |
33 ;; of directories and display it, and vice-versa from the .h file. | |
34 ;; | |
35 ;; Many people maintain their include file in a directory separate to their | |
36 ;; src directory, and very often you may be editing a file and have a need to | |
37 ;; visit the "other file". This package searches through a set of directories | |
38 ;; to find that file. | |
39 ;; | |
40 ;; THE "OTHER FILE", or "corresponding file", generally has the same basename, | |
30816 | 41 ;; and just has a different extension as described by the ff-other-file-alist |
10491 | 42 ;; variable: |
43 ;; | |
44 ;; '(("\\.cc$" (".hh" ".h")) | |
45 ;; ("\\.hh$" (".cc" ".C" ".CC" ".cxx" ".cpp"))) | |
46 ;; | |
47 ;; If the current file has a .cc extension, ff-find-other-file will attempt | |
48 ;; to look for a .hh file, and then a .h file in some directory as described | |
49 ;; below. The mechanism here is to replace the matched part of the original | |
50 ;; filename with each of the corresponding extensions in turn. | |
51 ;; | |
52 ;; Alternatively, there are situations where the filename of the other file | |
53 ;; cannot be determined easily with regexps. For example, a .c file may | |
54 ;; have two corresponding .h files, for its public and private parts, or | |
55 ;; the filename for the .c file contains part of the pathname of the .h | |
56 ;; file, as between src/fooZap.cc and include/FOO/zap.hh. In that case, the | |
57 ;; format above can be changed to include a function to be called when the | |
58 ;; current file matches the regexp: | |
59 ;; | |
57719
018ef6100fc5
(cc-other-file-alist): Bring it in line with cc-mode's auto-mode-alist entries and use \' instead of $.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
52650
diff
changeset
|
60 ;; '(("\\.cc$" cc--function) |
10491 | 61 ;; ("\\.hh$" hh-function)) |
62 ;; | |
30816 | 63 ;; These functions must return a list consisting of the possible names of the |
64 ;; corresponding file, with or without path. There is no real need for more | |
10491 | 65 ;; than one function, and one could imagine the following value for cc-other- |
66 ;; file-alist: | |
67 ;; | |
68 ;; (setq cc-other-file-alist | |
69 ;; '(("\\.cc$" ff-cc-hh-converter) | |
70 ;; ("\\.hh$" ff-cc-hh-converter) | |
71 ;; ("\\.c$" (".h")) | |
72 ;; ("\\.h$" (".c" ".cc" ".C" ".CC" ".cxx" ".cpp")))) | |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48009
diff
changeset
|
73 ;; |
10491 | 74 ;; ff-cc-hh-converter is included at the end of this file as a reference. |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48009
diff
changeset
|
75 ;; |
10491 | 76 ;; SEARCHING is carried out in a set of directories specified by the |
77 ;; ff-search-directories variable: | |
78 ;; | |
79 ;; ("." "../../src" "../include/*" "/usr/local/*/src/*" "$PROJECT/src") | |
80 ;; | |
81 ;; This means that the corresponding file will be searched for first in | |
82 ;; the current directory, then in ../../src, then in one of the directories | |
83 ;; under ../include, and so on. The star is _not_ a general wildcard | |
84 ;; character: it just indicates that the subdirectories of this directory | |
85 ;; must each be searched in turn. Environment variables will be expanded in | |
86 ;; the ff-search-directories variable. | |
87 ;; | |
88 ;; If the point is on a #include line, the file to be #included is searched | |
89 ;; for in the same manner. This can be disabled with the ff-ignore-include | |
90 ;; variable, or by calling ff-get-other-file instead of ff-find-other-file. | |
91 ;; | |
92 ;; If the file was not found, ff-find-other-file will prompt you for where | |
93 ;; to create the new "corresponding file" (defaults to the current directory), | |
30816 | 94 ;; unless the variable ff-always-try-to-create is set to nil. |
10491 | 95 ;; |
30816 | 96 ;; GIVEN AN ARGUMENT (with the ^U prefix), ff-find-other-file will get the |
97 ;; other file in another (the other?) window (see find-file-other-window and | |
98 ;; switch-to-buffer-other-window). This can be set on a more permanent basis | |
99 ;; by setting ff-always-in-other-window to t in which case the ^U prefix will | |
10491 | 100 ;; do the opposite of what was described above. |
101 ;; | |
102 ;; THERE ARE FIVE AVAILABLE HOOKS, called in this order if non-nil: | |
103 ;; | |
47354
27533450eb3b
(ff-pre-find-hook, ff-pre-load-hook, ff-post-load-hook)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44880
diff
changeset
|
104 ;; - ff-pre-find-hook - called before the search for the other file starts |
27533450eb3b
(ff-pre-find-hook, ff-pre-load-hook, ff-post-load-hook)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44880
diff
changeset
|
105 ;; - ff-not-found-hook - called when the other file could not be found |
27533450eb3b
(ff-pre-find-hook, ff-pre-load-hook, ff-post-load-hook)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44880
diff
changeset
|
106 ;; - ff-pre-load-hook - called just before the other file is 'loaded' |
27533450eb3b
(ff-pre-find-hook, ff-pre-load-hook, ff-post-load-hook)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44880
diff
changeset
|
107 ;; - ff-file-created-hook - called when the other file is created |
27533450eb3b
(ff-pre-find-hook, ff-pre-load-hook, ff-post-load-hook)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44880
diff
changeset
|
108 ;; - ff-post-load-hook - called just after the other file is 'loaded' |
10491 | 109 ;; |
47354
27533450eb3b
(ff-pre-find-hook, ff-pre-load-hook, ff-post-load-hook)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44880
diff
changeset
|
110 ;; The *load-hook allow you to place point where you want it in the other |
30816 | 111 ;; file. |
10491 | 112 |
113 ;; CREDITS: | |
114 ;; Many thanks go to TUSC Computer Systems Pty Ltd for providing an environ- | |
115 ;; ment that made the development of this package possible. | |
116 ;; | |
117 ;; Many thanks also go to all those who provided valuable feedback throughout | |
118 ;; the development of this package: | |
119 ;; Rolf Ebert in particular, Fritz Knabe, Heddy Boubaker, Sebastian Kremer, | |
30816 | 120 ;; Vasco Lopes Paulo, Mark A. Plaksin, Robert Lang, Trevor West, Kevin |
16510
e619a826afdb
Enabled commentary for Finder.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
121 ;; Pereira, Benedict Lofstedt & Justin Vallon. |
10491 | 122 |
16510
e619a826afdb
Enabled commentary for Finder.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
123 ;;; Code: |
10491 | 124 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
125 ;; User definable variables: | |
126 | |
21087 | 127 (defgroup ff nil |
128 "Find a file corresponding to this one given a pattern." | |
129 :prefix "ff-" | |
30816 | 130 :link '(emacs-commentary-link "find-file") |
21087 | 131 :group 'find-file) |
10491 | 132 |
47354
27533450eb3b
(ff-pre-find-hook, ff-pre-load-hook, ff-post-load-hook)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44880
diff
changeset
|
133 (defcustom ff-pre-find-hook nil |
21087 | 134 "*List of functions to be called before the search for the file starts." |
135 :type 'hook | |
136 :group 'ff) | |
10491 | 137 |
47354
27533450eb3b
(ff-pre-find-hook, ff-pre-load-hook, ff-post-load-hook)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44880
diff
changeset
|
138 (defcustom ff-pre-load-hook nil |
21087 | 139 "*List of functions to be called before the other file is loaded." |
140 :type 'hook | |
141 :group 'ff) | |
10491 | 142 |
47354
27533450eb3b
(ff-pre-find-hook, ff-pre-load-hook, ff-post-load-hook)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44880
diff
changeset
|
143 (defcustom ff-post-load-hook nil |
21087 | 144 "*List of functions to be called after the other file is loaded." |
145 :type 'hook | |
146 :group 'ff) | |
10491 | 147 |
47354
27533450eb3b
(ff-pre-find-hook, ff-pre-load-hook, ff-post-load-hook)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44880
diff
changeset
|
148 (defcustom ff-not-found-hook nil |
21087 | 149 "*List of functions to be called if the other file could not be found." |
150 :type 'hook | |
151 :group 'ff) | |
10491 | 152 |
47354
27533450eb3b
(ff-pre-find-hook, ff-pre-load-hook, ff-post-load-hook)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44880
diff
changeset
|
153 (defcustom ff-file-created-hook nil |
21087 | 154 "*List of functions to be called if the other file needs to be created." |
155 :type 'hook | |
156 :group 'ff) | |
10491 | 157 |
21087 | 158 (defcustom ff-case-fold-search nil |
159 "*Non-nil means ignore cases in matches (see `case-fold-search'). | |
160 If you have extensions in different cases, you will want this to be nil." | |
161 :type 'boolean | |
162 :group 'ff) | |
10491 | 163 |
21087 | 164 (defcustom ff-always-in-other-window nil |
165 "*If non-nil, find the corresponding file in another window by default. | |
166 To override this, give an argument to `ff-find-other-file'." | |
167 :type 'boolean | |
168 :group 'ff) | |
10491 | 169 |
21087 | 170 (defcustom ff-ignore-include nil |
171 "*If non-nil, ignore `#include' lines." | |
172 :type 'boolean | |
173 :group 'ff) | |
10491 | 174 |
21087 | 175 (defcustom ff-always-try-to-create t |
176 "*If non-nil, always attempt to create the other file if it was not found." | |
177 :type 'boolean | |
178 :group 'ff) | |
179 | |
180 (defcustom ff-quiet-mode nil | |
181 "*If non-nil, trace which directories are being searched." | |
182 :type 'boolean | |
183 :group 'ff) | |
10491 | 184 |
52650
ccb0467830b0
(ff-special-constructs): Add autoload cookie.
Andreas Schwab <schwab@suse.de>
parents:
52401
diff
changeset
|
185 ;;;###autoload |
30816 | 186 (defvar ff-special-constructs |
10491 | 187 '( |
188 ;; C/C++ include, for NeXTSTEP too | |
189 ("^\#\\s *\\(include\\|import\\)\\s +[<\"]\\(.*\\)[>\"]" . | |
190 (lambda () | |
191 (setq fname (buffer-substring (match-beginning 2) (match-end 2))))) | |
192 ) | |
30816 | 193 "*A list of regular expressions for `ff-find-file'. |
63505
185136bab53f
(ff-search-directories, ff-special-constructs, ff-find-other-file): Fix spelling
Juanma Barranquero <lekktu@gmail.com>
parents:
57719
diff
changeset
|
194 Specifies how to recognize special constructs such as include files |
30816 | 195 etc. and an associated method for extracting the filename from that |
196 construct.") | |
10491 | 197 |
47860
621b10466c9a
(ff-related-file-alist): New alias.
Richard M. Stallman <rms@gnu.org>
parents:
47354
diff
changeset
|
198 (defvaralias 'ff-related-file-alist 'ff-other-file-alist) |
21087 | 199 (defcustom ff-other-file-alist 'cc-other-file-alist |
10491 | 200 "*Alist of extensions to find given the current file's extension. |
201 | |
202 This list should contain the most used extensions before the others, | |
203 since the search algorithm searches sequentially through each | |
11272 | 204 directory specified in `ff-search-directories'. If a file is not found, |
205 a new one is created with the first matching extension (`.cc' yields `.hh'). | |
21087 | 206 This alist should be set by the major mode." |
207 :type '(choice (repeat (list regexp (choice (repeat string) function))) | |
208 symbol) | |
209 :group 'ff) | |
10491 | 210 |
21087 | 211 (defcustom ff-search-directories 'cc-search-directories |
10491 | 212 "*List of directories to search for a specific file. |
213 | |
11272 | 214 Set by default to `cc-search-directories', expanded at run-time. |
10491 | 215 |
216 This list is searched through with each extension specified in | |
11272 | 217 `ff-other-file-alist' that matches this file's extension. So the |
63505
185136bab53f
(ff-search-directories, ff-special-constructs, ff-find-other-file): Fix spelling
Juanma Barranquero <lekktu@gmail.com>
parents:
57719
diff
changeset
|
218 longer the list, the longer it'll take to realize that a file |
10491 | 219 may not exist. |
220 | |
30816 | 221 A typical format is |
10491 | 222 |
16510
e619a826afdb
Enabled commentary for Finder.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
223 '(\".\" \"/usr/include\" \"$PROJECT/*/include\") |
10491 | 224 |
11272 | 225 Environment variables can be inserted between slashes (`/'). |
10491 | 226 They will be replaced by their definition. If a variable does |
11272 | 227 not exist, it is replaced (silently) with an empty string. |
10491 | 228 |
11272 | 229 The stars are *not* wildcards: they are searched for together with |
230 the preceding slash. The star represents all the subdirectories except | |
21087 | 231 `..', and each of these subdirectories will be searched in turn." |
232 :type '(choice (repeat directory) symbol) | |
233 :group 'ff) | |
10491 | 234 |
21087 | 235 (defcustom cc-search-directories |
16510
e619a826afdb
Enabled commentary for Finder.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
236 '("." "/usr/include" "/usr/local/include/*") |
21087 | 237 "*See the description of the `ff-search-directories' variable." |
238 :type '(repeat directory) | |
239 :group 'ff) | |
10491 | 240 |
21087 | 241 (defcustom cc-other-file-alist |
57719
018ef6100fc5
(cc-other-file-alist): Bring it in line with cc-mode's auto-mode-alist entries and use \' instead of $.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
52650
diff
changeset
|
242 '(("\\.cc\\'" (".hh" ".h")) |
018ef6100fc5
(cc-other-file-alist): Bring it in line with cc-mode's auto-mode-alist entries and use \' instead of $.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
52650
diff
changeset
|
243 ("\\.hh\\'" (".cc" ".C")) |
10491 | 244 |
57719
018ef6100fc5
(cc-other-file-alist): Bring it in line with cc-mode's auto-mode-alist entries and use \' instead of $.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
52650
diff
changeset
|
245 ("\\.c\\'" (".h")) |
018ef6100fc5
(cc-other-file-alist): Bring it in line with cc-mode's auto-mode-alist entries and use \' instead of $.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
52650
diff
changeset
|
246 ("\\.h\\'" (".c" ".cc" ".C" ".CC" ".cxx" ".cpp")) |
018ef6100fc5
(cc-other-file-alist): Bring it in line with cc-mode's auto-mode-alist entries and use \' instead of $.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
52650
diff
changeset
|
247 |
018ef6100fc5
(cc-other-file-alist): Bring it in line with cc-mode's auto-mode-alist entries and use \' instead of $.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
52650
diff
changeset
|
248 ("\\.C\\'" (".H" ".hh" ".h")) |
018ef6100fc5
(cc-other-file-alist): Bring it in line with cc-mode's auto-mode-alist entries and use \' instead of $.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
52650
diff
changeset
|
249 ("\\.H\\'" (".C" ".CC")) |
10491 | 250 |
57719
018ef6100fc5
(cc-other-file-alist): Bring it in line with cc-mode's auto-mode-alist entries and use \' instead of $.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
52650
diff
changeset
|
251 ("\\.CC\\'" (".HH" ".H" ".hh" ".h")) |
018ef6100fc5
(cc-other-file-alist): Bring it in line with cc-mode's auto-mode-alist entries and use \' instead of $.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
52650
diff
changeset
|
252 ("\\.HH\\'" (".CC")) |
018ef6100fc5
(cc-other-file-alist): Bring it in line with cc-mode's auto-mode-alist entries and use \' instead of $.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
52650
diff
changeset
|
253 |
018ef6100fc5
(cc-other-file-alist): Bring it in line with cc-mode's auto-mode-alist entries and use \' instead of $.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
52650
diff
changeset
|
254 ("\\.c\\+\\+\\'" (".h++" ".hh" ".h")) |
018ef6100fc5
(cc-other-file-alist): Bring it in line with cc-mode's auto-mode-alist entries and use \' instead of $.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
52650
diff
changeset
|
255 ("\\.h\\+\\+\\'" (".c++")) |
10491 | 256 |
57719
018ef6100fc5
(cc-other-file-alist): Bring it in line with cc-mode's auto-mode-alist entries and use \' instead of $.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
52650
diff
changeset
|
257 ("\\.cpp\\'" (".hpp" ".hh" ".h")) |
018ef6100fc5
(cc-other-file-alist): Bring it in line with cc-mode's auto-mode-alist entries and use \' instead of $.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
52650
diff
changeset
|
258 ("\\.hpp\\'" (".cpp")) |
10491 | 259 |
57719
018ef6100fc5
(cc-other-file-alist): Bring it in line with cc-mode's auto-mode-alist entries and use \' instead of $.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
52650
diff
changeset
|
260 ("\\.cxx\\'" (".hxx" ".hh" ".h")) |
018ef6100fc5
(cc-other-file-alist): Bring it in line with cc-mode's auto-mode-alist entries and use \' instead of $.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
52650
diff
changeset
|
261 ("\\.hxx\\'" (".cxx"))) |
10491 | 262 "*Alist of extensions to find given the current file's extension. |
263 | |
264 This list should contain the most used extensions before the others, | |
265 since the search algorithm searches sequentially through each directory | |
11272 | 266 specified in `ff-search-directories'. If a file is not found, a new one |
21087 | 267 is created with the first matching extension (`.cc' yields `.hh')." |
268 :type '(repeat (list regexp (choice (repeat string) function))) | |
269 :group 'ff) | |
10491 | 270 |
21087 | 271 (defcustom modula2-other-file-alist |
10491 | 272 '( |
273 ("\\.mi$" (".md")) ;; Modula-2 module definition | |
274 ("\\.md$" (".mi")) ;; and implementation. | |
275 ) | |
21087 | 276 "*See the description for the `ff-search-directories' variable." |
277 :type '(repeat (list regexp (choice (repeat string) function))) | |
278 :group 'ff) | |
279 | |
10491 | 280 |
281 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
282 ;; No user definable variables beyond this point! | |
283 ;; ============================================== | |
284 | |
47354
27533450eb3b
(ff-pre-find-hook, ff-pre-load-hook, ff-post-load-hook)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44880
diff
changeset
|
285 (make-variable-buffer-local 'ff-pre-find-hook) |
27533450eb3b
(ff-pre-find-hook, ff-pre-load-hook, ff-post-load-hook)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44880
diff
changeset
|
286 (make-variable-buffer-local 'ff-pre-load-hook) |
27533450eb3b
(ff-pre-find-hook, ff-pre-load-hook, ff-post-load-hook)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44880
diff
changeset
|
287 (make-variable-buffer-local 'ff-post-load-hook) |
27533450eb3b
(ff-pre-find-hook, ff-pre-load-hook, ff-post-load-hook)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44880
diff
changeset
|
288 (make-variable-buffer-local 'ff-not-found-hook) |
27533450eb3b
(ff-pre-find-hook, ff-pre-load-hook, ff-post-load-hook)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44880
diff
changeset
|
289 (make-variable-buffer-local 'ff-file-created-hook) |
10491 | 290 (make-variable-buffer-local 'ff-case-fold-search) |
291 (make-variable-buffer-local 'ff-always-in-other-window) | |
292 (make-variable-buffer-local 'ff-ignore-include) | |
293 (make-variable-buffer-local 'ff-quiet-mode) | |
294 (make-variable-buffer-local 'ff-other-file-alist) | |
295 (make-variable-buffer-local 'ff-search-directories) | |
296 | |
297 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
298 ;; User entry points | |
299 | |
300 ;;;###autoload | |
301 (defun ff-get-other-file (&optional in-other-window) | |
11272 | 302 "Find the header or source file corresponding to this file. |
30816 | 303 See also the documentation for `ff-find-other-file'. |
10491 | 304 |
11272 | 305 If optional IN-OTHER-WINDOW is non-nil, find the file in another window." |
10491 | 306 (interactive "P") |
307 (let ((ignore ff-ignore-include)) | |
308 (setq ff-ignore-include t) | |
309 (ff-find-the-other-file in-other-window) | |
310 (setq ff-ignore-include ignore))) | |
311 | |
48009
8b3977d58df6
(ff-find-related-file): Fix autoload cookie.
Richard M. Stallman <rms@gnu.org>
parents:
47860
diff
changeset
|
312 ;;;###autoload |
47860
621b10466c9a
(ff-related-file-alist): New alias.
Richard M. Stallman <rms@gnu.org>
parents:
47354
diff
changeset
|
313 (defalias 'ff-find-related-file 'ff-find-other-file) |
621b10466c9a
(ff-related-file-alist): New alias.
Richard M. Stallman <rms@gnu.org>
parents:
47354
diff
changeset
|
314 |
10491 | 315 ;;;###autoload |
316 (defun ff-find-other-file (&optional in-other-window ignore-include) | |
11272 | 317 "Find the header or source file corresponding to this file. |
318 Being on a `#include' line pulls in that file. | |
10491 | 319 |
11272 | 320 If optional IN-OTHER-WINDOW is non-nil, find the file in the other window. |
321 If optional IGNORE-INCLUDE is non-nil, ignore being on `#include' lines. | |
10491 | 322 |
323 Variables of interest include: | |
324 | |
30816 | 325 - `ff-case-fold-search' |
326 Non-nil means ignore cases in matches (see `case-fold-search'). | |
10491 | 327 If you have extensions in different cases, you will want this to be nil. |
328 | |
30816 | 329 - `ff-always-in-other-window' |
10491 | 330 If non-nil, always open the other file in another window, unless an |
30816 | 331 argument is given to `ff-find-other-file'. |
10491 | 332 |
30816 | 333 - `ff-ignore-include' |
10491 | 334 If non-nil, ignores #include lines. |
335 | |
30816 | 336 - `ff-always-try-to-create' |
10491 | 337 If non-nil, always attempt to create the other file if it was not found. |
338 | |
30816 | 339 - `ff-quiet-mode' |
10491 | 340 If non-nil, traces which directories are being searched. |
341 | |
30816 | 342 - `ff-special-constructs' |
63505
185136bab53f
(ff-search-directories, ff-special-constructs, ff-find-other-file): Fix spelling
Juanma Barranquero <lekktu@gmail.com>
parents:
57719
diff
changeset
|
343 A list of regular expressions specifying how to recognize special |
30816 | 344 constructs such as include files etc, and an associated method for |
10491 | 345 extracting the filename from that construct. |
346 | |
30816 | 347 - `ff-other-file-alist' |
10491 | 348 Alist of extensions to find given the current file's extension. |
349 | |
30816 | 350 - `ff-search-directories' |
10491 | 351 List of directories searched through with each extension specified in |
30816 | 352 `ff-other-file-alist' that matches this file's extension. |
10491 | 353 |
47354
27533450eb3b
(ff-pre-find-hook, ff-pre-load-hook, ff-post-load-hook)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44880
diff
changeset
|
354 - `ff-pre-find-hook' |
10491 | 355 List of functions to be called before the search for the file starts. |
356 | |
47354
27533450eb3b
(ff-pre-find-hook, ff-pre-load-hook, ff-post-load-hook)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44880
diff
changeset
|
357 - `ff-pre-load-hook' |
10491 | 358 List of functions to be called before the other file is loaded. |
359 | |
47354
27533450eb3b
(ff-pre-find-hook, ff-pre-load-hook, ff-post-load-hook)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44880
diff
changeset
|
360 - `ff-post-load-hook' |
10491 | 361 List of functions to be called after the other file is loaded. |
362 | |
47354
27533450eb3b
(ff-pre-find-hook, ff-pre-load-hook, ff-post-load-hook)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44880
diff
changeset
|
363 - `ff-not-found-hook' |
10491 | 364 List of functions to be called if the other file could not be found. |
365 | |
47354
27533450eb3b
(ff-pre-find-hook, ff-pre-load-hook, ff-post-load-hook)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44880
diff
changeset
|
366 - `ff-file-created-hook' |
10491 | 367 List of functions to be called if the other file has been created." |
368 (interactive "P") | |
369 (let ((ignore ff-ignore-include)) | |
370 (setq ff-ignore-include ignore-include) | |
371 (ff-find-the-other-file in-other-window) | |
372 (setq ff-ignore-include ignore))) | |
373 | |
374 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
375 ;; Support functions | |
376 | |
377 (defun ff-find-the-other-file (&optional in-other-window) | |
11272 | 378 "Find the header or source file corresponding to the current file. |
379 Being on a `#include' line pulls in that file, but see the help on | |
380 the `ff-ignore-include' variable. | |
10491 | 381 |
11272 | 382 If optional IN-OTHER-WINDOW is non-nil, find the file in another window." |
10491 | 383 |
384 (let (match ;; matching regexp for this file | |
385 suffixes ;; set of replacing regexps for the matching regexp | |
386 action ;; function to generate the names of the other files | |
387 fname ;; basename of this file | |
388 pos ;; where we start matching filenames | |
389 stub ;; name of the file without extension | |
390 alist ;; working copy of the list of file extensions | |
391 pathname ;; the pathname of the file or the #include line | |
392 default-name ;; file we should create if none found | |
30816 | 393 format ;; what we have to match |
394 found ;; name of the file or buffer found - nil if none | |
10491 | 395 dirs ;; local value of ff-search-directories |
396 no-match) ;; whether we know about this kind of file | |
397 | |
47354
27533450eb3b
(ff-pre-find-hook, ff-pre-load-hook, ff-post-load-hook)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44880
diff
changeset
|
398 (run-hooks 'ff-pre-find-hook 'ff-pre-find-hooks) |
10491 | 399 |
400 (message "Working...") | |
401 | |
402 (setq dirs | |
403 (if (symbolp ff-search-directories) | |
404 (ff-list-replace-env-vars (symbol-value ff-search-directories)) | |
405 (ff-list-replace-env-vars ff-search-directories))) | |
406 | |
407 (save-excursion | |
408 (beginning-of-line 1) | |
409 (setq fname (ff-treat-as-special))) | |
410 | |
411 (cond | |
412 ((and (not ff-ignore-include) fname) | |
413 (setq default-name fname) | |
414 (setq found (ff-get-file dirs fname nil in-other-window))) | |
415 | |
416 ;; let's just get the corresponding file | |
417 (t | |
418 (setq alist (if (symbolp ff-other-file-alist) | |
419 (symbol-value ff-other-file-alist) | |
420 ff-other-file-alist) | |
421 pathname (if (buffer-file-name) | |
422 (buffer-file-name) | |
423 "/none.none")) | |
424 | |
38273
910cd30b1586
(ff-find-the-other-file): Use file-name-nondirectory
Eli Zaretskii <eliz@gnu.org>
parents:
30816
diff
changeset
|
425 (setq fname (file-name-nondirectory pathname) |
10491 | 426 no-match nil |
427 match (car alist)) | |
428 | |
429 ;; find the table entry corresponding to this file | |
430 (setq pos (ff-string-match (car match) fname)) | |
431 (while (and match (if (and pos (>= pos 0)) nil (not pos))) | |
432 (setq alist (cdr alist)) | |
433 (setq match (car alist)) | |
434 (setq pos (ff-string-match (car match) fname))) | |
435 | |
436 ;; no point going on if we haven't found anything | |
437 (if (not match) | |
438 (setq no-match t) | |
439 | |
440 ;; otherwise, suffixes contains what we need | |
441 (setq suffixes (car (cdr match)) | |
442 action (car (cdr match)) | |
443 found nil) | |
444 | |
30816 | 445 ;; if we have a function to generate new names, |
10491 | 446 ;; invoke it with the name of the current file |
447 (if (and (atom action) (fboundp action)) | |
448 (progn | |
449 (setq suffixes (funcall action (buffer-file-name)) | |
450 match (cons (car match) (list suffixes)) | |
451 stub nil | |
452 default-name (car suffixes))) | |
453 | |
454 ;; otherwise build our filename stub | |
30816 | 455 (cond |
10491 | 456 |
457 ;; get around the problem that 0 and nil both mean false! | |
458 ((= pos 0) | |
459 (setq format "") | |
460 (setq stub "") | |
461 ) | |
462 | |
463 (t | |
464 (setq format (concat "\\(.+\\)" (car match))) | |
465 (string-match format fname) | |
466 (setq stub (substring fname (match-beginning 1) (match-end 1))) | |
467 )) | |
468 | |
469 ;; if we find nothing, we should try to get a file like this one | |
470 (setq default-name | |
471 (concat stub (car (car (cdr match)))))) | |
472 | |
473 ;; do the real work - find the file | |
30816 | 474 (setq found |
10491 | 475 (ff-get-file dirs |
476 stub | |
30816 | 477 suffixes |
10491 | 478 in-other-window))))) |
479 | |
480 (cond | |
481 (no-match ;; could not even determine the other file | |
482 (message "")) | |
483 | |
30816 | 484 (t |
10491 | 485 (cond |
486 | |
487 ((not found) ;; could not find the other file | |
488 | |
47354
27533450eb3b
(ff-pre-find-hook, ff-pre-load-hook, ff-post-load-hook)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44880
diff
changeset
|
489 (run-hooks 'ff-not-found-hook 'ff-not-found-hooks) |
10491 | 490 |
30816 | 491 (cond |
10491 | 492 (ff-always-try-to-create ;; try to create the file |
493 (let (name pathname) | |
494 | |
495 (setq name | |
496 (expand-file-name | |
497 (read-file-name | |
498 (format "Find or create %s in: " default-name) | |
499 default-directory default-name nil))) | |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48009
diff
changeset
|
500 |
10491 | 501 (setq pathname |
502 (if (file-directory-p name) | |
503 (concat (file-name-as-directory name) default-name) | |
504 (setq found name))) | |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48009
diff
changeset
|
505 |
10491 | 506 (ff-find-file pathname in-other-window t))) |
507 | |
508 (t ;; don't create the file, just whinge | |
17548 | 509 (message "No file found for %s" fname)))) |
10491 | 510 |
511 (t ;; matching file found | |
512 nil)))) | |
513 | |
514 found)) ;; return buffer-name or filename | |
515 | |
42097
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
516 (defun ff-other-file-name () |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
517 "Return name of the header or source file corresponding to the current file. |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
518 Being on a `#include' line pulls in that file, but see the help on |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
519 the `ff-ignore-include' variable." |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
520 |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
521 (let (match ;; matching regexp for this file |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
522 suffixes ;; set of replacing regexps for the matching regexp |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
523 action ;; function to generate the names of the other files |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
524 fname ;; basename of this file |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
525 pos ;; where we start matching filenames |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
526 stub ;; name of the file without extension |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
527 alist ;; working copy of the list of file extensions |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
528 pathname ;; the pathname of the file or the #include line |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
529 default-name ;; file we should create if none found |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
530 format ;; what we have to match |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
531 found ;; name of the file or buffer found - nil if none |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
532 dirs ;; local value of ff-search-directories |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
533 no-match) ;; whether we know about this kind of file |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
534 |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
535 (message "Working...") |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
536 |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
537 (setq dirs |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
538 (if (symbolp ff-search-directories) |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
539 (ff-list-replace-env-vars (symbol-value ff-search-directories)) |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
540 (ff-list-replace-env-vars ff-search-directories))) |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
541 |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
542 (save-excursion |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
543 (beginning-of-line 1) |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
544 (setq fname (ff-treat-as-special))) |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
545 |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
546 (cond |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
547 ((and (not ff-ignore-include) fname) |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
548 (setq default-name fname) |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
549 (setq found (ff-get-file-name dirs fname nil))) |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
550 |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
551 ;; let's just get the corresponding file |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
552 (t |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
553 (setq alist (if (symbolp ff-other-file-alist) |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
554 (symbol-value ff-other-file-alist) |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
555 ff-other-file-alist) |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
556 pathname (if (buffer-file-name) |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
557 (buffer-file-name) |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
558 "/none.none")) |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
559 |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
560 (setq fname (file-name-nondirectory pathname) |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
561 no-match nil |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
562 match (car alist)) |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
563 |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
564 ;; find the table entry corresponding to this file |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
565 (setq pos (ff-string-match (car match) fname)) |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
566 (while (and match (if (and pos (>= pos 0)) nil (not pos))) |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
567 (setq alist (cdr alist)) |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
568 (setq match (car alist)) |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
569 (setq pos (ff-string-match (car match) fname))) |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
570 |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
571 ;; no point going on if we haven't found anything |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
572 (if (not match) |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
573 (setq no-match t) |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
574 |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
575 ;; otherwise, suffixes contains what we need |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
576 (setq suffixes (car (cdr match)) |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
577 action (car (cdr match)) |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
578 found nil) |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
579 |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
580 ;; if we have a function to generate new names, |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
581 ;; invoke it with the name of the current file |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
582 (if (and (atom action) (fboundp action)) |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
583 (progn |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
584 (setq suffixes (funcall action (buffer-file-name)) |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
585 match (cons (car match) (list suffixes)) |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
586 stub nil |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
587 default-name (car suffixes))) |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
588 |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
589 ;; otherwise build our filename stub |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
590 (cond |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
591 |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
592 ;; get around the problem that 0 and nil both mean false! |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
593 ((= pos 0) |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
594 (setq format "") |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
595 (setq stub "") |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
596 ) |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
597 |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
598 (t |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
599 (setq format (concat "\\(.+\\)" (car match))) |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
600 (string-match format fname) |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
601 (setq stub (substring fname (match-beginning 1) (match-end 1))) |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
602 )) |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
603 |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
604 ;; if we find nothing, we should try to get a file like this one |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
605 (setq default-name |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
606 (concat stub (car (car (cdr match)))))) |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
607 |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
608 ;; do the real work - find the file |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
609 (setq found |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
610 (ff-get-file-name dirs stub suffixes))))) |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
611 found)) ;; return buffer-name or filename |
e12d545c9a48
(ff-other-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38273
diff
changeset
|
612 |
30816 | 613 (defun ff-get-file (search-dirs filename &optional suffix-list other-window) |
614 "Find a file in the SEARCH-DIRS with the given FILENAME (or filename stub). | |
615 If (optional) SUFFIX-LIST is nil, search for fname, otherwise search | |
616 for fname with each of the given suffixes. Get the file or the buffer | |
617 corresponding to the name of the first file found, or nil." | |
618 (let ((filename (ff-get-file-name search-dirs filename suffix-list))) | |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48009
diff
changeset
|
619 |
30816 | 620 (cond |
10491 | 621 ((not filename) |
622 nil) | |
623 | |
13896 | 624 ((bufferp (get-file-buffer filename)) |
625 (ff-switch-to-buffer (get-file-buffer filename) other-window) | |
10491 | 626 filename) |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48009
diff
changeset
|
627 |
10491 | 628 ((file-exists-p filename) |
629 (ff-find-file filename other-window nil) | |
630 filename) | |
631 | |
632 (t | |
633 nil)))) | |
634 | |
635 (defun ff-get-file-name (search-dirs fname-stub &optional suffix-list) | |
30816 | 636 "Find a file in SEARCH-DIRS with the given name (or stub) FNAME-STUB. |
637 If (optional) SUFFIX-LIST is nil, search for FNAME-STUB, otherwise | |
638 search for FNAME-STUB with each of the given suffixes. Return the | |
639 name of the first file found." | |
10491 | 640 (let* (dirs ;; working copy of dirs to search |
641 dir ;; the current dir considered | |
642 file ;; filename being looked for | |
643 rest ;; pathname after first /* | |
644 this-suffix ;; the suffix we are currently considering | |
645 suffixes ;; working copy of suffix-list | |
646 filename ;; built filename | |
647 blist ;; list of live buffers | |
648 buf ;; current buffer in blist | |
649 found) ;; whether we have found anything | |
650 | |
651 (setq suffixes suffix-list) | |
652 | |
653 ;; suffixes is nil => fname-stub is the file we are looking for | |
654 ;; otherwise fname-stub is a stub, and we append a suffix | |
655 (if suffixes | |
656 (setq this-suffix (car suffixes)) | |
657 (setq this-suffix "") | |
658 (setq suffixes (list ""))) | |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48009
diff
changeset
|
659 |
10491 | 660 ;; find whether the file is in a buffer first |
661 (while (and suffixes (not found)) | |
662 (setq filename (concat fname-stub this-suffix)) | |
663 | |
664 (if (not ff-quiet-mode) | |
17548 | 665 (message "Finding buffer %s..." filename)) |
10491 | 666 |
17548 | 667 (if (bufferp (get-file-buffer filename)) |
668 (setq found (buffer-file-name (get-file-buffer filename)))) | |
10491 | 669 |
670 (setq blist (buffer-list)) | |
671 (setq buf (buffer-name (car blist))) | |
672 (while (and blist (not found)) | |
673 | |
674 (if (string-match (concat filename "<[0-9]+>") buf) | |
16510
e619a826afdb
Enabled commentary for Finder.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
675 (setq found (buffer-file-name (car blist)))) |
10491 | 676 |
677 (setq blist (cdr blist)) | |
678 (setq buf (buffer-name (car blist)))) | |
679 | |
680 (setq suffixes (cdr suffixes)) | |
681 (setq this-suffix (car suffixes))) | |
682 | |
683 ;; now look for the real file | |
684 (setq dirs search-dirs) | |
685 (setq dir (car dirs)) | |
686 (while (and (not found) dirs) | |
687 | |
688 (setq suffixes suffix-list) | |
689 | |
690 ;; if dir does not contain '/*', look for the file | |
691 (if (and dir (not (string-match "\\([^*]*\\)/\\\*\\(/.*\\)*" dir))) | |
30816 | 692 (progn |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48009
diff
changeset
|
693 |
10491 | 694 ;; suffixes is nil => fname-stub is the file we are looking for |
695 ;; otherwise fname-stub is a stub, and we append a suffix | |
696 (if suffixes | |
697 (setq this-suffix (car suffixes)) | |
698 (setq this-suffix "") | |
699 (setq suffixes (list ""))) | |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48009
diff
changeset
|
700 |
10491 | 701 (while (and suffixes (not found)) |
702 | |
703 (setq filename (concat fname-stub this-suffix)) | |
704 (setq file (concat dir "/" filename)) | |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48009
diff
changeset
|
705 |
10491 | 706 (if (not ff-quiet-mode) |
17548 | 707 (message "Finding %s..." file)) |
10491 | 708 |
709 (if (file-exists-p file) | |
710 (setq found file)) | |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48009
diff
changeset
|
711 |
10491 | 712 (setq suffixes (cdr suffixes)) |
713 (setq this-suffix (car suffixes)))) | |
714 | |
715 ;; otherwise dir matches the '/*', so search each dir separately | |
716 (progn | |
717 (if (match-beginning 2) | |
718 (setq rest (substring dir (match-beginning 2) (match-end 2))) | |
719 (setq rest "") | |
720 ) | |
721 (setq dir (substring dir (match-beginning 1) (match-end 1))) | |
722 | |
723 (let ((dirlist (ff-all-dirs-under dir '(".."))) | |
724 this-dir compl-dirs) | |
725 | |
726 (setq this-dir (car dirlist)) | |
727 (while dirlist | |
728 (setq compl-dirs | |
729 (append | |
730 compl-dirs | |
731 (list (concat this-dir rest)) | |
732 )) | |
733 (setq dirlist (cdr dirlist)) | |
734 (setq this-dir (car dirlist))) | |
735 | |
736 (if compl-dirs | |
737 (setq found (ff-get-file-name compl-dirs | |
738 fname-stub | |
739 suffix-list)))))) | |
740 (setq dirs (cdr dirs)) | |
741 (setq dir (car dirs))) | |
742 | |
743 (if found | |
744 (message "%s found" found)) | |
745 | |
746 found)) | |
747 | |
748 (defun ff-string-match (regexp string &optional start) | |
13896 | 749 "Like `string-match', but set `case-fold-search' temporarily. |
11272 | 750 The value used comes from `ff-case-fold-search'." |
751 (let ((case-fold-search ff-case-fold-search)) | |
10491 | 752 (if regexp |
11272 | 753 (string-match regexp string start)))) |
10491 | 754 |
755 (defun ff-list-replace-env-vars (search-list) | |
756 "Replace environment variables (of the form $VARIABLE) in SEARCH-LIST." | |
757 (let (list | |
758 (var (car search-list))) | |
759 (while search-list | |
760 (if (string-match "\\(.*\\)\\$[({]*\\([a-zA-Z0-9_]+\\)[)}]*\\(.*\\)" var) | |
761 (setq var | |
762 (concat | |
763 (substring var (match-beginning 1) (match-end 1)) | |
764 (getenv (substring var (match-beginning 2) (match-end 2))) | |
765 (substring var (match-beginning 3) (match-end 3))))) | |
766 (setq search-list (cdr search-list)) | |
767 (setq list (cons var list)) | |
768 (setq var (car search-list))) | |
769 (setq search-list (reverse list)))) | |
770 | |
771 (defun ff-treat-as-special () | |
30816 | 772 "Return the file to look for if the construct was special, else nil. |
13896 | 773 The construct is defined in the variable `ff-special-constructs'." |
10491 | 774 (let* (fname |
775 (list ff-special-constructs) | |
776 (elem (car list)) | |
777 (regexp (car elem)) | |
778 (match (cdr elem))) | |
779 (while (and list (not fname)) | |
780 (if (and (looking-at regexp) match) | |
781 (setq fname (funcall match))) | |
782 (setq list (cdr list)) | |
783 (setq elem (car list)) | |
784 (setq regexp (car elem)) | |
785 (setq match (cdr elem))) | |
786 fname)) | |
787 | |
788 (defun ff-basename (string) | |
30816 | 789 "Return the basename of pathname STRING." |
10491 | 790 (setq string (concat "/" string)) |
791 (string-match ".*/\\([^/]+\\)$" string) | |
792 (setq string (substring string (match-beginning 1) (match-end 1)))) | |
793 | |
794 (defun ff-all-dirs-under (here &optional exclude) | |
11272 | 795 "Get all the directory files under directory HERE. |
10491 | 796 Exclude all files in the optional EXCLUDE list." |
797 (if (file-directory-p here) | |
798 (condition-case nil | |
799 (progn | |
800 (let ((files (directory-files here t)) | |
801 (dirlist (list)) | |
802 file) | |
803 (while files | |
804 (setq file (car files)) | |
805 (if (and | |
806 (file-directory-p file) | |
807 (not (member (ff-basename file) exclude))) | |
808 (setq dirlist (cons file dirlist))) | |
809 (setq files (cdr files))) | |
810 (setq dirlist (reverse dirlist)))) | |
811 (error nil)) | |
812 nil)) | |
813 | |
814 (defun ff-switch-file (f1 f2 file &optional in-other-window new-file) | |
11272 | 815 "Call F1 or F2 on FILE, according to IN-OTHER-WINDOW. |
816 In addition, this runs various hooks. | |
10491 | 817 |
11272 | 818 Either F1 or F2 receives FILE as the sole argument. |
819 The decision of which one to call is based on IN-OTHER-WINDOW | |
820 and on the global variable `ff-always-in-other-window'. | |
10491 | 821 |
11272 | 822 F1 and F2 are typically `find-file' / `find-file-other-window' |
823 or `switch-to-buffer' / `switch-to-buffer-other-window' function pairs. | |
824 | |
47354
27533450eb3b
(ff-pre-find-hook, ff-pre-load-hook, ff-post-load-hook)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44880
diff
changeset
|
825 If optional NEW-FILE is t, then a special hook (`ff-file-created-hook') is |
27533450eb3b
(ff-pre-find-hook, ff-pre-load-hook, ff-post-load-hook)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44880
diff
changeset
|
826 called before `ff-post-load-hook'." |
27533450eb3b
(ff-pre-find-hook, ff-pre-load-hook, ff-post-load-hook)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44880
diff
changeset
|
827 (run-hooks 'ff-pre-load-hook 'ff-pre-load-hooks) |
10491 | 828 (if (or |
829 (and in-other-window (not ff-always-in-other-window)) | |
830 (and (not in-other-window) ff-always-in-other-window)) | |
831 (funcall f2 file) | |
832 (funcall f1 file)) | |
833 (if new-file | |
47354
27533450eb3b
(ff-pre-find-hook, ff-pre-load-hook, ff-post-load-hook)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44880
diff
changeset
|
834 (run-hooks 'ff-file-created-hook 'ff-file-created-hooks)) |
27533450eb3b
(ff-pre-find-hook, ff-pre-load-hook, ff-post-load-hook)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44880
diff
changeset
|
835 (run-hooks 'ff-post-load-hook 'ff-post-load-hooks)) |
10491 | 836 |
837 (defun ff-find-file (file &optional in-other-window new-file) | |
13896 | 838 "Like `find-file', but may show the file in another window." |
30816 | 839 (ff-switch-file 'find-file |
840 'find-file-other-window | |
10491 | 841 file in-other-window new-file)) |
842 | |
13896 | 843 (defun ff-switch-to-buffer (buffer-or-name &optional in-other-window) |
844 "Like `switch-to-buffer', but may show the buffer in another window." | |
10491 | 845 |
30816 | 846 (ff-switch-file 'switch-to-buffer |
847 'switch-to-buffer-other-window | |
13896 | 848 buffer-or-name in-other-window nil)) |
10491 | 849 |
22192
bf83c23f3300
(ff-emacs-19, ff-xemacs): Functions deleted.
Richard M. Stallman <rms@gnu.org>
parents:
21087
diff
changeset
|
850 ;;;###autoload |
bf83c23f3300
(ff-emacs-19, ff-xemacs): Functions deleted.
Richard M. Stallman <rms@gnu.org>
parents:
21087
diff
changeset
|
851 (defun ff-mouse-find-other-file (event) |
bf83c23f3300
(ff-emacs-19, ff-xemacs): Functions deleted.
Richard M. Stallman <rms@gnu.org>
parents:
21087
diff
changeset
|
852 "Visit the file you click on." |
bf83c23f3300
(ff-emacs-19, ff-xemacs): Functions deleted.
Richard M. Stallman <rms@gnu.org>
parents:
21087
diff
changeset
|
853 (interactive "e") |
bf83c23f3300
(ff-emacs-19, ff-xemacs): Functions deleted.
Richard M. Stallman <rms@gnu.org>
parents:
21087
diff
changeset
|
854 (save-excursion |
30816 | 855 (mouse-set-point event) |
22192
bf83c23f3300
(ff-emacs-19, ff-xemacs): Functions deleted.
Richard M. Stallman <rms@gnu.org>
parents:
21087
diff
changeset
|
856 (ff-find-other-file nil))) |
10491 | 857 |
22192
bf83c23f3300
(ff-emacs-19, ff-xemacs): Functions deleted.
Richard M. Stallman <rms@gnu.org>
parents:
21087
diff
changeset
|
858 ;;;###autoload |
bf83c23f3300
(ff-emacs-19, ff-xemacs): Functions deleted.
Richard M. Stallman <rms@gnu.org>
parents:
21087
diff
changeset
|
859 (defun ff-mouse-find-other-file-other-window (event) |
30816 | 860 "Visit the file you click on in another window." |
22192
bf83c23f3300
(ff-emacs-19, ff-xemacs): Functions deleted.
Richard M. Stallman <rms@gnu.org>
parents:
21087
diff
changeset
|
861 (interactive "e") |
bf83c23f3300
(ff-emacs-19, ff-xemacs): Functions deleted.
Richard M. Stallman <rms@gnu.org>
parents:
21087
diff
changeset
|
862 (save-excursion |
30816 | 863 (mouse-set-point event) |
22192
bf83c23f3300
(ff-emacs-19, ff-xemacs): Functions deleted.
Richard M. Stallman <rms@gnu.org>
parents:
21087
diff
changeset
|
864 (ff-find-other-file t))) |
10491 | 865 |
866 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
867 ;; This section offers an example of user defined function to select files | |
868 | |
11272 | 869 (defun ff-upcase-p (string &optional start end) |
30816 | 870 "Return t if STRING is all uppercase. |
11272 | 871 Given START and/or END, checks between these characters." |
10491 | 872 (let (match str) |
873 (if (not start) | |
874 (setq start 0)) | |
875 (if (not end) | |
876 (setq end (length string))) | |
877 (if (= start end) | |
878 (setq end (1+ end))) | |
879 (setq str (substring string start end)) | |
30816 | 880 (if (and |
10491 | 881 (ff-string-match "[A-Z]+" str) |
882 (setq match (match-data)) | |
883 (= (car match) 0) | |
884 (= (car (cdr match)) (length str))) | |
885 t | |
886 nil))) | |
887 | |
888 (defun ff-cc-hh-converter (arg) | |
11272 | 889 "Discriminate file extensions. |
890 Build up a new file list based possibly on part of the directory name | |
891 and the name of the file passed in." | |
10491 | 892 (ff-string-match "\\(.*\\)/\\([^/]+\\)/\\([^.]+\\).\\([^/]+\\)$" arg) |
30816 | 893 (let ((path (if (match-beginning 1) |
10491 | 894 (substring arg (match-beginning 1) (match-end 1)) nil)) |
30816 | 895 (dire (if (match-beginning 2) |
10491 | 896 (substring arg (match-beginning 2) (match-end 2)) nil)) |
30816 | 897 (file (if (match-beginning 3) |
10491 | 898 (substring arg (match-beginning 3) (match-end 3)) nil)) |
30816 | 899 (extn (if (match-beginning 4) |
10491 | 900 (substring arg (match-beginning 4) (match-end 4)) nil)) |
901 return-list) | |
902 (cond | |
903 ;; fooZapJunk.cc => ZapJunk.{hh,h} or fooZapJunk.{hh,h} | |
30816 | 904 ((and (string= extn "cc") |
10491 | 905 (ff-string-match "^\\([a-z]+\\)\\([A-Z].+\\)$" file)) |
906 (let ((stub (substring file (match-beginning 2) (match-end 2)))) | |
907 (setq dire (upcase (substring file (match-beginning 1) (match-end 1)))) | |
908 (setq return-list (list (concat stub ".hh") | |
909 (concat stub ".h") | |
910 (concat file ".hh") | |
911 (concat file ".h"))) | |
912 )) | |
913 ;; FOO/ZapJunk.hh => fooZapJunk.{cc,C} or ZapJunk.{cc,C} | |
11272 | 914 ((and (string= extn "hh") (ff-upcase-p dire) file) |
10491 | 915 (let ((stub (concat (downcase dire) file))) |
30816 | 916 (setq return-list (list (concat stub ".cc") |
10491 | 917 (concat stub ".C") |
918 (concat file ".cc") | |
919 (concat file ".C"))) | |
920 )) | |
921 ;; zap.cc => zap.hh or zap.h | |
922 ((string= extn "cc") | |
923 (let ((stub file)) | |
924 (setq return-list (list (concat stub ".hh") | |
925 (concat stub ".h"))) | |
926 )) | |
927 ;; zap.hh => zap.cc or zap.C | |
928 ((string= extn "hh") | |
929 (let ((stub file)) | |
930 (setq return-list (list (concat stub ".cc") | |
931 (concat stub ".C"))) | |
932 )) | |
30816 | 933 (t |
10491 | 934 nil)) |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48009
diff
changeset
|
935 |
10491 | 936 return-list)) |
937 | |
938 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
939 ;; This section offers an example of user defined function to place point. | |
940 ;; The regexps are Ada specific. | |
941 | |
942 (defvar ff-function-name nil "Name of the function we are in.") | |
943 | |
47354
27533450eb3b
(ff-pre-find-hook, ff-pre-load-hook, ff-post-load-hook)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44880
diff
changeset
|
944 ;; bind with (setq ff-pre-load-hook 'ff-which-function-are-we-in) |
10491 | 945 ;; |
946 (defun ff-which-function-are-we-in () | |
11272 | 947 "Return the name of the function whose definition/declaration point is in. |
948 Also remember that name in `ff-function-name'." | |
10491 | 949 |
950 (setq ff-function-name nil) | |
951 | |
952 (save-excursion | |
953 (if (re-search-backward ada-procedure-start-regexp nil t) | |
954 (setq ff-function-name (buffer-substring (match-beginning 0) | |
955 (match-end 0))) | |
956 ; we didn't find a procedure start, perhaps there is a package | |
957 (if (re-search-backward ada-package-start-regexp nil t) | |
958 (setq ff-function-name (buffer-substring (match-beginning 0) | |
959 (match-end 0))) | |
960 )))) | |
961 | |
47354
27533450eb3b
(ff-pre-find-hook, ff-pre-load-hook, ff-post-load-hook)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44880
diff
changeset
|
962 ;; bind with (setq ff-post-load-hook 'ff-set-point-accordingly) |
10491 | 963 ;; |
964 (defun ff-set-point-accordingly () | |
11272 | 965 "Find the function specified in `ff-function-name'. |
12567
7318536fb256
(ff-set-point-accordingly): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
11272
diff
changeset
|
966 That name was previously determined by `ff-which-function-are-we-in'." |
10491 | 967 (if ff-function-name |
968 (progn | |
969 (goto-char (point-min)) | |
970 (search-forward ff-function-name nil t)))) | |
971 | |
30816 | 972 (provide 'find-file) |
10491 | 973 |
52401 | 974 ;;; arch-tag: 5a2fc49e-3b0a-4708-9acf-fb14e471a97a |
30816 | 975 ;;; find-file.el ends here |