+(defun file-cache-complete ()
+ "Complete the word at point, using the filecache."
+ (interactive)
+ (let (start pattern completion all)
+ (save-excursion
+ (skip-syntax-backward "^\"")
+ (setq start (point)))
+ (setq pattern (buffer-substring-no-properties start (point)))
+ (setq completion (try-completion pattern file-cache-alist))
+ (setq all (all-completions pattern file-cache-alist nil))
+ (cond ((eq completion t))
+ ((null completion)
+ (message "Can't find completion for \"%s\"" pattern)
+ (ding))
+ ((not (string= pattern completion))
+ (delete-region start (point))
+ (insert completion)
+ )
+ (t
+ (with-output-to-temp-buffer "*Completions*"
+ (display-completion-list all pattern))
+ ))
+ ))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Show parts of the cache
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defun file-cache-files-matching-internal (regexp)
+ "Output a list of files whose names (not including directories)
+match REGEXP."
+ (let ((results))
+ (mapcar
+ (function
+ (lambda(cache-element)
+ (and (string-match regexp
+ (elt cache-element 0))
+ (if results
+ (nconc results (list (elt cache-element 0)))
+ (setq results (list (elt cache-element 0)))))))
+ file-cache-alist)
+ results))
+
+(defun file-cache-files-matching (regexp)
+ "Output a list of files whose names (not including directories)
+match REGEXP."
+ (interactive "sFind files matching regexp: ")
+ (let ((results
+ (file-cache-files-matching-internal regexp))
+ buf)
+ (set-buffer
+ (setq buf (get-buffer-create
+ "*File Cache Files Matching*")))
+ (erase-buffer)
+ (insert
+ (mapconcat
+ 'identity
+ results
+ "\n"))
+ (goto-char (point-min))
+ (display-buffer buf)))
+