From: "Drew Adams" <drew.adams@oracle.com>
To: "'Sebastien Vauban'" <wxhgmqzgwmuf@spammotel.com>,
<help-gnu-emacs@gnu.org>
Subject: RE: How to load recentf only after opening/saving a file for the firsttime?
Date: Fri, 7 Sep 2012 07:34:19 -0700 [thread overview]
Message-ID: <28B2EAF7CF5C4D9D8315286C73552765@us.oracle.com> (raw)
In-Reply-To: <80txvarlnv.fsf@somewhere.org>
> I guess the right time to require recentf is the first time
> we open or save a file.
> Though, for opening, the only hook available is run after
> find-file, so too late to save the first opened file, it seems.
> What would be a correct way to delay the require of recentf?
So you want recentf to be loaded when you use any command that might visit a
file? There is no way to know (absolutely) what all those commands might be.
You could certainly use `find-file-hook' to load recentf _after_ the first file
visit. Or `(before|after)-save-hook' to do so before/after the first save.
Of if you limit yourself to a known set of file-visiting commands then you could
do what you want on `pre-command-hook', testing for those commands. But that
seems a bit heavy-handed.
Or if you want this only for some particular command (e.g. `file-file') that you
use often, then you could define your own version (e.g. `my-find-file') that
does (require 'recentf nil t) as part of the `interactive' spec.
All that said, I cannot imagine using Emacs interactively without ever using a
file-visiting command! So I cannot imagine why, if you want recentf for such
commands, you do not just load recentf from the get-go, in your .emacs.
next prev parent reply other threads:[~2012-09-07 14:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-07 13:45 How to load recentf only after opening/saving a file for the first time? Sebastien Vauban
2012-09-07 14:34 ` Drew Adams [this message]
[not found] ` <mailman.8316.1347028472.855.help-gnu-emacs@gnu.org>
2012-09-07 14:57 ` How to load recentf only after opening/saving a file for the firsttime? Sebastien Vauban
2012-09-07 15:48 ` How to load recentf only after opening/saving a file for thefirsttime? Drew Adams
[not found] ` <mailman.8322.1347032903.855.help-gnu-emacs@gnu.org>
2012-09-13 7:37 ` Sebastien Vauban
2012-09-13 13:15 ` Stefan Monnier
2012-09-13 14:48 ` How to load recentf only after opening/saving a file forthefirsttime? Drew Adams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=28B2EAF7CF5C4D9D8315286C73552765@us.oracle.com \
--to=drew.adams@oracle.com \
--cc=help-gnu-emacs@gnu.org \
--cc=wxhgmqzgwmuf@spammotel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).