emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r110914: * filecache.el (file-cache-a


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r110914: * filecache.el (file-cache-add-file): Handle relative file name in the argument.
Date: Sat, 17 Nov 2012 14:16:46 +0800
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 110914
fixes bug: http://debbugs.gnu.org/12694
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Sat 2012-11-17 14:16:46 +0800
message:
  * filecache.el (file-cache-add-file): Handle relative file name in the 
argument.
modified:
  lisp/ChangeLog
  lisp/filecache.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-11-16 18:18:07 +0000
+++ b/lisp/ChangeLog    2012-11-17 06:16:46 +0000
@@ -1,3 +1,8 @@
+2012-11-17  Chong Yidong  <address@hidden>
+
+       * filecache.el (file-cache-add-file): Handle relative file name in
+       the argument (Bug#12694).
+
 2012-11-16  Jürgen Hötzel  <address@hidden>  (tiny change)
 
        * eshell/em-unix.el (eshell/mkdir): Handle "--parents" (bug#12897).

=== modified file 'lisp/filecache.el'
--- a/lisp/filecache.el 2012-11-02 22:44:38 +0000
+++ b/lisp/filecache.el 2012-11-17 06:16:46 +0000
@@ -310,23 +310,22 @@
 (defun file-cache-add-file (file)
   "Add FILE to the file cache."
   (interactive "fAdd File: ")
-  (if (not (file-exists-p file))
-      (message "Filecache: file %s does not exist" file)
-    (let* ((file-name (file-name-nondirectory file))
-          (dir-name  (file-name-directory    file))
-          (the-entry (assoc-string
-                      file-name file-cache-alist
-                      file-cache-ignore-case)))
-      ;; Does the entry exist already?
-      (if the-entry
-         (if (or (and (stringp (cdr the-entry))
-                      (string= dir-name (cdr the-entry)))
-                 (and (listp (cdr the-entry))
-                      (member dir-name (cdr the-entry))))
-             nil
-           (setcdr the-entry (cons dir-name (cdr the-entry))))
-       ;; If not, add it to the cache
-       (push (list file-name dir-name) file-cache-alist)))))
+  (setq file (file-truename file))
+  (unless (file-exists-p file)
+    (error "Filecache: file %s does not exist" file))
+  (let* ((file-name (file-name-nondirectory file))
+        (dir-name  (file-name-directory file))
+        (the-entry (assoc-string file-name file-cache-alist
+                                 file-cache-ignore-case)))
+    ;; Does the entry exist already?
+    (if the-entry
+       (unless (or (and (stringp (cdr the-entry))
+                        (string= dir-name (cdr the-entry)))
+                   (and (listp (cdr the-entry))
+                        (member dir-name (cdr the-entry))))
+         (setcdr the-entry (cons dir-name (cdr the-entry))))
+      ;; If not, add it to the cache
+      (push (list file-name dir-name) file-cache-alist))))
 
 ;;;###autoload
 (defun file-cache-add-directory-using-find (directory)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]