diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2008-04-14 18:11:52 +0000 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2008-04-14 18:11:52 +0000 |
commit | d8e1753cfd4ab293f45b565bc81dabbb7b61da1a (patch) | |
tree | e172fc74db2dc1466f9d456f073715e207572783 /lisp/filecache.el | |
parent | 30b775ff5d957e00a4151efaa7814bfb3181fe18 (diff) | |
download | emacs-d8e1753cfd4ab293f45b565bc81dabbb7b61da1a.tar.gz |
(file-cache-completions-keymap): Move init from
file-cache-completion-setup-function into declaration.
(file-cache-minibuffer-complete): Simplify.
(file-cache-completion-setup-function): Use standard-output,
preserve current-buffer.
Diffstat (limited to 'lisp/filecache.el')
-rw-r--r-- | lisp/filecache.el | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/lisp/filecache.el b/lisp/filecache.el index d3336abaac4..7e1d39a9ad3 100644 --- a/lisp/filecache.el +++ b/lisp/filecache.el @@ -259,7 +259,12 @@ Defaults to nil on DOS and Windows, and t on other systems." (defvar file-cache-alist nil "Internal data structure to hold cache of file names.") -(defvar file-cache-completions-keymap nil +(defvar file-cache-completions-keymap + (let ((map (make-sparse-keymap))) + (set-keymap-parent map completion-list-mode-map) + (define-key map [mouse-2] 'file-cache-mouse-choose-completion) + (define-key map "\C-m" 'file-cache-choose-completion) + map) "Keymap for file cache completions buffer.") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -609,14 +614,10 @@ the name is considered already unique; only the second substitution (substring completion-string (length string))) ;; Add our own setup function to the Completions Buffer (let ((completion-setup-hook - (reverse - (append (list 'file-cache-completion-setup-function) - completion-setup-hook))) - ) + (append completion-setup-hook + (list 'file-cache-completion-setup-function)))) (with-output-to-temp-buffer file-cache-completions-buffer - (display-completion-list completion-list string)) - ) - ) + (display-completion-list completion-list string)))) (setq file-cache-string (file-cache-file-name completion-string)) (if (string= file-cache-string (minibuffer-contents)) (file-cache-temp-minibuffer-message @@ -653,19 +654,8 @@ the name is considered already unique; only the second substitution ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun file-cache-completion-setup-function () - (set-buffer file-cache-completions-buffer) - - (if file-cache-completions-keymap - nil - (setq file-cache-completions-keymap - (copy-keymap completion-list-mode-map)) - (define-key file-cache-completions-keymap [mouse-2] - 'file-cache-mouse-choose-completion) - (define-key file-cache-completions-keymap "\C-m" - 'file-cache-choose-completion)) - - (use-local-map file-cache-completions-keymap) - ) + (with-current-buffer standard-output ;; i.e. file-cache-completions-buffer + (use-local-map file-cache-completions-keymap))) (defun file-cache-choose-completion () "Choose a completion in the `*Completions*' buffer." |