Discussion:
defcustoms in style/*.el
Reiner Steib
2005-03-04 18:25:21 UTC
Permalink
Hi,

was have some defcustoms in style/*.el:

,----[ grep -nH -e '(defcustom' *.el ]
| amsmath.el:134:(defcustom LaTeX-amsmath-label LaTeX-equation-label
| beamer.el:24:(defcustom LaTeX-beamer-item-overlay-flag t
| csquotes.el:33:(defcustom LaTeX-csquotes-quote-after-quote nil
| csquotes.el:37:(defcustom LaTeX-csquotes-open-quote ""
| csquotes.el:45:(defcustom LaTeX-csquotes-close-quote ""
| emp.el:43:(defcustom LaTeX-write18-enabled-p t
`----

My feeling is, that this should better be placed in tex.el or latex.el
(as I did for when introducing defcustoms in style/graphicx.el and
style/beamer.el). I think it is better to have those variables
available [1,2] after loading AUCTeX, no matter if a beamer, amsmath
or ... is used in this Emacs session.

An alternative approach would be to collect those defcustoms in a
separate file, say (la)tex-style.el, and require this file somewhere.

WDYT?

Bye, Reiner.

[1] E.g. with `M-x customize-group RET LaTeX-macro RET'

[2] For the defvars, I don't find it necessary.
--
,,,
(o o)
---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/
Ralf Angeli
2005-03-04 22:09:22 UTC
Permalink
[...]
Post by Reiner Steib
My feeling is, that this should better be placed in tex.el or latex.el
(as I did for when introducing defcustoms in style/graphicx.el and
style/beamer.el). I think it is better to have those variables
available [1,2] after loading AUCTeX, no matter if a beamer, amsmath
or ... is used in this Emacs session.
An alternative approach would be to collect those defcustoms in a
separate file, say (la)tex-style.el, and require this file somewhere.
WDYT?
Would it be possible to autoload these defcustoms? At least the Elisp
manual states that this can be done with ;;;###autoload cookies:

,----[ (info "(elisp)Autoload") ]
| The same magic comment can copy any kind of form into `loaddefs.el'.
| If the form following the magic comment is not a function-defining
| form or a `defcustom' form, it is copied verbatim. "Function-defining
| forms" include `define-skeleton', `define-derived-mode',
| `define-generic-mode' and `define-minor-mode' as well as `defun' and
| `defmacro'. To save space, a `defcustom' form is converted to a
| `defvar' in `loaddefs.el', with some additional information if it uses
| `:require'.
`----
--
Ralf
Reiner Steib
2005-03-05 10:50:56 UTC
Permalink
Post by Ralf Angeli
[...]
Post by Reiner Steib
My feeling is, that this should better be placed in tex.el or latex.el
(as I did for when introducing defcustoms in style/graphicx.el and
style/beamer.el). I think it is better to have those variables
available [1,2] after loading AUCTeX, no matter if a beamer, amsmath
or ... is used in this Emacs session.
Do you (and other people) agree, that it would be desirable to have
those custom variables available after loading AUCTeX?
Post by Ralf Angeli
Post by Reiner Steib
An alternative approach would be to collect those defcustoms in a
separate file, say (la)tex-style.el, and require this file somewhere.
WDYT?
Would it be possible to autoload these defcustoms? At least the Elisp
I don't think so. Our installation process would need to parse the
style/*.el files and create a e.g. tex-autoload.el file (or put them
in tex-site.el?). And this file needs to be loaded at startup. And I
doubt that this approach would work nicely because the usual Emacs
load process ((load "beamer.el") and friends) won't work because
style/ is not supposed to be in `load-path'. (I didn't test this,
though. Maybe I'm wrong.)

Bye, Reiner.
--
,,,
(o o)
---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/
Ralf Angeli
2005-03-05 12:08:14 UTC
Permalink
* Reiner Steib (2005-03-05) writes:

[defustoms in AUCTeX style files]
Post by Reiner Steib
Do you (and other people) agree, that it would be desirable to have
those custom variables available after loading AUCTeX?
Yes, but I dislike the idea of moving them out of the style files.
Post by Reiner Steib
Post by Ralf Angeli
Post by Reiner Steib
An alternative approach would be to collect those defcustoms in a
separate file, say (la)tex-style.el, and require this file somewhere.
WDYT?
Would it be possible to autoload these defcustoms? At least the Elisp
I don't think so. Our installation process would need to parse the
style/*.el files and create a e.g. tex-autoload.el file (or put them
in tex-site.el?). And this file needs to be loaded at startup. And I
doubt that this approach would work nicely because the usual Emacs
load process ((load "beamer.el") and friends) won't work because
style/ is not supposed to be in `load-path'. (I didn't test this,
though. Maybe I'm wrong.)
I looked at loaddefs.el and found `custom-autoload'. If I am not
mistaken we could use this instead of an ;;;###autoload cookie.
Wether these custom-autoloads go into tex-site.el, tex.el, latex.el
etc. probably depends on what the defcustoms are used for. If they
are related to latex-mode, they should go into latex.el; analogously
for other modes. This would also fit with other customization options
in mode-specific files which won't show up unless the file gets loaded
by opening a file which triggers the mode.
--
Ralf
Peter S Galbraith
2005-03-05 16:18:15 UTC
Permalink
Post by Ralf Angeli
[defustoms in AUCTeX style files]
Post by Reiner Steib
Do you (and other people) agree, that it would be desirable to have
those custom variables available after loading AUCTeX?
Yes, but I dislike the idea of moving them out of the style files.
I haven't followed all of theis discussion, so maybe I'm missing something.
But as a side note, we faced the same question in the MH-E project and
decided to have _all_ defcustoms available upon loading MH-E, whether
all pieces are loaded or not. So we moved all defcustoms to a new file
(mh-customize.el) and load that from the MH-E entry points.

Peter
Reiner Steib
2005-03-05 16:45:41 UTC
Permalink
Post by Ralf Angeli
[defustoms in AUCTeX style files]
Post by Reiner Steib
Do you (and other people) agree, that it would be desirable to have
those custom variables available after loading AUCTeX?
Yes, but I dislike the idea of moving them out of the style files.
[...]
Post by Ralf Angeli
I looked at loaddefs.el and found `custom-autoload'. If I am not
mistaken we could use this instead of an ;;;###autoload cookie.
Wether these custom-autoloads go into tex-site.el, tex.el, latex.el
etc. probably depends on what the defcustoms are used for.
This doesn't help with the load problem I mentioned:

Putting...
(custom-autoload (quote LaTeX-beamer-foo-variable) "beamer")
... `tex-site.el (or ...) will not trigger loading "style/beamer.elc"
with `M-x customize-group'. Or am I missing something?

Bye, Reiner.
--
,,,
(o o)
---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/
Ralf Angeli
2005-03-05 17:21:15 UTC
Permalink
Post by Reiner Steib
Post by Ralf Angeli
I looked at loaddefs.el and found `custom-autoload'. If I am not
mistaken we could use this instead of an ;;;###autoload cookie.
Wether these custom-autoloads go into tex-site.el, tex.el, latex.el
etc. probably depends on what the defcustoms are used for.
Putting...
(custom-autoload (quote LaTeX-beamer-foo-variable) "beamer")
... `tex-site.el (or ...) will not trigger loading "style/beamer.elc"
with `M-x customize-group'. Or am I missing something?
Hm, the autoload mechanism does not allow to define which group the
defcustom will belong to. )c:

I tried that with

(custom-autoload (quote LaTeX-beamer-item-overlay-flag) "style/beamer")

which at least allows the variable to be accessible with `M-x
customize-variable RET' despite the file not being in load-path.

In that case I'd probably leave things as they are. But I won't
object if others want to have the defcustoms defined in style files
moved into a separate file (possibly in the style/ subdirectory).

Peter's suggestion seems a bit radical to me because we have some
defcustoms which use non-trivial functions for their default value or
:set directives. And this could complicate things.
--
Ralf
Reiner Steib
2005-03-06 22:16:59 UTC
Permalink
But I won't object if others want to have the defcustoms defined in
style files moved into a separate file
Unless other people object, I will do the following: Move the
defcustoms from style/{amsmath,beamer,csquotes,emp}.el and the
graphicx and beamer related defcustoms from latex.el to a new file. I
suggest the name `tex-style.el' although it affects only LaTeX and not
plain TeX style files (separation of TeX and LaTeX would be overkill
here, I think).
(possibly in the style/ subdirectory).
I'd prefer to have it in the base directory so we can require it.
Peter's suggestion seems a bit radical to me because we have some
defcustoms which use non-trivial functions for their default value or
:set directives. And this could complicate things.
I also think that this approach would be too radical for AUCTeX.

Bye, Reiner.
--
,,,
(o o)
---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/
Peter S Galbraith
2005-03-07 04:11:45 UTC
Permalink
Post by Reiner Steib
Post by Ralf Angeli
Peter's suggestion seems a bit radical to me because we have some
defcustoms which use non-trivial functions for their default value or
:set directives. And this could complicate things.
I also think that this approach would be too radical for AUCTeX.
:-)

Actually, I've used some hairy :set stuff in MH-E as well! ;-)

BTW, I'm off on my annual oceanographic survey of the Gulf of
St. Lawrence by helicopter tomorrow, so I'll be offline for a few
weeks.

Peter
Reiner Steib
2005-03-07 18:38:00 UTC
Permalink
Post by Reiner Steib
But I won't object if others want to have the defcustoms defined in
style files moved into a separate file
Unless other people object, I will do the following: Move the
defcustoms from style/{amsmath,beamer,csquotes,emp}.el and the
graphicx and beamer related defcustoms from latex.el to a new file. I
suggest the name `tex-style.el' although it affects only LaTeX and not
plain TeX style files (separation of TeX and LaTeX would be overkill
here, I think).
Done. Please holler if it breaks something.

Bye, Reiner.
--
,,,
(o o)
---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/
Ralf Angeli
2005-03-07 18:40:59 UTC
Permalink
Post by Reiner Steib
Post by Reiner Steib
But I won't object if others want to have the defcustoms defined in
style files moved into a separate file
Unless other people object, I will do the following: Move the
defcustoms from style/{amsmath,beamer,csquotes,emp}.el and the
graphicx and beamer related defcustoms from latex.el to a new file. I
suggest the name `tex-style.el' although it affects only LaTeX and not
plain TeX style files (separation of TeX and LaTeX would be overkill
here, I think).
Done. Please holler if it breaks something.
Does my heart count?
--
Ralf
David Kastrup
2005-03-08 08:19:17 UTC
Permalink
Post by Ralf Angeli
Post by Reiner Steib
Post by Reiner Steib
But I won't object if others want to have the defcustoms defined in
style files moved into a separate file
Unless other people object, I will do the following: Move the
defcustoms from style/{amsmath,beamer,csquotes,emp}.el and the
graphicx and beamer related defcustoms from latex.el to a new file. I
suggest the name `tex-style.el' although it affects only LaTeX and not
plain TeX style files (separation of TeX and LaTeX would be overkill
here, I think).
Done. Please holler if it breaks something.
Does my heart count?
I think it reasonable to collect customizations automatically. It
does not seem like a good idea to bind them into tex-site.el itself
but rather put them into a file loaded by it, so that one can
regenerate them in case of need.

Apart from the automatic regeneration, this seems to be what Reiner
did.
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
Ralf Angeli
2005-03-08 08:40:28 UTC
Permalink
Post by David Kastrup
Post by Ralf Angeli
Post by Reiner Steib
Post by Reiner Steib
Unless other people object, I will do the following: Move the
defcustoms from style/{amsmath,beamer,csquotes,emp}.el and the
graphicx and beamer related defcustoms from latex.el to a new file. I
suggest the name `tex-style.el' although it affects only LaTeX and not
plain TeX style files (separation of TeX and LaTeX would be overkill
here, I think).
Done. Please holler if it breaks something.
Does my heart count?
I think it reasonable to collect customizations automatically. It
does not seem like a good idea to bind them into tex-site.el itself
but rather put them into a file loaded by it, so that one can
regenerate them in case of need.
Apart from the automatic regeneration, this seems to be what Reiner
did.
The thing I don't like about putting the defcustoms into a separate
file is that they are not near the actual code they are used in
anymore. This may lead to inconveniences during coding and is
somewhat contrary to the rather decentralized approach we have with
the style files.

I'd rather like to have this solved with autoload. But as we saw,
Customize is not able to build a buffer with autoloaded defcustoms as
they don't provide information to which group they belong. This is a
missing feature of the autoload mechanism. In this context Reiner's
solution may be a workable compromise but that does not mean I have to
like it.

With regard to promising not to object to this change I talked too
much already, so I'll better shut up now.
--
Ralf
David Kastrup
2005-03-08 10:06:34 UTC
Permalink
Post by Ralf Angeli
The thing I don't like about putting the defcustoms into a separate
file is that they are not near the actual code they are used in
anymore. This may lead to inconveniences during coding and is
somewhat contrary to the rather decentralized approach we have with
the style files.
I'd rather like to have this solved with autoload. But as we saw,
Customize is not able to build a buffer with autoloaded defcustoms
as they don't provide information to which group they belong.
Well, so what? Then we'll just place explicit :group tags into every
defcustom. I don't see the problem.
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
Ralf Angeli
2005-03-08 10:16:51 UTC
Permalink
Post by David Kastrup
Post by Ralf Angeli
The thing I don't like about putting the defcustoms into a separate
file is that they are not near the actual code they are used in
anymore. This may lead to inconveniences during coding and is
somewhat contrary to the rather decentralized approach we have with
the style files.
I'd rather like to have this solved with autoload. But as we saw,
Customize is not able to build a buffer with autoloaded defcustoms
as they don't provide information to which group they belong.
Well, so what? Then we'll just place explicit :group tags into every
defcustom. I don't see the problem.
Could you elaborate on that?

I tried

(custom-autoload (quote LaTeX-beamer-item-overlay-flag) "style/beamer")

which did not work[1] despite `LaTeX-beamer-item-overlay-flag' having had
a ":group 'LaTeX-macro" tag until yesterday. (It now has a ":group
'LaTeX-style" tag.) And I am not really sure if I am bending the
definition of `custom-autoload' too much by using something like
"style/beamer".


Footnotes:
[1] See <URL:http://article.gmane.org/gmane.emacs.auc-tex/5958>.
--
Ralf
David Kastrup
2005-03-08 10:29:17 UTC
Permalink
Post by Ralf Angeli
Post by David Kastrup
Post by Ralf Angeli
The thing I don't like about putting the defcustoms into a separate
file is that they are not near the actual code they are used in
anymore. This may lead to inconveniences during coding and is
somewhat contrary to the rather decentralized approach we have with
the style files.
I'd rather like to have this solved with autoload. But as we saw,
Customize is not able to build a buffer with autoloaded defcustoms
as they don't provide information to which group they belong.
Well, so what? Then we'll just place explicit :group tags into every
defcustom. I don't see the problem.
Could you elaborate on that?
I tried
(custom-autoload (quote LaTeX-beamer-item-overlay-flag) "style/beamer")
which did not work[1] despite `LaTeX-beamer-item-overlay-flag' having had
a ":group 'LaTeX-macro" tag until yesterday. (It now has a ":group
'LaTeX-style" tag.) And I am not really sure if I am bending the
definition of `custom-autoload' too much by using something like
"style/beamer".
Ok, so maybe I misunderstood the process. Would using any of
(defun custom-add-to-group (group option widget)
"To existing GROUP add a new OPTION of type WIDGET.
If there already is an entry for OPTION and WIDGET, nothing is done."
...

(defun custom-group-of-mode (mode)
"Return the custom group corresponding to the major or minor MODE.
If no such group is found, return nil."

be helpful for the task at hand?
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
Ralf Angeli
2005-03-08 11:17:49 UTC
Permalink
Post by David Kastrup
Post by Ralf Angeli
Post by David Kastrup
Post by Ralf Angeli
I'd rather like to have this solved with autoload. But as we saw,
Customize is not able to build a buffer with autoloaded defcustoms
as they don't provide information to which group they belong.
Well, so what? Then we'll just place explicit :group tags into every
defcustom. I don't see the problem.
Could you elaborate on that?
I tried
(custom-autoload (quote LaTeX-beamer-item-overlay-flag) "style/beamer")
which did not work[1] despite `LaTeX-beamer-item-overlay-flag' having had
a ":group 'LaTeX-macro" tag until yesterday. (It now has a ":group
'LaTeX-style" tag.) And I am not really sure if I am bending the
definition of `custom-autoload' too much by using something like
"style/beamer".
Ok, so maybe I misunderstood the process. Would using any of
(defun custom-add-to-group (group option widget)
[...]
Post by David Kastrup
be helpful for the task at hand?
It seems to work. With tex-style.el not loaded, try

(progn
(custom-autoload 'LaTeX-beamer-item-overlay-flag "tex-style")
(custom-add-to-group 'emacs 'LaTeX-beamer-item-overlay-flag 'custom-variable)
(customize-group 'emacs))

But I am not sure if this helps much because there still is the
problem with the style files not being in load-path. Using
"style/whatever" probably only works by accident. In addition it
would be nice if one would not have to deal with Customize internals
to achieve this. It seems a bit dangerous.
--
Ralf
Loading...