all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Sebastien Vauban" <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org>
To: help-gnu-emacs-mXXj517/zsQ@public.gmane.org
Subject: Re: How to load recentf only after opening/saving a file for the firsttime?
Date: Fri, 07 Sep 2012 16:57:38 +0200	[thread overview]
Message-ID: <80pq5xswwt.fsf@somewhere.org> (raw)
In-Reply-To: mailman.8316.1347028472.855.help-gnu-emacs@gnu.org

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


  parent reply	other threads:[~2012-09-07 14:57 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 ` How to load recentf only after opening/saving a file for the firsttime? Drew Adams
     [not found] ` <mailman.8316.1347028472.855.help-gnu-emacs@gnu.org>
2012-09-07 14:57   ` Sebastien Vauban [this message]
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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=80pq5xswwt.fsf@somewhere.org \
    --to=wxhgmqzgwmuf-genee64ty+gs+fvcfc7uqw@public.gmane.org \
    --cc=help-gnu-emacs-mXXj517/zsQ@public.gmane.org \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.