emacs-pretest-bug
[Top][All Lists]
Advanced

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

Re: autoload and auto-compression-mode


From: Luc Teirlinck
Subject: Re: autoload and auto-compression-mode
Date: Sat, 21 Jan 2006 20:56:27 -0600 (CST)

Richard Stallman wrote:

   Why does it have to change both?  Wouldn't it be clearer
   to have just one variable that records the list of
   compression suffixes?  `load' could check it directly.

There are, in current Emacs CVS, 7 places in Lisp and 2 in C which use
load-suffixes.  So we are not just talking about `load'.   Obviously,
it would not be smart to write inline code in these 9 places which are
bound to become more than 9 over time.

So we have two solutions:

The first is to define a new primitive function, say
`get-load-suffixes'.  The user/programmer would use the variable
`load-suffixes' directly _only_ when changing its value for some
non-compression related reason (which probably seldom happens; I have
never done it, except to experiment).  But when functions want to
figure out what suffixes to try (happens at 9 places, bound to go up),
they should not use load-suffixes directly, but call the function
`get-load-suffixes'.

The second solution is to define a command `set-basic-load-suffixes',
probably written in Lisp.  If the user wants to change the value of
the "basic" load suffixes, he should not set `load-suffixes' or
`basic-load-suffixes' directly, but do (set-basic-load-suffixes '(...)),
which automatically updates everything that needs to be updated.  If
one really wants, one could write a defcustom for
`basic-load-suffixes' with `set-basic-load-suffixes' as :set function.
But all functions could still access the value of load-suffixes
normally, by just evaluating it.

I do not immediately see why the first solution is cleaner.  The
second seems more standard.  There are many variables in Emacs whose
value only takes effect either by calling a function or by setting
through Custom.  The second solution seems also easier to implement.

Sincerely,

Luc.




reply via email to

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