emacs-devel
[Top][All Lists]
Advanced

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

Re: Update filename history after several actions


From: Juri Linkov
Subject: Re: Update filename history after several actions
Date: Wed, 12 Oct 2005 08:47:04 +0300
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

>     The simplest solution is to use the same method as employed by
>     Recentf mode.  It maintains the list of recently opened files,
>     no matter what user-level command visited them, and doesn't include
>     automatically processed files.
>
>     To update the list of recently opened files, Recentf mode puts
>     the function `recentf-track-opened-file' in `find-file-hook'.
>
> How does that avoid recording files that are processed by Lisp
> programs that the user doesn't know about?  If those programs use
> find-file-noselect, that would run find-file-hook, which would
> record the file name thus being processed.

Recentf is quite an old package, and it seems its users are happy with
the way it records recently opened files.  Perhaps this means there
are not many places where find-file-noselect is used for internal file
processing (i.e. not intended for the users to know).  In those places
where such processing is required, a more preferable way is to insert
the contents of a file into a temporary buffer.

While I tried to run the code which uses find-file-hook I sent earlier,
I noticed that often it adds too many file names to the history, even
the files opened for editing (there were no file names left from internal
file processing at all in my test).  For example, I don't like that
`next-error' adds every file it opens from the grep buffer.  Also I
don't like adding files visited in read-only mode by dired's "v" key.

All this means that the question what file names to add to the history
is rather a matter of personal preferences.  A simple hook for
`find-file-hook' is easy to put in .emacs.

But even if this functionality will get into Emacs, I think it's
better to leave the current default behavior (with only adding user
input to the history) unchanged.

-- 
Juri Linkov
http://www.jurta.org/emacs/





reply via email to

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