emacs-devel
[Top][All Lists]
Advanced

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

Re: Feature Request : autoload-form


From: paul r
Subject: Re: Feature Request : autoload-form
Date: Mon, 31 Mar 2008 19:36:53 +0200

2008/3/31, Richard Stallman <address@hidden>:

I'll try to make things more clear below, but before reading the whole
message, be warned :
 - it is long and unlikely to interest you, so you can safely skip it
 - I solved the original problem of this thread.

> I think I understand what these do.  I'm not completely sure why you
>  want them, though.  What job do these do, which you couldn't do by
>  installing some Lisp libraries in the usual way?

What usual way ?

>
> Why not put this stuff directly in .emacs?

TidyConfig IS a .emacs splited into many files. Each file has a role.
You may want to load some of them, and not some others. As an exemple,
the upstream repository provides more than 20 modules, but usualy
people use around 10 modules. For exemple, you can load 4 of them at
startup time, then the 6 remaining dynamically when needed (thanks to
autoload / automode etc). Any configuration should not be read -at
all- if not needed yet.

> I don't see why you want to do that, rather than putting the
>  "module configuration" expressions directly in .emacs.
>  What do you gain?

Fine grained, per-feature, configuration "cherry-picking". But you are
right that I could.

> I am confused.  Are you talking about making a module load its module
>  configuration expressions, or are you talking about how to load the
>  module itself when it is needed?  Those are two different issues, right?
>  Some of your words seem to imply one, and some seem to imply the other.

Sorry for not being clear. This system uses some conventions. Here is
an exemple of a use case :
 - I sometime use latex-mode
 - I do not want it to be loaded at startup time because it would slow
down for nothing
 - Some of the configuration should be shared with other users

To do so :
 - I have some customization for this mode, that is shared by
everybody in my company. This configuration is some lisp written in
mod.latex.el. At the beginning of this file, there is (require 'latex)
 - I have personal preferences that are not shared, it goes to conf.latex.el
 - I need the actual latex mode librairy, so I download it from Auctex
to my "modes" directory and name the directory "latex".
 - I register "metadata" which is a list of 3 elements  '( module
autoload-function automode-extension ), with following meaning : "load
module on autoload-function call" and "call autoload-function on file
matching automode-extension". Is this case, it will be basicaly
'(latex latex-mode ".tex")

And that's it. Nothing about latex will be loaded at emacs startup
time, except "metadata". Then, when autoload-function is called for
the first time, is does the "proper loading of module" that confused
you, which is detailled below :
 1 - load conf.latex.el (again, this is a per-user optional file)
 2 - unless tidyconfig-avoid-local-mode has been set to 't in
conf.latex.el, look for a directory in modes directory which name is
"latex". If found, add it to load-path.
 3 - load mod.latex.el. This module does (require 'latex), which in
turn will define real latex-mode.
 4 - call latex-mode

The file mentionned above can be visited from [2].

So why do I have all this system ? Because, as strange as it can look
at first glance, it provides strong consistency over how emacs config
is managed as a whole, for me and for my "network". As well as easier
portability over systems.

I did not invente anything, 99% of the goodness is due to emacs clean
design. I just did the last 1% to make it easier to access. I think it
might be surprising mainly because it uses some conventions for
loading process, while conventional lisp librairy explicitly express
their dependencies through load-path settings, (require ...)  (load
...) etc. Although I think the later is more robust, so is the right
choice in most cases, I think the former is easier to maintain, for
me, in the particular case of .emacs configuration.

> I have lost you completely here.

I'm sorry about that. If you have a web browser and want to give it a
try, please go to [1], download a snapshot clicking on "zip" or "gz",
extract in any directory, cd to this directory, and enter
   emacs -q -l tidyconfig.start.el

Regards,

-- Paul

[1] http://emacs.kekerekex.net:8008/tidyconfig-vanilla/summary
[2] http://emacs.kekerekex.net:8008/tidyconfig-vanilla/file




reply via email to

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