emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* missing autoload cookies for defcustom?
@ 2011-10-09 15:20 Achim Gratz
  2011-10-09 15:50 ` Carsten Dominik
  0 siblings, 1 reply; 4+ messages in thread
From: Achim Gratz @ 2011-10-09 15:20 UTC (permalink / raw)
  To: emacs-orgmode


While playing aroud with different configurations I've noticed that you
can't customize some variables unless you've loaded org first and then
used a function from the file where they are defined.  It's of course a
bit difficult to know which function to use or file to load when all you
want to do is customizing a variable that you've read about in the
manual or on Worg.

It seems that all defcustom forms that are not defined in org.el (and
maybe even those) should get an autoload cookie so that they are
collected into org-install.el and Emacs knows where to find them even if
their source file had not been loaded yet.  The following perl
invocation fixes all occurences of defcustom that aren't already having
an autoload cookie set.

perl -i -p \
-e 'BEGIN{$o=0;}' \
-e 'if ( /^\s*\(defcustom/ ) {' \
-e '  print ";;;###autoload\n" unless $o;' \
-e '} else {' \
-e '  $o=/^;;;###autoload/;' \
-e '}' \
lisp/*.el

(the \s* in the regex is for a mis-indented item in org-feed.el)

This should produce the following diffstat on current master:

 lisp/ob-exp.el          |    1 +
 lisp/ob-js.el           |    1 +
 lisp/ob-lisp.el         |    1 +
 lisp/ob-lob.el          |    1 +
 lisp/ob-plantuml.el     |    1 +
 lisp/ob-scheme.el       |    1 +
 lisp/ob-sh.el           |    1 +
 lisp/ob-tangle.el       |    6 ++
 lisp/ob.el              |    2 +
 lisp/org-agenda.el      |   94 +++++++++++++++++++++
 lisp/org-archive.el     |    7 ++
 lisp/org-ascii.el       |    5 +
 lisp/org-attach.el      |    7 ++
 lisp/org-bbdb.el        |    4 +
 lisp/org-beamer.el      |    9 ++
 lisp/org-bibtex.el      |    9 ++
 lisp/org-capture.el     |    3 +
 lisp/org-clock.el       |   26 ++++++
 lisp/org-crypt.el       |    3 +
 lisp/org-ctags.el       |    3 +
 lisp/org-docbook.el     |   16 ++++
 lisp/org-entities.el    |    2 +
 lisp/org-exp-blocks.el  |    4 +
 lisp/org-exp.el         |   43 ++++++++++
 lisp/org-faces.el       |    8 ++
 lisp/org-feed.el        |    7 ++
 lisp/org-footnote.el    |    6 ++
 lisp/org-freemind.el    |    2 +
 lisp/org-gnus.el        |    2 +
 lisp/org-habit.el       |    7 ++
 lisp/org-html.el        |   35 ++++++++
 lisp/org-icalendar.el   |   16 ++++
 lisp/org-id.el          |    8 ++
 lisp/org-indent.el      |    4 +
 lisp/org-inlinetask.el  |    3 +
 lisp/org-jsinfo.el      |    3 +
 lisp/org-latex.el       |   37 +++++++++
 lisp/org-list.el        |   14 +++
 lisp/org-mac-message.el |    1 +
 lisp/org-mew.el         |    1 +
 lisp/org-mhe.el         |    1 +
 lisp/org-mobile.el      |   13 +++
 lisp/org-mouse.el       |    2 +
 lisp/org-protocol.el    |    4 +
 lisp/org-publish.el     |   11 +++
 lisp/org-remember.el    |   10 +++
 lisp/org-src.el         |    9 ++
 lisp/org-table.el       |   21 +++++
 lisp/org-taskjuggler.el |    8 ++
 lisp/org-timer.el       |    2 +
 lisp/org-wl.el          |    6 ++
 lisp/org.el             |  207 +++++++++++++++++++++++++++++++++++++++++++++++
 52 files changed, 698 insertions(+), 0 deletions(-)

This is obviously quite heavy-handed and there is vocal opposition among
the Emacs maintainers towards autoloading defcustoms.  While I partly
understand their rationale, I don't think it applies to org-mode (these
autoloads only become effective when org-install is loaded).  Also, I
don't really see what the alternative should be, unless all those
defcustoms would be moved into separate files that would then be
required by org-install (I'm not suggesting to do that, BTW).  Also it
appears that there is no way to autoload a defgroup form, so that one
would need to be handled in a different way, maybe by moving all
defgroups into org.el.  Thoughts?


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

SD adaptations for KORG EX-800 and Poly-800MkII V0.9:
http://Synth.Stromeko.net/Downloads.html#KorgSDada

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: missing autoload cookies for defcustom?
  2011-10-09 15:20 missing autoload cookies for defcustom? Achim Gratz
@ 2011-10-09 15:50 ` Carsten Dominik
  2011-10-09 16:26   ` Achim Gratz
  0 siblings, 1 reply; 4+ messages in thread
From: Carsten Dominik @ 2011-10-09 15:50 UTC (permalink / raw)
  To: Achim Gratz; +Cc: emacs-orgmode


On 9.10.2011, at 17:20, Achim Gratz wrote:

> 
> While playing aroud with different configurations I've noticed that you
> can't customize some variables unless you've loaded org first and then
> used a function from the file where they are defined.  It's of course a
> bit difficult to know which function to use or file to load when all you
> want to do is customizing a variable that you've read about in the
> manual or on Worg.

Yes, this is an issue.

> 
> It seems that all defcustom forms that are not defined in org.el (and
> maybe even those) should get an autoload cookie so that they are
> collected into org-install.el and Emacs knows where to find them even if
> their source file had not been loaded yet.  The following perl
> invocation fixes all occurences of defcustom that aren't already having
> an autoload cookie set.
> 
> perl -i -p \
> -e 'BEGIN{$o=0;}' \
> -e 'if ( /^\s*\(defcustom/ ) {' \
> -e '  print ";;;###autoload\n" unless $o;' \
> -e '} else {' \
> -e '  $o=/^;;;###autoload/;' \
> -e '}' \
> lisp/*.el
> 
> (the \s* in the regex is for a mis-indented item in org-feed.el)
> 
> This should produce the following diffstat on current master:
> 
> lisp/ob-exp.el          |    1 +
> lisp/ob-js.el           |    1 +
> lisp/ob-lisp.el         |    1 +
> lisp/ob-lob.el          |    1 +
> lisp/ob-plantuml.el     |    1 +
> lisp/ob-scheme.el       |    1 +
> lisp/ob-sh.el           |    1 +
> lisp/ob-tangle.el       |    6 ++
> lisp/ob.el              |    2 +
> lisp/org-agenda.el      |   94 +++++++++++++++++++++
> lisp/org-archive.el     |    7 ++
> lisp/org-ascii.el       |    5 +
> lisp/org-attach.el      |    7 ++
> lisp/org-bbdb.el        |    4 +
> lisp/org-beamer.el      |    9 ++
> lisp/org-bibtex.el      |    9 ++
> lisp/org-capture.el     |    3 +
> lisp/org-clock.el       |   26 ++++++
> lisp/org-crypt.el       |    3 +
> lisp/org-ctags.el       |    3 +
> lisp/org-docbook.el     |   16 ++++
> lisp/org-entities.el    |    2 +
> lisp/org-exp-blocks.el  |    4 +
> lisp/org-exp.el         |   43 ++++++++++
> lisp/org-faces.el       |    8 ++
> lisp/org-feed.el        |    7 ++
> lisp/org-footnote.el    |    6 ++
> lisp/org-freemind.el    |    2 +
> lisp/org-gnus.el        |    2 +
> lisp/org-habit.el       |    7 ++
> lisp/org-html.el        |   35 ++++++++
> lisp/org-icalendar.el   |   16 ++++
> lisp/org-id.el          |    8 ++
> lisp/org-indent.el      |    4 +
> lisp/org-inlinetask.el  |    3 +
> lisp/org-jsinfo.el      |    3 +
> lisp/org-latex.el       |   37 +++++++++
> lisp/org-list.el        |   14 +++
> lisp/org-mac-message.el |    1 +
> lisp/org-mew.el         |    1 +
> lisp/org-mhe.el         |    1 +
> lisp/org-mobile.el      |   13 +++
> lisp/org-mouse.el       |    2 +
> lisp/org-protocol.el    |    4 +
> lisp/org-publish.el     |   11 +++
> lisp/org-remember.el    |   10 +++
> lisp/org-src.el         |    9 ++
> lisp/org-table.el       |   21 +++++
> lisp/org-taskjuggler.el |    8 ++
> lisp/org-timer.el       |    2 +
> lisp/org-wl.el          |    6 ++
> lisp/org.el             |  207 +++++++++++++++++++++++++++++++++++++++++++++++
> 52 files changed, 698 insertions(+), 0 deletions(-)
> 
> This is obviously quite heavy-handed and there is vocal opposition among
> the Emacs maintainers towards autoloading defcustoms.  While I partly
> understand their rationale, I don't think it applies to org-mode (these
> autoloads only become effective when org-install is loaded).

This is not correct for Org when it is distributed with Emacs.  Emacs
builds its own autoload files, and it would pull in all these defcustoms.

The work-around Org itself provides is to provide a command to load all
the autolod files, so that then, the defcustoms will be available.
The function is `org-require-autoloaded-modules'.  Also, if you
run `M-x org-customize', this will happen automatically.

Maybe we just need to document this in a good place?

- Carsten

>  Also, I
> don't really see what the alternative should be, unless all those
> defcustoms would be moved into separate files that would then be
> required by org-install (I'm not suggesting to do that, BTW).  Also it
> appears that there is no way to autoload a defgroup form, so that one
> would need to be handled in a different way, maybe by moving all
> defgroups into org.el.  Thoughts?
> 
> 
> Regards,
> Achim.
> -- 
> +<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+
> 
> SD adaptations for KORG EX-800 and Poly-800MkII V0.9:
> http://Synth.Stromeko.net/Downloads.html#KorgSDada
> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: missing autoload cookies for defcustom?
  2011-10-09 15:50 ` Carsten Dominik
