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

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

Re: How to load recentf only after opening/saving a file for the firstti


From: Sebastien Vauban
Subject: Re: How to load recentf only after opening/saving a file for the firsttime?
Date: Fri, 07 Sep 2012 16:57:38 +0200
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.2 (windows-nt)

Hi Drew,

"Drew Adams" wrote:
>> 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.

OK. The time seems much more complex than expected.

> All that said, I cannot imagine using Emacs interactively without ever using a
> file-visiting command!

I don't either!

> 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.

The fact is that Emacs (RC 24.2 on Windows) takes around 25 seconds to load my
(huge, yes) .emacs file (378 KB, ~10 KLOC from which a third is white lines,
and another one is comment lines).

Loading Org mode takes another minute or so, with 50 agenda files.

That's really too much. That's why I'm trying to refactor my .emacs file to
try to see what takes time. I'm trying to autoload as much as possible, and to
delay the `require' calls to some known point in time.

That's why I was wondering how to do that for recentf. But I've the same
question for vc, for example, which consumes 3 seconds:

--8<---------------cut here---------------start------------->8---
(info) +-> Requiring `vc'...
(info)   +-> Requiring `vc-hooks'... already loaded
(info)   +-> Requiring `vc-dispatcher'... c:/Program 
Files/Emacs-24.2/lisp/vc/vc-dispatcher.elc (loaded in 0.33 s)
(info)   +-> Requiring `ediff'...
(info)     +-> Requiring `ediff-init'... c:/Program 
Files/Emacs-24.2/lisp/vc/ediff-init.elc (loaded in 0.33 s)
(info)     +-> Requiring `ediff-mult'...
(info)       +-> Requiring `ediff-init'... already loaded
(info)     +-> Requiring `ediff-mult'... c:/Program 
Files/Emacs-24.2/lisp/vc/ediff-mult.elc (loaded in 0.31 s)
(info)     +-> Requiring `ediff-util'...
(info)       +-> Requiring `ediff-init'... already loaded
(info)       +-> Requiring `ediff-help'...
(info)         +-> Requiring `ediff-init'... already loaded
(info)       +-> Requiring `ediff-help'... c:/Program 
Files/Emacs-24.2/lisp/vc/ediff-help.elc (loaded in 0.28 s)
(info)       +-> Requiring `ediff-mult'... already loaded
(info)       +-> Requiring `ediff-wind'...
(info)         +-> Requiring `ediff-init'... already loaded
(info)       +-> Requiring `ediff-wind'... c:/Program 
Files/Emacs-24.2/lisp/vc/ediff-wind.elc (loaded in 0.28 s)
(info)       +-> Requiring `ediff-diff'...
(info)         +-> Requiring `ediff-init'... already loaded
(info)       +-> Requiring `ediff-diff'... c:/Program 
Files/Emacs-24.2/lisp/vc/ediff-diff.elc (loaded in 0.28 s)
(info)       +-> Requiring `ediff-merg'...
(info)         +-> Requiring `ediff-init'... already loaded
(info)       +-> Requiring `ediff-merg'... c:/Program 
Files/Emacs-24.2/lisp/vc/ediff-merg.elc (loaded in 0.28 s)
(info)     +-> Requiring `ediff-util'... c:/Program 
Files/Emacs-24.2/lisp/vc/ediff-util.elc (loaded in 1.45 s)
(info)   +-> Requiring `ediff'... c:/Program Files/Emacs-24.2/lisp/vc/ediff.elc 
(loaded in 2.39 s)
(info) +-> Requiring `vc'... c:/Program Files/Emacs-24.2/lisp/vc/vc.elc (loaded 
in 3.00 s)
--8<---------------cut here---------------end--------------->8---

I don't know if that will ever be feasible, but I'd love to have Emacs started
in 5 seconds, and Org in not much more.

Best regards,
Seb

-- 
Sebastien Vauban


reply via email to

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