* Autoloaded defcustoms
@ 2009-01-05 18:21 Lennart Borgman
2009-01-05 22:15 ` Stefan Monnier
0 siblings, 1 reply; 14+ messages in thread
From: Lennart Borgman @ 2009-01-05 18:21 UTC (permalink / raw)
To: Emacs Devel
If you add an autoload cookie to a defcustom
;;;###autoload
(defcustom ourcomments-ido-ctrl-tab nil
and use get-file-autoloads on this then you get a load def
(defvar ourcomments-ido-ctrl-tab nil "\
bla bla doc")
(custom-autoload 'ourcomments-ido-ctrl-tab "ourcomments-util" nil)
This does not take care of :set etc in the defcustom AFAICS. Shouldn't
it do that? (Is this the reason that minor modes defined in libraries
external to Emacs are not turned on properly?)
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Autoloaded defcustoms
2009-01-05 18:21 Autoloaded defcustoms Lennart Borgman
@ 2009-01-05 22:15 ` Stefan Monnier
2009-01-05 22:22 ` Lennart Borgman
0 siblings, 1 reply; 14+ messages in thread
From: Stefan Monnier @ 2009-01-05 22:15 UTC (permalink / raw)
To: Lennart Borgman; +Cc: Emacs Devel
> If you add an autoload cookie to a defcustom
> ;;;###autoload
> (defcustom ourcomments-ido-ctrl-tab nil
> and use get-file-autoloads on this then you get a load def
> (defvar ourcomments-ido-ctrl-tab nil "\
> bla bla doc")
> (custom-autoload 'ourcomments-ido-ctrl-tab "ourcomments-util" nil)
> This does not take care of :set etc in the defcustom AFAICS. Shouldn't
> it do that?
It should and AFAIK it does. But your notion of "take care of" might be
different from mine. So please be more specific.
> (Is this the reason that minor modes defined in libraries
> external to Emacs are not turned on properly?)
I don't know what you're referring to.
Stefan
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Autoloaded defcustoms
2009-01-05 22:15 ` Stefan Monnier
@ 2009-01-05 22:22 ` Lennart Borgman
2009-01-06 0:57 ` Juri Linkov
2009-01-06 3:20 ` Stefan Monnier
0 siblings, 2 replies; 14+ messages in thread
From: Lennart Borgman @ 2009-01-05 22:22 UTC (permalink / raw)
To: Stefan Monnier; +Cc: Emacs Devel
On Mon, Jan 5, 2009 at 11:15 PM, Stefan Monnier
<monnier@iro.umontreal.ca> wrote:
>> If you add an autoload cookie to a defcustom
>> ;;;###autoload
>> (defcustom ourcomments-ido-ctrl-tab nil
>
>> and use get-file-autoloads on this then you get a load def
>
>> (defvar ourcomments-ido-ctrl-tab nil "\
>> bla bla doc")
>
>> (custom-autoload 'ourcomments-ido-ctrl-tab "ourcomments-util" nil)
>
>> This does not take care of :set etc in the defcustom AFAICS. Shouldn't
>> it do that?
>
> It should and AFAIK it does. But your notion of "take care of" might be
> different from mine. So please be more specific.
If the load def above is run after custom-set-variables then the
custom-set part of the defcustom symbol is not run since
custom-autoload does not do that.
I suggest using something like this instead of custom-autoload
(defun nxhtml-custom-autoload (symbol load &optional noset)
(custom-autoload symbol load noset)
(let* ((standard (get symbol 'standard-value))
(saved (get symbol 'saved-value))
(need-set (get symbol 'custom-set)))
(when (or need-set
(equal standard saved))
(custom-load-symbol symbol))))
But I am not sure about the details.
Jurij, could you please help with the details? What is necessary to do
in the function above?
>> (Is this the reason that minor modes defined in libraries
>> external to Emacs are not turned on properly?)
>
> I don't know what you're referring to.
Global minor modes have a custom-set symbol property that should be
run when setting the minor mode through custom.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Autoloaded defcustoms
2009-01-05 22:22 ` Lennart Borgman
@ 2009-01-06 0:57 ` Juri Linkov
2009-01-06 2:16 ` Lennart Borgman
2009-01-06 3:20 ` Stefan Monnier
1 sibling, 1 reply; 14+ messages in thread
From: Juri Linkov @ 2009-01-06 0:57 UTC (permalink / raw)
To: Lennart Borgman; +Cc: Stefan Monnier, emacs-devel
> I suggest using something like this instead of custom-autoload
>
> (defun nxhtml-custom-autoload (symbol load &optional noset)
> (custom-autoload symbol load noset)
> (let* ((standard (get symbol 'standard-value))
> (saved (get symbol 'saved-value))
> (need-set (get symbol 'custom-set)))
> (when (or need-set
> (equal standard saved))
> (custom-load-symbol symbol))))
>
> But I am not sure about the details.
>
> Jurij, could you please help with the details? What is necessary to do
> in the function above?
Couldn't you just set `noset' to t to force its loading?
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Autoloaded defcustoms
2009-01-06 0:57 ` Juri Linkov
@ 2009-01-06 2:16 ` Lennart Borgman
0 siblings, 0 replies; 14+ messages in thread
From: Lennart Borgman @ 2009-01-06 2:16 UTC (permalink / raw)
To: Juri Linkov; +Cc: Stefan Monnier, emacs-devel
On Tue, Jan 6, 2009 at 1:57 AM, Juri Linkov <juri@jurta.org> wrote:
>> I suggest using something like this instead of custom-autoload
>>
>> (defun nxhtml-custom-autoload (symbol load &optional noset)
>> (custom-autoload symbol load noset)
>> (let* ((standard (get symbol 'standard-value))
>> (saved (get symbol 'saved-value))
>> (need-set (get symbol 'custom-set)))
>> (when (or need-set
>> (equal standard saved))
>> (custom-load-symbol symbol))))
>>
>> But I am not sure about the details.
>>
>> Jurij, could you please help with the details? What is necessary to do
>> in the function above?
>
> Couldn't you just set `noset' to t to force its loading?
I am not sure what `noset' does. How could it help here? The sequence
of events here is
(custom-set-variables ...)
... Maybe later during startup
... load the load defs for the defcustoms with a custom-set property ...
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Autoloaded defcustoms
2009-01-05 22:22 ` Lennart Borgman
2009-01-06 0:57 ` Juri Linkov
@ 2009-01-06 3:20 ` Stefan Monnier
2009-01-06 12:27 ` Lennart Borgman
1 sibling, 1 reply; 14+ messages in thread
From: Stefan Monnier @ 2009-01-06 3:20 UTC (permalink / raw)
To: Lennart Borgman; +Cc: Emacs Devel
>>> (custom-autoload 'ourcomments-ido-ctrl-tab "ourcomments-util" nil)
> If the load def above is run after custom-set-variables then the
> custom-set part of the defcustom symbol is not run since
> custom-autoload does not do that.
After the above custom-autoload, if custom-set-variables sets this var,
it should cause "ourcomments-util" to be loaded, so that the
proper :setter is used. At least that's what the 3rd argument (nil) is
supposed to do.
Stefan
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Autoloaded defcustoms
2009-01-06 3:20 ` Stefan Monnier
@ 2009-01-06 12:27 ` Lennart Borgman
2009-01-06 14:54 ` Stefan Monnier
0 siblings, 1 reply; 14+ messages in thread
From: Lennart Borgman @ 2009-01-06 12:27 UTC (permalink / raw)
To: Stefan Monnier; +Cc: Emacs Devel
On Tue, Jan 6, 2009 at 4:20 AM, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>>>> (custom-autoload 'ourcomments-ido-ctrl-tab "ourcomments-util" nil)
>
>> If the load def above is run after custom-set-variables then the
>> custom-set part of the defcustom symbol is not run since
>> custom-autoload does not do that.
>
> After the above custom-autoload, if custom-set-variables sets this var,
> it should cause "ourcomments-util" to be loaded, so that the
> proper :setter is used. At least that's what the 3rd argument (nil) is
> supposed to do.
Yes, but the situation I am talking about is that custom-set-variables
have been run before custom-autoload (see my prev message).
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Autoloaded defcustoms
2009-01-06 12:27 ` Lennart Borgman
@ 2009-01-06 14:54 ` Stefan Monnier
2009-01-06 15:00 ` Lennart Borgman
0 siblings, 1 reply; 14+ messages in thread
From: Stefan Monnier @ 2009-01-06 14:54 UTC (permalink / raw)
To: Lennart Borgman; +Cc: Emacs Devel
>>>>> (custom-autoload 'ourcomments-ido-ctrl-tab "ourcomments-util" nil)
>>
>>> If the load def above is run after custom-set-variables then the
>>> custom-set part of the defcustom symbol is not run since
>>> custom-autoload does not do that.
>>
>> After the above custom-autoload, if custom-set-variables sets this var,
>> it should cause "ourcomments-util" to be loaded, so that the
>> proper :setter is used. At least that's what the 3rd argument (nil) is
>> supposed to do.
> Yes, but the situation I am talking about is that custom-set-variables
> have been run before custom-autoload (see my prev message).
That would be a pilot error.
Stefan
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Autoloaded defcustoms
2009-01-06 14:54 ` Stefan Monnier
@ 2009-01-06 15:00 ` Lennart Borgman
2009-01-06 15:07 ` Juri Linkov
0 siblings, 1 reply; 14+ messages in thread
From: Lennart Borgman @ 2009-01-06 15:00 UTC (permalink / raw)
To: Stefan Monnier; +Cc: Emacs Devel
On Tue, Jan 6, 2009 at 3:54 PM, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>>>>>> (custom-autoload 'ourcomments-ido-ctrl-tab "ourcomments-util" nil)
>>>
>>>> If the load def above is run after custom-set-variables then the
>>>> custom-set part of the defcustom symbol is not run since
>>>> custom-autoload does not do that.
>>>
>>> After the above custom-autoload, if custom-set-variables sets this var,
>>> it should cause "ourcomments-util" to be loaded, so that the
>>> proper :setter is used. At least that's what the 3rd argument (nil) is
>>> supposed to do.
>
>> Yes, but the situation I am talking about is that custom-set-variables
>> have been run before custom-autoload (see my prev message).
>
> That would be a pilot error.
Yes, but who is the pilot ...?
Or, why not take care of this problem? I have no problem giving more
concrete examples why this can be needed, but do I have to do that?
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Autoloaded defcustoms
2009-01-06 15:00 ` Lennart Borgman
@ 2009-01-06 15:07 ` Juri Linkov
2009-01-06 15:17 ` Lennart Borgman
0 siblings, 1 reply; 14+ messages in thread
From: Juri Linkov @ 2009-01-06 15:07 UTC (permalink / raw)
To: Lennart Borgman; +Cc: Stefan Monnier, emacs-devel
>>> Yes, but the situation I am talking about is that custom-set-variables
>>> have been run before custom-autoload (see my prev message).
>>
>> That would be a pilot error.
>
> Yes, but who is the pilot ...?
Catch-22 :-)
> Or, why not take care of this problem? I have no problem giving more
> concrete examples why this can be needed, but do I have to do that?
Why do you need to run custom-set-variables before custom-autoload?
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Autoloaded defcustoms
2009-01-06 15:07 ` Juri Linkov
@ 2009-01-06 15:17 ` Lennart Borgman
2009-01-06 18:18 ` Chetan Pandya
2009-01-06 18:20 ` Stefan Monnier
0 siblings, 2 replies; 14+ messages in thread
From: Lennart Borgman @ 2009-01-06 15:17 UTC (permalink / raw)
To: Juri Linkov; +Cc: Stefan Monnier, emacs-devel
On Tue, Jan 6, 2009 at 4:07 PM, Juri Linkov <juri@jurta.org> wrote:
>>>> Yes, but the situation I am talking about is that custom-set-variables
>>>> have been run before custom-autoload (see my prev message).
>>>
>>> That would be a pilot error.
>>
>> Yes, but who is the pilot ...?
>
> Catch-22 :-)
>
>> Or, why not take care of this problem? I have no problem giving more
>> concrete examples why this can be needed, but do I have to do that?
>
> Why do you need to run custom-set-variables before custom-autoload?
This could be during startup of Emacs. There is nothing that says
custom-set-variables should be the last thing there. (And default.el
is run afterwards.)
Another situation could be if you are trying out a package. Doing that
might require that you run a file with its load defs. You may
customize some variables in that package. The next time you start
Emacs and try this package again those customized variables will be in
a mixed state. You can for example get global minor mode whose value
is t, but that does not work. The people will start complaining that
the package does not work.
I have seen this happen. Is there any reason not to handle the problem
the way I suggested?
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Autoloaded defcustoms
2009-01-06 15:17 ` Lennart Borgman
@ 2009-01-06 18:18 ` Chetan Pandya
2009-01-06 18:21 ` Lennart Borgman
2009-01-06 18:20 ` Stefan Monnier
1 sibling, 1 reply; 14+ messages in thread
From: Chetan Pandya @ 2009-01-06 18:18 UTC (permalink / raw)
To: Juri Linkov, Lennart Borgman; +Cc: Stefan Monnier, emacs-devel
--- On Tue, 1/6/09, Lennart Borgman <lennart.borgman@gmail.com> wrote:
>> Yes, but the situation I am talking about is that custom-set-variables
> >>>> have been run before custom-autoload (see my prev message).
> >>>
> >>> That would be a pilot error.
> >>
> >> Yes, but who is the pilot ...?
> >
> > Catch-22 :-)
> >
> >> Or, why not take care of this problem? I have no problem giving more
> >> concrete examples why this can be needed, but do I have to do that?
> >
> > Why do you need to run custom-set-variables before custom-autoload?
>
> This could be during startup of Emacs. There is nothing that says
> custom-set-variables should be the last thing there. (And default.el
> is run afterwards.)
>
> Another situation could be if you are trying out a package. Doing that
> might require that you run a file with its load defs. You may
> customize some variables in that package. The next time you start
> Emacs and try this package again those customized variables
> will be in a mixed state. You can for example get global minor mode
> whose value is t, but that does not work. The people will start
> complaining that the package does not work.
>
> I have seen this happen. Is there any reason not to handle the problem
> the way I suggested?
It looks like when custom-set-variables is written out the load dependency is not part of it. Is there anything else besides that?
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Autoloaded defcustoms
2009-01-06 15:17 ` Lennart Borgman
2009-01-06 18:18 ` Chetan Pandya
@ 2009-01-06 18:20 ` Stefan Monnier
1 sibling, 0 replies; 14+ messages in thread
From: Stefan Monnier @ 2009-01-06 18:20 UTC (permalink / raw)
To: Lennart Borgman; +Cc: Juri Linkov, emacs-devel
>> Why do you need to run custom-set-variables before custom-autoload?
> This could be during startup of Emacs. There is nothing that says
> custom-set-variables should be the last thing there. (And default.el
> is run afterwards.)
autoloads go in site-start.el and/or at the beginning of the .emacs.
Otherwise, anything in the .emacs that relies on these autoloads will fail.
> I have seen this happen. Is there any reason not to handle the problem
> the way I suggested?
I think your suggestion was a bit succint. Could you explain what would
be the result of your change?
Stefan
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Autoloaded defcustoms
2009-01-06 18:18 ` Chetan Pandya
@ 2009-01-06 18:21 ` Lennart Borgman
0 siblings, 0 replies; 14+ messages in thread
From: Lennart Borgman @ 2009-01-06 18:21 UTC (permalink / raw)
To: pandyacus; +Cc: Juri Linkov, Stefan Monnier, emacs-devel
On Tue, Jan 6, 2009 at 7:18 PM, Chetan Pandya <pandyacus@sbcglobal.net> wrote:
> It looks like when custom-set-variables is written out the load dependency is not part of it. Is there anything else besides that?
Yes, the order of things. As I said above if custom-set-variables is
run before the load defs then things will not work.
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2009-01-06 18:21 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-05 18:21 Autoloaded defcustoms Lennart Borgman
2009-01-05 22:15 ` Stefan Monnier
2009-01-05 22:22 ` Lennart Borgman
2009-01-06 0:57 ` Juri Linkov
2009-01-06 2:16 ` Lennart Borgman
2009-01-06 3:20 ` Stefan Monnier
2009-01-06 12:27 ` Lennart Borgman
2009-01-06 14:54 ` Stefan Monnier
2009-01-06 15:00 ` Lennart Borgman
2009-01-06 15:07 ` Juri Linkov
2009-01-06 15:17 ` Lennart Borgman
2009-01-06 18:18 ` Chetan Pandya
2009-01-06 18:21 ` Lennart Borgman
2009-01-06 18:20 ` Stefan Monnier
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.