emacs-devel
[Top][All Lists]
Advanced

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

Re: relative load-file


From: Rocky Bernstein
Subject: Re: relative load-file
Date: Fri, 13 Nov 2009 11:39:29 -0500

Ok. Thanks yet again for the useful information. I imagine this is documented elsewhere as well.

When given the choice of writing code that works when conventions are followed and code that works independent of whether conventions are followed, I'll choose the later, even though I myself will try to follow convention. (Except of course, there is good reason not to).


On Fri, Nov 13, 2009 at 11:17 AM, Stefan Monnier <address@hidden> wrote:
>> This example seems to fail the "those cases do show up" test. Not
>> just because the requires/loads tend to occur early in an Elisp
>> buffer, but also because a call to `find-file' (or set-buffer for
>> that matter) at the top-level of an Elisp buffer is extremely rare
>> and strongly discouraged by the convention that loading an Elisp file
>> should not have any "visible effect" (this convention is
>> useful/necessary to allow things like Customize to load files at
>> will, e.g. just to get the needed info to build a customization
>> buffer).
> I see.  You seem to have strong and somewhat self-fulfilling views of what
> programmers should do or not do in Emacs.

It's not restrictions about what programmers should do in Emacs, it's
restrictions about how to structure an Elisp package: the file itself
should be "declarative", such that the `load' itself won't affect the
behavior of Emacs.

This is a convention that doesn't come from me, but has appeared over
the years as being useful.  The example of `customize' is just one
of them.  Another case where we load a file and don't expect it to
change the behavior of the running Emacs session is when you
byte-compile a file that requires `foo': the byte-compiler should be
free to load `foo' without having to worry about it changing the
background color of the running session.

Note also that it's a convention that most packages have always followed
without even thinking about it.  And the few packages that didn't follow
it had no trouble adjusting.


       Stefan


reply via email to

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