aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2012-11-17 14:16:46 +0800
committerChong Yidong2012-11-17 14:16:46 +0800
commitec15e0ff0be9c3ab23d6df93953fc351fb4eb40e (patch)
tree735c5f4212c37d9d16884276f656c03a6a33d763
parenta33da68be0fd3dd306155955210ddca6b521f28d (diff)
downloademacs-ec15e0ff0be9c3ab23d6df93953fc351fb4eb40e.tar.gz
emacs-ec15e0ff0be9c3ab23d6df93953fc351fb4eb40e.zip
* filecache.el (file-cache-add-file): Handle relative file name in the argument.
Fixes: debbugs:12694
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/filecache.el33
2 files changed, 21 insertions, 17 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 38aebf972c0..0570703b11d 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12012-11-17 Chong Yidong <cyd@gnu.org>
2
3 * filecache.el (file-cache-add-file): Handle relative file name in
4 the argument (Bug#12694).
5
12012-11-16 Jürgen Hötzel <juergen@archlinux.org> (tiny change) 62012-11-16 Jürgen Hötzel <juergen@archlinux.org> (tiny change)
2 7
3 * eshell/em-unix.el (eshell/mkdir): Handle "--parents" (bug#12897). 8 * eshell/em-unix.el (eshell/mkdir): Handle "--parents" (bug#12897).
diff --git a/lisp/filecache.el b/lisp/filecache.el
index 2dd7c2673bf..23246c24c45 100644
--- a/lisp/filecache.el
+++ b/lisp/filecache.el
@@ -310,23 +310,22 @@ files in each directory, not to the directory list itself."
310(defun file-cache-add-file (file) 310(defun file-cache-add-file (file)
311 "Add FILE to the file cache." 311 "Add FILE to the file cache."
312 (interactive "fAdd File: ") 312 (interactive "fAdd File: ")
313 (if (not (file-exists-p file)) 313 (setq file (file-truename file))
314 (message "Filecache: file %s does not exist" file) 314 (unless (file-exists-p file)
315 (let* ((file-name (file-name-nondirectory file)) 315 (error "Filecache: file %s does not exist" file))
316 (dir-name (file-name-directory file)) 316 (let* ((file-name (file-name-nondirectory file))
317 (the-entry (assoc-string 317 (dir-name (file-name-directory file))
318 file-name file-cache-alist 318 (the-entry (assoc-string file-name file-cache-alist
319 file-cache-ignore-case))) 319 file-cache-ignore-case)))
320 ;; Does the entry exist already? 320 ;; Does the entry exist already?
321 (if the-entry 321 (if the-entry
322 (if (or (and (stringp (cdr the-entry)) 322 (unless (or (and (stringp (cdr the-entry))
323 (string= dir-name (cdr the-entry))) 323 (string= dir-name (cdr the-entry)))
324 (and (listp (cdr the-entry)) 324 (and (listp (cdr the-entry))
325 (member dir-name (cdr the-entry)))) 325 (member dir-name (cdr the-entry))))
326 nil 326 (setcdr the-entry (cons dir-name (cdr the-entry))))
327 (setcdr the-entry (cons dir-name (cdr the-entry)))) 327 ;; If not, add it to the cache
328 ;; If not, add it to the cache 328 (push (list file-name dir-name) file-cache-alist))))
329 (push (list file-name dir-name) file-cache-alist)))))
330 329
331;;;###autoload 330;;;###autoload
332(defun file-cache-add-directory-using-find (directory) 331(defun file-cache-add-directory-using-find (directory)