diff options
| author | Chong Yidong | 2012-11-17 14:16:46 +0800 |
|---|---|---|
| committer | Chong Yidong | 2012-11-17 14:16:46 +0800 |
| commit | ec15e0ff0be9c3ab23d6df93953fc351fb4eb40e (patch) | |
| tree | 735c5f4212c37d9d16884276f656c03a6a33d763 | |
| parent | a33da68be0fd3dd306155955210ddca6b521f28d (diff) | |
| download | emacs-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/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/filecache.el | 33 |
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 @@ | |||
| 1 | 2012-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 | |||
| 1 | 2012-11-16 Jürgen Hötzel <juergen@archlinux.org> (tiny change) | 6 | 2012-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) |