diff options
| -rw-r--r-- | lisp/find-file.el | 107 |
1 files changed, 72 insertions, 35 deletions
diff --git a/lisp/find-file.el b/lisp/find-file.el index 386a4b3c199..b7e51c6f077 100644 --- a/lisp/find-file.el +++ b/lisp/find-file.el | |||
| @@ -130,37 +130,62 @@ | |||
| 130 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 130 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 131 | ;; User definable variables: | 131 | ;; User definable variables: |
| 132 | 132 | ||
| 133 | (defvar ff-pre-find-hooks nil | 133 | (defgroup ff nil |
| 134 | "*List of functions to be called before the search for the file starts.") | 134 | "Find a file corresponding to this one given a pattern." |
| 135 | 135 | :prefix "ff-" | |
| 136 | (defvar ff-pre-load-hooks nil | 136 | :group 'find-file) |
| 137 | "*List of functions to be called before the other file is loaded.") | 137 | |
| 138 | 138 | (defcustom ff-pre-find-hooks nil | |
| 139 | (defvar ff-post-load-hooks nil | 139 | "*List of functions to be called before the search for the file starts." |
| 140 | "*List of functions to be called after the other file is loaded.") | 140 | :type 'hook |
| 141 | 141 | :group 'ff) | |
| 142 | (defvar ff-not-found-hooks nil | 142 | |
| 143 | "*List of functions to be called if the other file could not be found.") | 143 | (defcustom ff-pre-load-hooks nil |
| 144 | 144 | "*List of functions to be called before the other file is loaded." | |
| 145 | (defvar ff-file-created-hooks nil | 145 | :type 'hook |
| 146 | "*List of functions to be called if the other file needs to be created.") | 146 | :group 'ff) |
| 147 | 147 | ||
| 148 | (defvar ff-case-fold-search nil | 148 | (defcustom ff-post-load-hooks nil |
| 149 | "*List of functions to be called after the other file is loaded." | ||
| 150 | :type 'hook | ||
| 151 | :group 'ff) | ||
| 152 | |||
| 153 | (defcustom ff-not-found-hooks nil | ||
| 154 | "*List of functions to be called if the other file could not be found." | ||
| 155 | :type 'hook | ||
| 156 | :group 'ff) | ||
| 157 | |||
| 158 | (defcustom ff-file-created-hooks nil | ||
| 159 | "*List of functions to be called if the other file needs to be created." | ||
| 160 | :type 'hook | ||
| 161 | :group 'ff) | ||
| 162 | |||
| 163 | (defcustom ff-case-fold-search nil | ||
| 149 | "*Non-nil means ignore cases in matches (see `case-fold-search'). | 164 | "*Non-nil means ignore cases in matches (see `case-fold-search'). |
| 150 | If you have extensions in different cases, you will want this to be nil.") | 165 | If you have extensions in different cases, you will want this to be nil." |
| 166 | :type 'boolean | ||
| 167 | :group 'ff) | ||
| 151 | 168 | ||
| 152 | (defvar ff-always-in-other-window nil | 169 | (defcustom ff-always-in-other-window nil |
| 153 | "*If non-nil, find the corresponding file in another window by default. | 170 | "*If non-nil, find the corresponding file in another window by default. |
| 154 | To override this, give an argument to `ff-find-other-file'.") | 171 | To override this, give an argument to `ff-find-other-file'." |
| 172 | :type 'boolean | ||
| 173 | :group 'ff) | ||
| 155 | 174 | ||
| 156 | (defvar ff-ignore-include nil | 175 | (defcustom ff-ignore-include nil |
| 157 | "*If non-nil, ignore `#include' lines.") | 176 | "*If non-nil, ignore `#include' lines." |
| 177 | :type 'boolean | ||
| 178 | :group 'ff) | ||
| 158 | 179 | ||
| 159 | (defvar ff-always-try-to-create t | 180 | (defcustom ff-always-try-to-create t |
| 160 | "*If non-nil, always attempt to create the other file if it was not found.") | 181 | "*If non-nil, always attempt to create the other file if it was not found." |
| 182 | :type 'boolean | ||
| 183 | :group 'ff) | ||
| 161 | 184 | ||
| 162 | (defvar ff-quiet-mode nil | 185 | (defcustom ff-quiet-mode nil |
| 163 | "*If non-nil, trace which directories are being searched.") | 186 | "*If non-nil, trace which directories are being searched." |
| 187 | :type 'boolean | ||
| 188 | :group 'ff) | ||
| 164 | 189 | ||
| 165 | (defvar ff-special-constructs | 190 | (defvar ff-special-constructs |
| 166 | '( | 191 | '( |
| @@ -181,16 +206,19 @@ To override this, give an argument to `ff-find-other-file'.") | |||
| 181 | constructs such as include files etc, and an associated method for | 206 | constructs such as include files etc, and an associated method for |
| 182 | extracting the filename from that construct.") | 207 | extracting the filename from that construct.") |
| 183 | 208 | ||
| 184 | (defvar ff-other-file-alist 'cc-other-file-alist | 209 | (defcustom ff-other-file-alist 'cc-other-file-alist |
| 185 | "*Alist of extensions to find given the current file's extension. | 210 | "*Alist of extensions to find given the current file's extension. |
| 186 | 211 | ||
| 187 | This list should contain the most used extensions before the others, | 212 | This list should contain the most used extensions before the others, |
| 188 | since the search algorithm searches sequentially through each | 213 | since the search algorithm searches sequentially through each |
| 189 | directory specified in `ff-search-directories'. If a file is not found, | 214 | directory specified in `ff-search-directories'. If a file is not found, |
| 190 | a new one is created with the first matching extension (`.cc' yields `.hh'). | 215 | a new one is created with the first matching extension (`.cc' yields `.hh'). |
| 191 | This alist should be set by the major mode.") | 216 | This alist should be set by the major mode." |
| 217 | :type '(choice (repeat (list regexp (choice (repeat string) function))) | ||
| 218 | symbol) | ||
| 219 | :group 'ff) | ||
| 192 | 220 | ||
| 193 | (defvar ff-search-directories 'cc-search-directories | 221 | (defcustom ff-search-directories 'cc-search-directories |
| 194 | "*List of directories to search for a specific file. | 222 | "*List of directories to search for a specific file. |
| 195 | 223 | ||
| 196 | Set by default to `cc-search-directories', expanded at run-time. | 224 | Set by default to `cc-search-directories', expanded at run-time. |
| @@ -210,13 +238,17 @@ not exist, it is replaced (silently) with an empty string. | |||
| 210 | 238 | ||
| 211 | The stars are *not* wildcards: they are searched for together with | 239 | The stars are *not* wildcards: they are searched for together with |
| 212 | the preceding slash. The star represents all the subdirectories except | 240 | the preceding slash. The star represents all the subdirectories except |
| 213 | `..', and each of these subdirectories will be searched in turn.") | 241 | `..', and each of these subdirectories will be searched in turn." |
| 242 | :type '(choice (repeat directory) symbol) | ||
| 243 | :group 'ff) | ||
| 214 | 244 | ||
| 215 | (defvar cc-search-directories | 245 | (defcustom cc-search-directories |
| 216 | '("." "/usr/include" "/usr/local/include/*") | 246 | '("." "/usr/include" "/usr/local/include/*") |
| 217 | "*See the description of the `ff-search-directories' variable.") | 247 | "*See the description of the `ff-search-directories' variable." |
| 248 | :type '(repeat directory) | ||
| 249 | :group 'ff) | ||
| 218 | 250 | ||
| 219 | (defvar cc-other-file-alist | 251 | (defcustom cc-other-file-alist |
| 220 | '( | 252 | '( |
| 221 | ("\\.cc$" (".hh" ".h")) | 253 | ("\\.cc$" (".hh" ".h")) |
| 222 | ("\\.hh$" (".cc" ".C")) | 254 | ("\\.hh$" (".cc" ".C")) |
| @@ -238,14 +270,19 @@ the preceding slash. The star represents all the subdirectories except | |||
| 238 | This list should contain the most used extensions before the others, | 270 | This list should contain the most used extensions before the others, |
| 239 | since the search algorithm searches sequentially through each directory | 271 | since the search algorithm searches sequentially through each directory |
| 240 | specified in `ff-search-directories'. If a file is not found, a new one | 272 | specified in `ff-search-directories'. If a file is not found, a new one |
| 241 | is created with the first matching extension (`.cc' yields `.hh').") | 273 | is created with the first matching extension (`.cc' yields `.hh')." |
| 274 | :type '(repeat (list regexp (choice (repeat string) function))) | ||
| 275 | :group 'ff) | ||
| 242 | 276 | ||
| 243 | (defvar modula2-other-file-alist | 277 | (defcustom modula2-other-file-alist |
| 244 | '( | 278 | '( |
| 245 | ("\\.mi$" (".md")) ;; Modula-2 module definition | 279 | ("\\.mi$" (".md")) ;; Modula-2 module definition |
| 246 | ("\\.md$" (".mi")) ;; and implementation. | 280 | ("\\.md$" (".mi")) ;; and implementation. |
| 247 | ) | 281 | ) |
| 248 | "*See the description for the `ff-search-directories' variable.") | 282 | "*See the description for the `ff-search-directories' variable." |
| 283 | :type '(repeat (list regexp (choice (repeat string) function))) | ||
| 284 | :group 'ff) | ||
| 285 | |||
| 249 | 286 | ||
| 250 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 287 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 251 | ;; No user definable variables beyond this point! | 288 | ;; No user definable variables beyond this point! |