Function: file-cache-add-file

file-cache-add-file is an autoloaded, interactive and byte-compiled function defined in filecache.el.gz.

Signature

(file-cache-add-file FILE)

Documentation

Add FILE to the file cache.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/filecache.el.gz
;; Workhorse function

;;;###autoload
(defun file-cache-add-file (file)
  "Add FILE to the file cache."
  (interactive "fAdd File: ")
  (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)))
    (cond ((null the-entry)
	   ;; If the entry wasn't in the cache, add it.
	   (push (list file-name dir-name) file-cache-alist)
	   (if (called-interactively-p 'interactive)
	       (message "Filecache: cached file name %s." file)))
	  ((not (member dir-name (cdr the-entry)))
	   (setcdr the-entry (cons dir-name (cdr the-entry)))
	   (if (called-interactively-p 'interactive)
	       (message "Filecache: cached file name %s." file)))
	  (t
	   (if (called-interactively-p 'interactive)
	       (message "Filecache: %s is already cached." file))))))