aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Breton2000-08-28 20:20:49 +0000
committerPeter Breton2000-08-28 20:20:49 +0000
commit24ccf4657feae78dac711acc790b0bf4f008cf2a (patch)
treec61f12e5faa653411dab55902d5e1488c2915216
parent6fa8604559c946376ee63fe3fc4ebe3480d2112d (diff)
downloademacs-24ccf4657feae78dac711acc790b0bf4f008cf2a.tar.gz
emacs-24ccf4657feae78dac711acc790b0bf4f008cf2a.zip
Added file-cache-case-fold-search and file-cache-assoc-function variables
(file-cache-minibuffer-complete): Use file-cache-assoc-function. Use file-cache-case-fold-search variable (file-cache-add-file): Use file-cache-assoc-function (file-cache-delete-file): likewise (file-cache-directory-name): likewise (file-cache-debug-read-from-minibuffer): likewise
-rw-r--r--lisp/filecache.el157
1 files changed, 92 insertions, 65 deletions
diff --git a/lisp/filecache.el b/lisp/filecache.el
index d6aa35366b2..5af516179c5 100644
--- a/lisp/filecache.el
+++ b/lisp/filecache.el
@@ -3,7 +3,7 @@
3;; Author: Peter Breton <pbreton@cs.umb.edu> 3;; Author: Peter Breton <pbreton@cs.umb.edu>
4;; Created: Sun Nov 10 1996 4;; Created: Sun Nov 10 1996
5;; Keywords: convenience 5;; Keywords: convenience
6;; Time-stamp: <1998-04-29 22:38:56 pbreton> 6;; Time-stamp: <2000-08-28 16:18:03 pbreton>
7;; 7;;
8;; Copyright (C) 1996 Free Software Foundation, Inc. 8;; Copyright (C) 1996 Free Software Foundation, Inc.
9 9
@@ -43,14 +43,14 @@
43;; ADDING FILES TO THE CACHE: 43;; ADDING FILES TO THE CACHE:
44;; 44;;
45;; Use the following functions to add items to the file cache: 45;; Use the following functions to add items to the file cache:
46;; 46;;
47;; * `file-cache-add-file': Adds a single file to the cache 47;; * `file-cache-add-file': Adds a single file to the cache
48;; 48;;
49;; * `file-cache-add-file-list': Adds a list of files to the cache 49;; * `file-cache-add-file-list': Adds a list of files to the cache
50;; 50;;
51;; The following functions use the regular expressions in 51;; The following functions use the regular expressions in
52;; `file-cache-delete-regexps' to eliminate unwanted files: 52;; `file-cache-delete-regexps' to eliminate unwanted files:
53;; 53;;
54;; * `file-cache-add-directory': Adds the files in a directory to the 54;; * `file-cache-add-directory': Adds the files in a directory to the
55;; cache. You can also specify a regular expression to match the files 55;; cache. You can also specify a regular expression to match the files
56;; which should be added. 56;; which should be added.
@@ -88,7 +88,7 @@
88;; 88;;
89;; 4) When you have found a unique completion, the minibuffer contents 89;; 4) When you have found a unique completion, the minibuffer contents
90;; will change to the full name of that file. 90;; will change to the full name of that file.
91;; 91;;
92;; If there are a number of directories which contain the completion, 92;; If there are a number of directories which contain the completion,
93;; invoking `file-cache-minibuffer-complete' repeatedly will cycle through 93;; invoking `file-cache-minibuffer-complete' repeatedly will cycle through
94;; them. 94;; them.
@@ -102,7 +102,7 @@
102;; For maximum utility, you should probably define an `eval-after-load' 102;; For maximum utility, you should probably define an `eval-after-load'
103;; form which loads your favorite files: 103;; form which loads your favorite files:
104;; 104;;
105;; (eval-after-load 105;; (eval-after-load
106;; "filecache" 106;; "filecache"
107;; '(progn 107;; '(progn
108;; (message "Loading file cache...") 108;; (message "Loading file cache...")
@@ -115,10 +115,10 @@
115;; If you clear and reload the cache frequently, it is probably easiest 115;; If you clear and reload the cache frequently, it is probably easiest
116;; to put your initializations in a function: 116;; to put your initializations in a function:
117;; 117;;
118;; (eval-after-load 118;; (eval-after-load
119;; "filecache" 119;; "filecache"
120;; '(my-file-cache-initialize)) 120;; '(my-file-cache-initialize))
121;; 121;;
122;; (defun my-file-cache-initialize () 122;; (defun my-file-cache-initialize ()
123;; (interactive) 123;; (interactive)
124;; (message "Loading file cache...") 124;; (message "Loading file cache...")
@@ -132,7 +132,7 @@
132;; Lisp functions. 132;; Lisp functions.
133;; 133;;
134;; RELATED WORK: 134;; RELATED WORK:
135;; 135;;
136;; This package is a distant relative of Noah Friedman's fff utilities. 136;; This package is a distant relative of Noah Friedman's fff utilities.
137;; Our goal is pretty similar, but the implementation strategies are 137;; Our goal is pretty similar, but the implementation strategies are
138;; different. 138;; different.
@@ -150,12 +150,12 @@
150;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 150;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
151 151
152;; User-modifiable variables 152;; User-modifiable variables
153(defcustom file-cache-filter-regexps 153(defcustom file-cache-filter-regexps
154 (list "~$" "\\.o$" "\\.exe$" "\\.a$" "\\.elc$" ",v$" "\\.output$" 154 (list "~$" "\\.o$" "\\.exe$" "\\.a$" "\\.elc$" ",v$" "\\.output$"
155 "\\.$" "#$" "\\.class$") 155 "\\.$" "#$" "\\.class$")
156 "*List of regular expressions used as filters by the file cache. 156 "*List of regular expressions used as filters by the file cache.
157File names which match these expressions will not be added to the cache. 157File names which match these expressions will not be added to the cache.
158Note that the functions `file-cache-add-file' and `file-cache-add-file-list' 158Note that the functions `file-cache-add-file' and `file-cache-add-file-list'
159do not use this variable." 159do not use this variable."
160 :type '(repeat regexp) 160 :type '(repeat regexp)
161 :group 'file-cache) 161 :group 'file-cache)
@@ -187,13 +187,37 @@ do not use this variable."
187 :type 'string 187 :type 'string
188 :group 'file-cache) 188 :group 'file-cache)
189 189
190(defcustom file-cache-completion-ignore-case completion-ignore-case 190(defcustom file-cache-completion-ignore-case
191 (if (memq system-type (list 'ms-dos 'windows-nt))
192 t
193 completion-ignore-case)
191 "If non-nil, file-cache completion should ignore case. 194 "If non-nil, file-cache completion should ignore case.
192Defaults to the value of `completion-ignore-case'." 195Defaults to the value of `completion-ignore-case'."
193 :type 'sexp 196 :type 'sexp
194 :group 'file-cache 197 :group 'file-cache
195 ) 198 )
196 199
200(defcustom file-cache-case-fold-search
201 (if (memq system-type (list 'ms-dos 'windows-nt))
202 t
203 case-fold-search)
204 "If non-nil, file-cache completion should ignore case.
205Defaults to the value of `case-fold-search'."
206 :type 'sexp
207 :group 'file-cache
208 )
209
210(defcustom file-cache-assoc-function
211 (if (memq system-type (list 'ms-dos 'windows-nt))
212 'assoc-ignore-case
213 'assoc)
214 "Function to use to check completions in the file cache.
215Defaults to `assoc-ignore-case' on DOS and Windows, and `assoc' on
216other systems."
217 :type 'sexp
218 :group 'file-cache
219 )
220
197(defvar file-cache-multiple-directory-message nil) 221(defvar file-cache-multiple-directory-message nil)
198 222
199;; Internal variables 223;; Internal variables
@@ -204,7 +228,7 @@ Defaults to the value of `completion-ignore-case'."
204 :type 'string 228 :type 'string
205 :group 'file-cache) 229 :group 'file-cache)
206 230
207(defcustom file-cache-buffer "*File Cache*" 231(defcustom file-cache-buffer "*File Cache*"
208 "Buffer to hold the cache of file names." 232 "Buffer to hold the cache of file names."
209 :type 'string 233 :type 'string
210 :group 'file-cache) 234 :group 'file-cache)
@@ -228,7 +252,7 @@ Defaults to the value of `completion-ignore-case'."
228 252
229(defun file-cache-add-directory (directory &optional regexp) 253(defun file-cache-add-directory (directory &optional regexp)
230 "Add DIRECTORY to the file cache. 254 "Add DIRECTORY to the file cache.
231If the optional REGEXP argument is non-nil, only files which match it will 255If the optional REGEXP argument is non-nil, only files which match it will
232be added to the cache." 256be added to the cache."
233 (interactive "DAdd files from directory: ") 257 (interactive "DAdd files from directory: ")
234 ;; Not an error, because otherwise we can't use load-paths that 258 ;; Not an error, because otherwise we can't use load-paths that
@@ -241,7 +265,7 @@ be added to the cache."
241 ;; Filter out files we don't want to see 265 ;; Filter out files we don't want to see
242 (mapcar 266 (mapcar
243 '(lambda (file) 267 '(lambda (file)
244 (mapcar 268 (mapcar
245 '(lambda (regexp) 269 '(lambda (regexp)
246 (if (string-match regexp file) 270 (if (string-match regexp file)
247 (setq dir-files (delq file dir-files)))) 271 (setq dir-files (delq file dir-files))))
@@ -251,11 +275,11 @@ be added to the cache."
251 275
252(defun file-cache-add-directory-list (directory-list &optional regexp) 276(defun file-cache-add-directory-list (directory-list &optional regexp)
253 "Add DIRECTORY-LIST (a list of directory names) to the file cache. 277 "Add DIRECTORY-LIST (a list of directory names) to the file cache.
254If the optional REGEXP argument is non-nil, only files which match it 278If the optional REGEXP argument is non-nil, only files which match it
255will be added to the cache. Note that the REGEXP is applied to the files 279will be added to the cache. Note that the REGEXP is applied to the files
256in each directory, not to the directory list itself." 280in each directory, not to the directory list itself."
257 (interactive "XAdd files from directory list: ") 281 (interactive "XAdd files from directory list: ")
258 (mapcar 282 (mapcar
259 '(lambda (dir) (file-cache-add-directory dir regexp)) 283 '(lambda (dir) (file-cache-add-directory dir regexp))
260 directory-list)) 284 directory-list))
261 285
@@ -272,7 +296,8 @@ in each directory, not to the directory list itself."
272 (message "File %s does not exist" file) 296 (message "File %s does not exist" file)
273 (let* ((file-name (file-name-nondirectory file)) 297 (let* ((file-name (file-name-nondirectory file))
274 (dir-name (file-name-directory file)) 298 (dir-name (file-name-directory file))
275 (the-entry (assoc file-name file-cache-alist)) 299 (the-entry (funcall file-cache-assoc-function
300 file-name file-cache-alist))
276 ) 301 )
277 ;; Does the entry exist already? 302 ;; Does the entry exist already?
278 (if the-entry 303 (if the-entry
@@ -285,10 +310,10 @@ in each directory, not to the directory list itself."
285 ) 310 )
286 ;; If not, add it to the cache 311 ;; If not, add it to the cache
287 (setq file-cache-alist 312 (setq file-cache-alist
288 (cons (cons file-name (list dir-name)) 313 (cons (cons file-name (list dir-name))
289 file-cache-alist))) 314 file-cache-alist)))
290 ))) 315 )))
291 316
292(defun file-cache-add-directory-using-find (directory) 317(defun file-cache-add-directory-using-find (directory)
293 "Use the `find' command to add files to the file cache. 318 "Use the `find' command to add files to the file cache.
294Find is run in DIRECTORY." 319Find is run in DIRECTORY."
@@ -296,10 +321,10 @@ Find is run in DIRECTORY."
296 (let ((dir (expand-file-name directory))) 321 (let ((dir (expand-file-name directory)))
297 (set-buffer (get-buffer-create file-cache-buffer)) 322 (set-buffer (get-buffer-create file-cache-buffer))
298 (erase-buffer) 323 (erase-buffer)
299 (call-process file-cache-find-command nil 324 (call-process file-cache-find-command nil
300 (get-buffer file-cache-buffer) nil 325 (get-buffer file-cache-buffer) nil
301 dir "-name" 326 dir "-name"
302 (if (memq system-type 327 (if (memq system-type
303 (list 'windows-nt 'ms-dos)) "'*'" "*") 328 (list 'windows-nt 'ms-dos)) "'*'" "*")
304 "-print") 329 "-print")
305 (file-cache-add-from-file-cache-buffer))) 330 (file-cache-add-from-file-cache-buffer)))
@@ -310,7 +335,7 @@ STRING is passed as an argument to the locate command."
310 (interactive "sAdd files using locate string: ") 335 (interactive "sAdd files using locate string: ")
311 (set-buffer (get-buffer-create file-cache-buffer)) 336 (set-buffer (get-buffer-create file-cache-buffer))
312 (erase-buffer) 337 (erase-buffer)
313 (call-process file-cache-locate-command nil 338 (call-process file-cache-locate-command nil
314 (get-buffer file-cache-buffer) nil 339 (get-buffer file-cache-buffer) nil
315 string) 340 string)
316 (file-cache-add-from-file-cache-buffer)) 341 (file-cache-add-from-file-cache-buffer))
@@ -320,7 +345,7 @@ STRING is passed as an argument to the locate command."
320Each entry matches the regular expression `file-cache-buffer-default-regexp' 345Each entry matches the regular expression `file-cache-buffer-default-regexp'
321or the optional REGEXP argument." 346or the optional REGEXP argument."
322 (set-buffer file-cache-buffer) 347 (set-buffer file-cache-buffer)
323 (mapcar 348 (mapcar
324 (function (lambda (elt) 349 (function (lambda (elt)
325 (goto-char (point-min)) 350 (goto-char (point-min))
326 (delete-matching-lines elt))) 351 (delete-matching-lines elt)))
@@ -328,10 +353,10 @@ or the optional REGEXP argument."
328 (goto-char (point-min)) 353 (goto-char (point-min))
329 (let ((full-filename)) 354 (let ((full-filename))
330 (while (re-search-forward 355 (while (re-search-forward
331 (or regexp file-cache-buffer-default-regexp) 356 (or regexp file-cache-buffer-default-regexp)
332 (point-max) t) 357 (point-max) t)
333 (setq full-filename (buffer-substring-no-properties 358 (setq full-filename (buffer-substring-no-properties
334 (match-beginning 0) (match-end 0))) 359 (match-beginning 0) (match-end 0)))
335 (file-cache-add-file full-filename)))) 360 (file-cache-add-file full-filename))))
336 361
337;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 362;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -348,8 +373,9 @@ or the optional REGEXP argument."
348 "Delete FILE from the file cache." 373 "Delete FILE from the file cache."
349 (interactive 374 (interactive
350 (list (completing-read "Delete file from cache: " file-cache-alist))) 375 (list (completing-read "Delete file from cache: " file-cache-alist)))
351 (setq file-cache-alist 376 (setq file-cache-alist
352 (delq (assoc file file-cache-alist) file-cache-alist))) 377 (delq (funcall file-cache-assoc-function file file-cache-alist)
378 file-cache-alist)))
353 379
354(defun file-cache-delete-file-list (file-list) 380(defun file-cache-delete-file-list (file-list)
355 "Delete FILE-LIST (a list of files) from the file cache." 381 "Delete FILE-LIST (a list of files) from the file cache."
@@ -360,7 +386,7 @@ or the optional REGEXP argument."
360 "Delete files matching REGEXP from the file cache." 386 "Delete files matching REGEXP from the file cache."
361 (interactive "sRegexp: ") 387 (interactive "sRegexp: ")
362 (let ((delete-list)) 388 (let ((delete-list))
363 (mapcar '(lambda (elt) 389 (mapcar '(lambda (elt)
364 (and (string-match regexp (car elt)) 390 (and (string-match regexp (car elt))
365 (setq delete-list (cons (car elt) delete-list)))) 391 (setq delete-list (cons (car elt) delete-list))))
366 file-cache-alist) 392 file-cache-alist)
@@ -372,8 +398,8 @@ or the optional REGEXP argument."
372 (interactive "DDelete directory from file cache: ") 398 (interactive "DDelete directory from file cache: ")
373 (let ((dir (expand-file-name directory)) 399 (let ((dir (expand-file-name directory))
374 (result 0)) 400 (result 0))
375 (mapcar 401 (mapcar
376 '(lambda (entry) 402 '(lambda (entry)
377 (if (file-cache-do-delete-directory dir entry) 403 (if (file-cache-do-delete-directory dir entry)
378 (setq result (1+ result)))) 404 (setq result (1+ result))))
379 file-cache-alist) 405 file-cache-alist)
@@ -387,7 +413,7 @@ or the optional REGEXP argument."
387 ) 413 )
388 (and (member directory directory-list) 414 (and (member directory directory-list)
389 (if (equal 1 (length directory-list)) 415 (if (equal 1 (length directory-list))
390 (setq file-cache-alist 416 (setq file-cache-alist
391 (delq entry file-cache-alist)) 417 (delq entry file-cache-alist))
392 (setcdr entry (delete directory directory-list))) 418 (setcdr entry (delete directory directory-list)))
393 ) 419 )
@@ -404,14 +430,15 @@ or the optional REGEXP argument."
404 430
405;; Returns the name of a directory for a file in the cache 431;; Returns the name of a directory for a file in the cache
406(defun file-cache-directory-name (file) 432(defun file-cache-directory-name (file)
407 (let* ((directory-list (cdr (assoc file file-cache-alist))) 433 (let* ((directory-list (cdr (funcall file-cache-assoc-function
434 file file-cache-alist)))
408 (len (length directory-list)) 435 (len (length directory-list))
409 (directory) 436 (directory)
410 (num) 437 (num)
411 ) 438 )
412 (if (not (listp directory-list)) 439 (if (not (listp directory-list))
413 (error "Unknown type in file-cache-alist for key %s" file)) 440 (error "Unknown type in file-cache-alist for key %s" file))
414 (cond 441 (cond
415 ;; Single element 442 ;; Single element
416 ((eq 1 len) 443 ((eq 1 len)
417 (setq directory (elt directory-list 0))) 444 (setq directory (elt directory-list 0)))
@@ -426,8 +453,8 @@ or the optional REGEXP argument."
426 (setq directory 453 (setq directory
427 ;; If the directory is in the list, return the next element 454 ;; If the directory is in the list, return the next element
428 ;; Otherwise, return the first element 455 ;; Otherwise, return the first element
429 (if dir-list 456 (if dir-list
430 (or (elt directory-list 457 (or (elt directory-list
431 (setq num (1+ (- len (length dir-list))))) 458 (setq num (1+ (- len (length dir-list)))))
432 (elt directory-list (setq num 0))) 459 (elt directory-list (setq num 0)))
433 (elt directory-list (setq num 0)))) 460 (elt directory-list (setq num 0))))
@@ -443,7 +470,7 @@ or the optional REGEXP argument."
443(defun file-cache-file-name (file) 470(defun file-cache-file-name (file)
444 (let ((directory (file-cache-directory-name file))) 471 (let ((directory (file-cache-directory-name file)))
445 (concat directory file))) 472 (concat directory file)))
446 473
447;; Return a canonical directory for comparison purposes. 474;; Return a canonical directory for comparison purposes.
448;; Such a directory ends with a forward slash. 475;; Such a directory ends with a forward slash.
449(defun file-cache-canonical-directory (dir) 476(defun file-cache-canonical-directory (dir)
@@ -458,10 +485,10 @@ or the optional REGEXP argument."
458 485
459;; The prefix argument works around a bug in the minibuffer completion. 486;; The prefix argument works around a bug in the minibuffer completion.
460;; The completion function doesn't distinguish between the states: 487;; The completion function doesn't distinguish between the states:
461;; 488;;
462;; "Multiple completions of name" (eg, Makefile, Makefile.in) 489;; "Multiple completions of name" (eg, Makefile, Makefile.in)
463;; "Name available in multiple directories" (/tmp/Makefile, ~me/Makefile) 490;; "Name available in multiple directories" (/tmp/Makefile, ~me/Makefile)
464;; 491;;
465;; The default is to do the former; a prefix arg forces the latter. 492;; The default is to do the former; a prefix arg forces the latter.
466 493
467;;;###autoload 494;;;###autoload
@@ -469,21 +496,21 @@ or the optional REGEXP argument."
469 "Complete a filename in the minibuffer using a preloaded cache. 496 "Complete a filename in the minibuffer using a preloaded cache.
470Filecache does two kinds of substitution: it completes on names in 497Filecache does two kinds of substitution: it completes on names in
471the cache, and, once it has found a unique name, it cycles through 498the cache, and, once it has found a unique name, it cycles through
472the directories that the name is available in. With a prefix argument, 499the directories that the name is available in. With a prefix argument,
473the name is considered already unique; only the second substitution 500the name is considered already unique; only the second substitution
474\(directories) is done." 501\(directories) is done."
475 (interactive "P") 502 (interactive "P")
476 (let* 503 (let*
477 ( 504 (
478 (completion-ignore-case file-cache-completion-ignore-case) 505 (completion-ignore-case file-cache-completion-ignore-case)
479 (case-fold-search nil) 506 (case-fold-search file-cache-case-fold-search)
480 (string (file-name-nondirectory (buffer-string))) 507 (string (file-name-nondirectory (buffer-string)))
481 (completion-string (try-completion string file-cache-alist)) 508 (completion-string (try-completion string file-cache-alist))
482 (completion-list) 509 (completion-list)
483 (len) 510 (len)
484 (file-cache-string) 511 (file-cache-string)
485 ) 512 )
486 (cond 513 (cond
487 ;; If it's the only match, replace the original contents 514 ;; If it's the only match, replace the original contents
488 ((or arg (eq completion-string t)) 515 ((or arg (eq completion-string t))
489 (setq file-cache-string (file-cache-file-name string)) 516 (setq file-cache-string (file-cache-file-name string))
@@ -492,7 +519,7 @@ the name is considered already unique; only the second substitution
492 (erase-buffer) 519 (erase-buffer)
493 (insert-string file-cache-string) 520 (insert-string file-cache-string)
494 (if file-cache-multiple-directory-message 521 (if file-cache-multiple-directory-message
495 (file-cache-temp-minibuffer-message 522 (file-cache-temp-minibuffer-message
496 file-cache-multiple-directory-message)) 523 file-cache-multiple-directory-message))
497 )) 524 ))
498 525
@@ -501,12 +528,12 @@ the name is considered already unique; only the second substitution
501 ;; If we've already inserted a unique string, see if the user 528 ;; If we've already inserted a unique string, see if the user
502 ;; wants to use that one 529 ;; wants to use that one
503 (if (and (string= string completion-string) 530 (if (and (string= string completion-string)
504 (assoc string file-cache-alist)) 531 (funcall file-cache-assoc-function string file-cache-alist))
505 (if (and (eq last-command this-command) 532 (if (and (eq last-command this-command)
506 (string= file-cache-last-completion completion-string)) 533 (string= file-cache-last-completion completion-string))
507 (progn 534 (progn
508 (erase-buffer) 535 (erase-buffer)
509 (insert-string (file-cache-file-name completion-string)) 536 (insert-string (file-cache-file-name completion-string))
510 (setq file-cache-last-completion nil) 537 (setq file-cache-last-completion nil)
511 ) 538 )
512 (file-cache-temp-minibuffer-message file-cache-non-unique-message) 539 (file-cache-temp-minibuffer-message file-cache-non-unique-message)
@@ -518,11 +545,11 @@ the name is considered already unique; only the second substitution
518 (if (> len 1) 545 (if (> len 1)
519 (progn 546 (progn
520 (goto-char (point-max)) 547 (goto-char (point-max))
521 (insert-string 548 (insert-string
522 (substring completion-string (length string))) 549 (substring completion-string (length string)))
523 ;; Add our own setup function to the Completions Buffer 550 ;; Add our own setup function to the Completions Buffer
524 (let ((completion-setup-hook 551 (let ((completion-setup-hook
525 (reverse 552 (reverse
526 (append (list 'file-cache-completion-setup-function) 553 (append (list 'file-cache-completion-setup-function)
527 completion-setup-hook))) 554 completion-setup-hook)))
528 ) 555 )
@@ -532,15 +559,15 @@ the name is considered already unique; only the second substitution
532 ) 559 )
533 (setq file-cache-string (file-cache-file-name completion-string)) 560 (setq file-cache-string (file-cache-file-name completion-string))
534 (if (string= file-cache-string (buffer-string)) 561 (if (string= file-cache-string (buffer-string))
535 (file-cache-temp-minibuffer-message 562 (file-cache-temp-minibuffer-message
536 file-cache-sole-match-message) 563 file-cache-sole-match-message)
537 (erase-buffer) 564 (erase-buffer)
538 (insert-string file-cache-string) 565 (insert-string file-cache-string)
539 (if file-cache-multiple-directory-message 566 (if file-cache-multiple-directory-message
540 (file-cache-temp-minibuffer-message 567 (file-cache-temp-minibuffer-message
541 file-cache-multiple-directory-message))) 568 file-cache-multiple-directory-message)))
542 ))) 569 )))
543 570
544 ;; No match 571 ;; No match
545 ((eq completion-string nil) 572 ((eq completion-string nil)
546 (file-cache-temp-minibuffer-message file-cache-no-match-message)) 573 (file-cache-temp-minibuffer-message file-cache-no-match-message))
@@ -570,11 +597,11 @@ the name is considered already unique; only the second substitution
570 597
571 (if file-cache-completions-keymap 598 (if file-cache-completions-keymap
572 nil 599 nil
573 (setq file-cache-completions-keymap 600 (setq file-cache-completions-keymap
574 (copy-keymap completion-list-mode-map)) 601 (copy-keymap completion-list-mode-map))
575 (define-key file-cache-completions-keymap [mouse-2] 602 (define-key file-cache-completions-keymap [mouse-2]
576 'file-cache-mouse-choose-completion) 603 'file-cache-mouse-choose-completion)
577 (define-key file-cache-completions-keymap "\C-m" 604 (define-key file-cache-completions-keymap "\C-m"
578 'file-cache-choose-completion)) 605 'file-cache-choose-completion))
579 606
580 (use-local-map file-cache-completions-keymap) 607 (use-local-map file-cache-completions-keymap)
@@ -623,11 +650,11 @@ match REGEXP."
623 "Output a list of files whose names (not including directories) 650 "Output a list of files whose names (not including directories)
624match REGEXP." 651match REGEXP."
625 (interactive "sFind files matching regexp: ") 652 (interactive "sFind files matching regexp: ")
626 (let ((results 653 (let ((results
627 (file-cache-files-matching-internal regexp)) 654 (file-cache-files-matching-internal regexp))
628 buf) 655 buf)
629 (set-buffer 656 (set-buffer
630 (setq buf (get-buffer-create 657 (setq buf (get-buffer-create
631 "*File Cache Files Matching*"))) 658 "*File Cache Files Matching*")))
632 (erase-buffer) 659 (erase-buffer)
633 (insert 660 (insert
@@ -644,9 +671,9 @@ match REGEXP."
644 671
645(defun file-cache-debug-read-from-minibuffer (file) 672(defun file-cache-debug-read-from-minibuffer (file)
646 "Debugging function." 673 "Debugging function."
647 (interactive 674 (interactive
648 (list (completing-read "File Cache: " file-cache-alist))) 675 (list (completing-read "File Cache: " file-cache-alist)))
649 (message "%s" (assoc file file-cache-alist)) 676 (message "%s" (funcall file-cache-assoc-function file file-cache-alist))
650 ) 677 )
651 678
652;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 679;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;