emacs-devel
[Top][All Lists]
Advanced

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

Re: Semantics of autoload cookies on defcustoms


From: Stefan Monnier
Subject: Re: Semantics of autoload cookies on defcustoms
Date: Sun, 09 Jul 2006 01:32:22 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

> Perhaps a good way to implement that is to write another argument into
> the custom-autoload call.  That optional argument, if non-nil, would
> specify this new combination of behaviors that I called #3.
> The decision could be based on the presence of :set.

Well, there's no need for an extra arg: we just then skip the
custom-autoload and that should be all there is to it.

How 'bout the patch below?
What it does is the following:
1 - remove the minor-mode stuff which is unnecessary anyway (since the
    custom-autoload line added just above already ensures that the package
    gets loaded (which adds the setter) before the variable is custom-set).
2 - only add the custom-autoload line for those defcustom that have a setter
    since it seems to be the only ones that need it.

I guess this isn't quite right tho: the var should still cause autoloading
if we want customize it (since it needs to go fetch the :type at the very
least).  Is that what you meant by an additional arg to custom-autoload?


        Stefan


--- autoload.el 28 mai 2006 22:48:22 -0400      1.115
+++ autoload.el 09 jui 2006 01:27:08 -0400      
@@ -124,17 +124,11 @@
            )
        `(progn
           (defvar ,varname ,init ,doc)
-          (custom-autoload ',varname ,file)
-           ;; The use of :require in a defcustom can be annoying, especially
-           ;; when defcustoms are moved from one file to another between
-           ;; releases because the :require arg gets placed in the user's
-           ;; .emacs.  In order for autoloaded minor modes not to need the
-           ;; use of :require, we arrange to store their :setter.
            ,(let ((setter (condition-case nil
                               (cadr (memq :set form))
                             (error nil))))
-              (if (equal setter ''custom-set-minor-mode)
-                  `(put ',varname 'custom-set 'custom-set-minor-mode))))))
+              (when setter
+                `(custom-autoload ',varname ,file))))))
 
      ((eq car 'defgroup)
       ;; In Emacs this is normally handled separately by cus-dep.el, but for




reply via email to

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