From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Sebastien Vauban" Newsgroups: gmane.emacs.help Subject: Re: How to load recentf only after opening/saving a file for the firsttime? Date: Fri, 07 Sep 2012 16:57:38 +0200 Organization: Sebastien Vauban Message-ID: <80pq5xswwt.fsf@somewhere.org> References: <80txvarlnv.fsf@somewhere.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1347030017 14881 80.91.229.3 (7 Sep 2012 15:00:17 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 7 Sep 2012 15:00:17 +0000 (UTC) To: help-gnu-emacs-mXXj517/zsQ@public.gmane.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org-mXXj517/zsQ@public.gmane.org Fri Sep 07 17:00:20 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TA02d-0002il-2U for geh-help-gnu-emacs@m.gmane.org; Fri, 07 Sep 2012 17:00:19 +0200 Original-Received: from localhost ([::1]:55506 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TA02X-0003Wi-Iv for geh-help-gnu-emacs@m.gmane.org; Fri, 07 Sep 2012 11:00:13 -0400 Original-Path: usenet.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!news2.euro.net!news.mixmin.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 83 Injection-Info: mx04.eternal-september.org; posting-host="368fa3c7dc5c1bbe516391bd65bd1ab2"; logging-data="18578"; mail-complaints-to="abuse-VVbKFVtnif8H+i2N2EyTrmui9UKz+5OX@public.gmane.org"; posting-account="U2FsdGVkX1+br8XC16MaurTOUM8JWKzG" User-Agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.2 (windows-nt) X-Archive: encrypt Cancel-Lock: sha1:H+wDUTqNbqk1pGVyJKNNuwwCYtE= sha1:F85qr4Io1k5cIaCCQzC51EHwb20= X-Url: Under construction... Original-Xref: usenet.stanford.edu gnu.emacs.help:194342 X-BeenThere: help-gnu-emacs-mXXj517/zsQ@public.gmane.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org-mXXj517/zsQ@public.gmane.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org-mXXj517/zsQ@public.gmane.org Xref: news.gmane.org gmane.emacs.help:86685 Archived-At: 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