Fix comment typo.
[bpt/emacs.git] / lisp / filecache.el
index 18c537f..9e06d6f 100644 (file)
@@ -5,14 +5,14 @@
 ;; Keywords: convenience
 ;;
 ;; Copyright (C) 1996, 2000, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007 Free Software Foundation, Inc.
+;;   2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -20,9 +20,7 @@
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 ;;
@@ -259,7 +257,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 +612,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 +652,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."
@@ -780,11 +768,7 @@ match REGEXP."
 ;; Keybindings
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-;;;###autoload (define-key minibuffer-local-completion-map [C-tab] 'file-cache-minibuffer-complete)
-;;;###autoload (define-key minibuffer-local-map [C-tab] 'file-cache-minibuffer-complete)
-;;;###autoload (define-key minibuffer-local-must-match-map [C-tab] 'file-cache-minibuffer-complete)
-
 (provide 'filecache)
 
-;;; arch-tag: 433d3ca4-4af2-47ce-b2cf-1f727460f538
+;; arch-tag: 433d3ca4-4af2-47ce-b2cf-1f727460f538
 ;;; filecache.el ends here