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

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

Re: most recent files


From: Denis Bueno
Subject: Re: most recent files
Date: Thu, 26 Jul 2007 08:53:15 -0600
User-agent: Microsoft-Entourage/11.3.3.061214

On 07/25/2007 21:17, "Frank Murray" <fjmurray1@mac.com> wrote:
> Is there a way to access or bring up quickly the x most recent files
> or programs you had just been working on,
> i.e., x = 10,  15,  20, ..., etc.?

Although recentf-mode sounds more like what you're thinking of, I thought
I'd mention something I find more useful and faster: filecache.  (see (info
"(emacs)File Name Cache")).  Filecache lets you complete the entire path to
a file based solely on the filename.  So if /path/to/foo/c/foo.c is in the
cache, when you type C-x C-f foo. C-TAB -- the minibuffer will complete the
path to /path/to/foo/c/foo.c no matter what your current directory is.
Moreover, if there are multiple files of the same name, it shows you all the
possibilities.

To achieve something very similar to what you're looking for, I add files to
the file cache as I visit and save them.  This way any time I visit or save
a file, I can kill the buffer and know that the file will be easy to access
later with C-x C-f.  In my .emacs:

    (require 'filecache)
    ;; Add files to the cache as I edit them.
    (defun file-cache-add-buffer-file ()
      "Add the file name associated with the current buffer to the file
cache."
      (let ((name (buffer-file-name)))
        (if (and name
                 (file-exists-p name)
                 (file-readable-p name))
            (file-cache-add-file name))))

    (add-hook 'find-file-hook 'file-cache-add-buffer-file)
    (add-hook 'after-save-hook 'file-cache-add-buffer-file)

-Denis






reply via email to

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