@ 2011-10-09 16:26   ` Achim Gratz
  2011-10-10  5:26     ` Carsten Dominik
  0 siblings, 1 reply; 4+ messages in thread
From: Achim Gratz @ 2011-10-09 16:26 UTC (permalink / raw)
  To: emacs-orgmode

Carsten Dominik <carsten.dominik@gmail.com> writes:
> This is not correct for Org when it is distributed with Emacs.  Emacs
> builds its own autoload files, and it would pull in all these defcustoms.

I see, so what about those autoloaded defcustoms org-mode already has
picked up?  Should they not be removed, then?

lisp/ob-tangle.el: (defcustom org-babel-tangle-lang-exts
lisp/org-export-generic.el: (defcustom org-export-generic-links-to-notes t
lisp/org-man.el: (defcustom org-man-command 'man

It seems that this would be a common problem, but I can't find a better
solution.  Something like a special autoload cookie that only triggers
on some other function (or possibly autoload)...

> The work-around Org itself provides is to provide a command to load all
> the autolod files, so that then, the defcustoms will be available.
> The function is `org-require-autoloaded-modules'.  Also, if you
> run `M-x org-customize', this will happen automatically.
>
> Maybe we just need to document this in a good place?

Sure, I certainly didn't know about it - but then it probably still
misses the target audience.

Also, it seems that not all defcustoms are picked up that way: after
switching to the Org customize group via customize-group I only get
about 500 completions for customize-variable, whereas the sources have
over 700.  Calling org-customize manually increases the number of
"known" variables to 679, but still not all of them.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Factory and User Sound Singles for Waldorf Q+, Q and microQ:
http://Synth.Stromeko.net/Downloads.html#WaldorfSounds

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: missing autoload cookies for defcustom?
  2011-10-09 16:26   ` Achim Gratz
@ 2011-10-10  5:26     ` Carsten Dominik
  0 siblings, 0 replies; 4+ messages in thread
From: Carsten Dominik @ 2011-10-10  5:26 UTC (permalink / raw)
  To: Achim Gratz; +Cc: emacs-orgmode


On 9.10.2011, at 18:26, Achim Gratz wrote:

> Carsten Dominik <carsten.dominik@gmail.com> writes:
>> This is not correct for Org when it is distributed with Emacs.  Emacs
>> builds its own autoload files, and it would pull in all these defcustoms.
> 
> I see, so what about those autoloaded defcustoms org-mode already has
> picked up?  Should they not be removed, then?

Good question. Not sure.

> 
> lisp/ob-tangle.el: (defcustom org-babel-tangle-lang-exts
> lisp/org-export-generic.el: (defcustom org-export-generic-links-to-notes t
> lisp/org-man.el: (defcustom org-man-command 'man
> 
> It seems that this would be a common problem, but I can't find a better
> solution.  Something like a special autoload cookie that only triggers
> on some other function (or possibly autoload)...
> 
>> The work-around Org itself provides is to provide a command to load all
>> the autolod files, so that then, the defcustoms will be available.
>> The function is `org-require-autoloaded-modules'.  Also, if you
>> run `M-x org-customize', this will happen automatically.
>> 
>> Maybe we just need to document this in a good place?
> 
> Sure, I certainly didn't know about it - but then it probably still
> misses the target audience.
> 
> Also, it seems that not all defcustoms are picked up that way: after
> switching to the Org customize group via customize-group I only get
> about 500 completions for customize-variable, whereas the sources have
> over 700.  Calling org-customize manually increases the number of
> "known" variables to 679, but still not all of them.

Yes, this might be possible.  I think it does not pick up modules that can, but have not been, requested via the `org-modules' variable.  I.e. once you have decided to use a module and turned it on with org-modules, you should get your variables defined with org-customize.

Regards

- Carsten


> 
> 
> Regards,
> Achim.
> -- 
> +<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+
> 
> Factory and User Sound Singles for Waldorf Q+, Q and microQ:
> http://Synth.Stromeko.net/Downloads.html#WaldorfSounds
> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-10-10  5:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-09 15:20 missing autoload cookies for defcustom? Achim Gratz
2011-10-09 15:50 ` Carsten Dominik
2011-10-09 16:26   ` Achim Gratz
2011-10-10  5:26     ` Carsten Dominik

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).