gnu-emacs-sources
[Top][All Lists]
Advanced

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

file-cache-iswitchb-file


From: Mathias Dahl
Subject: file-cache-iswitchb-file
Date: Thu, 08 Jun 2006 19:29:23 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (windows-nt)

A small hack I just did:

(defun file-cache-iswitchb-file ()
  "Using iswitchb, interactively open file from file cache'.
First select a file, matched using iswitchb against the contents
in `file-cache-alist'. If the file exist in more than one
directory, select directory in the same way. Lastly the file is 
opened."
  (interactive)
  (let* ((file (file-cache-iswitchb-read "File: "
                                   (mapcar
                                    (lambda (x)
                                      (car x))
                                    file-cache-alist)))
         (record (assoc file file-cache-alist)))
    (find-file
     (concat
      (if (= (length record) 2)
          (car (cdr record))
        (file-cache-iswitchb-read 
         (format "Find %s in dir: " file) (cdr record))) file))))

(defun file-cache-iswitchb-read (prompt choices)
  (let ((iswitchb-make-buflist-hook
         (lambda ()
           (setq iswitchb-temp-buflist choices))))
    (iswitchb-read-buffer prompt)))

(global-set-key "\C-cf" 'file-cache-iswitchb-file)

Read more on EmacsWiki:

http://www.emacswiki.org/cgi-bin/wiki/FileNameCache#toc6

Enjoy!


reply via email to

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