unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* override defcustom
@ 2002-08-30 14:46 Bruce Ingalls
  2002-08-31 16:19 ` Kai Großjohann
  0 siblings, 1 reply; 9+ messages in thread
From: Bruce Ingalls @ 2002-08-30 14:46 UTC (permalink / raw)


I'd like to override the system defcustom defaults, in a way that users 
can override my override.

Example:
{ignoring that modern X/Emacs now properly default 
font-lock-maximum-decoration = t}

I can set font-lock-maximum-decoration to t by
(custom-set-default font-lock-maximum-decoration t)
  "Toggle max colors for all modes."
   :group 'emacro
   :type 'boolean)

This works, except that now users who don't want max decoration, must 
now set it to nil in 2 places: the emacro and the original font-lock groups.

I tried some alternatives, such as

customize-set-variable()
and
custom-set-default()

but they don't byte-compile or eval properly.
Is it possible to customizably set these variables?
Thanks ahead, Bruce

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

* Re: override defcustom
  2002-08-30 14:46 Bruce Ingalls
@ 2002-08-31 16:19 ` Kai Großjohann
  2002-09-01  3:27   ` Bruce Ingalls
  0 siblings, 1 reply; 9+ messages in thread
From: Kai Großjohann @ 2002-08-31 16:19 UTC (permalink / raw)


Bruce Ingalls <bingalls@fit-zones.DELETE-THE-SPAM-BLOCK.com> writes:

> I'd like to override the system defcustom defaults, in a way that
> users can override my override.

What's wrong with using setq?

kai
-- 
A large number of young women don't trust men with beards.  (BFBS Radio)

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

* Re: override defcustom
  2002-08-31 16:19 ` Kai Großjohann
@ 2002-09-01  3:27   ` Bruce Ingalls
  2002-09-01 18:36     ` Kai Großjohann
  0 siblings, 1 reply; 9+ messages in thread
From: Bruce Ingalls @ 2002-09-01  3:27 UTC (permalink / raw)


Kai Großjohann wrote:
> Bruce Ingalls <bingalls@fit-zones.DELETE-THE-SPAM-BLOCK.com> writes:
> 
> 
>>I'd like to override the system defcustom defaults, in a way that
>>users can override my override.
> 
> 
> What's wrong with using setq?
> 
> kai

I am providing a .emacs (EMacro) for end users.
Currently, I do create some setq()s, and save them into a preferences 
file, so I suppose I could go that way.

I have built EMacro, so that it does not require any knowledge of 
programming, in order to use it. Defcustom has a nice visual interface.

Users of EMacro should need to dig through my code, in order to find out 
where I set font-lock-maximum-decoration to t.

The final problem, is that font-lock-maximum-decoration should be set in 
one place. If users cannot change font-lock-maximum-decoration, by 
running M-x customize, or its Menu equivalent, they will be confused.
I'd rather not explain that M-x customize sometimes does not work.

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

* Re: override defcustom
  2002-09-01  3:27   ` Bruce Ingalls
@ 2002-09-01 18:36     ` Kai Großjohann
  2002-09-02 14:32       ` Kai Großjohann
  0 siblings, 1 reply; 9+ messages in thread
From: Kai Großjohann @ 2002-09-01 18:36 UTC (permalink / raw)


Bruce Ingalls <bingalls@fit-zones.DELETE-THE-SPAM-BLOCK.com> writes:

> The final problem, is that font-lock-maximum-decoration should be set
> in one place. If users cannot change font-lock-maximum-decoration, by
> running M-x customize, or its Menu equivalent, they will be confused.
> I'd rather not explain that M-x customize sometimes does not work.

As long as the order of things is correct, it should work.  I think
requiring users to ensure the right order is not a problem.

You could also check in your emacro code to see whether the value is
still the default value before you change it.  If the value is not
the default value, then maybe the user customization comes too early,
and you could print a warning.

kai
-- 
A large number of young women don't trust men with beards.  (BFBS Radio)

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

* Re: override defcustom
  2002-09-01 18:36     ` Kai Großjohann
@ 2002-09-02 14:32       ` Kai Großjohann
  2002-09-03  5:44         ` Bruce Ingalls
  0 siblings, 1 reply; 9+ messages in thread
From: Kai Großjohann @ 2002-09-02 14:32 UTC (permalink / raw)


Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai Großjohann) writes:

> As long as the order of things is correct, it should work.  I think
> requiring users to ensure the right order is not a problem.
>
> You could also check in your emacro code to see whether the value is
> still the default value before you change it.  If the value is not
> the default value, then maybe the user customization comes too early,
> and you could print a warning.

But I think that your questions probably don't have such easy
answers.  Easy questions you can answer for yourself.  So I have a
feeling that I'm still missing something.

kai
-- 
A large number of young women don't trust men with beards.  (BFBS Radio)

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

* Re: override defcustom
  2002-09-02 14:32       ` Kai Großjohann
@ 2002-09-03  5:44         ` Bruce Ingalls
  2002-09-03 13:04           ` Kai Großjohann
  0 siblings, 1 reply; 9+ messages in thread
From: Bruce Ingalls @ 2002-09-03  5:44 UTC (permalink / raw)


I likely did not explain the problem precisely enough.
It now looks that both Modern Emacs & XEmacs properly (IMHO) default
font-lock-maximum-decoration to t. However, there are other custom
variables I would like to override.

The essentials work fine, if I create an emacro defcustom group, and do

(defcustom font-lock-maximum-decoration t
  "Toggle max colors for all modes."
   :group 'emacro
   :type 'boolean)

Some users will use M-x customize (or its menu equivalent), and will try 
to change the default setting.
Perhaps I am wrong, but I expect that they will be in for a surprise.
The problem is that font-lock-maximum-decoration is also set in the 
font-lock group.
Aren't users required to set this variable in both groups?
Unfortunately, they may only be aware of one group. :(

I could have EMacro generate setq() statements. However, customize() 
users will simply know that the font-lock-maximum-decoration variable is 
available, and again be disappointed.

I don't have a choice; Emacs & XEmacs already use such Customize 
Variables. I am also just as certain that I don't like the defaults 
provided. Finally, I want to provide a way that nonprogrammers can set 
their own defaults; customize() provides a user friendly menu to do just 
that.

Thanks, Bruce.

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

* Re: override defcustom
  2002-09-03  5:44         ` Bruce Ingalls
@ 2002-09-03 13:04           ` Kai Großjohann
  0 siblings, 0 replies; 9+ messages in thread
From: Kai Großjohann @ 2002-09-03 13:04 UTC (permalink / raw)


Bruce Ingalls <bingalls@fit-zones.DELETE-THE-SPAM-BLOCK.com> writes:

> I don't have a choice; Emacs & XEmacs already use such Customize
> Variables. I am also just as certain that I don't like the defaults
> provided. Finally, I want to provide a way that nonprogrammers can set
> their own defaults; customize() provides a user friendly menu to do
> just that.

Oh, boy.  I must be really thick.  I _still_ don't understand.

Do you just want a tailored list of options, so that people who say
M-x customize-group RET emacro RET see your list of options?  -- See
the `members' argument of defgroup.

I don't think it is a good idea to write two defcustom statements for
the same variable: the second defcustom will override the docstring
of the first, and so people see the emacro docstring instead of the
Emacs docstring.  Maybe the Emacs docstring has been improved?

Maybe I should have a look at emacro to learn what you're trying to
do, from an overview perspective.  But of course, lazy guy that I am,
I wouldn't mind if you told me :-)

kai
-- 
A large number of young women don't trust men with beards.  (BFBS Radio)

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

* override defcustom
@ 2002-09-08  2:53 Bruce Ingalls
  2002-09-08 20:24 ` Kai Großjohann
  0 siblings, 1 reply; 9+ messages in thread
From: Bruce Ingalls @ 2002-09-08  2:53 UTC (permalink / raw)


Kai-
Thanks for sticking with me on this one.
It appears my previous post did not make it.

EMacro <url: http://emacro.sf.net/ > is designed to make
Emacs/XEmacs easy to set up and use out of the box.

I don't like the system default setting of
	font-lock-maximum-decoration = nil
on older Emacsen. (Actual value is for argument's sake, there
are other variables I wish to set). Further, I do not wish to
force EMacro's defaults, which override the system defaults,
upon users. Beginning users should be able to do M-x customize,
or the menu equivalent (to override EMacro's override).

What can I do about it?
I can:

1) Give users instructions to customize these variables, with
every installation.

This defeats the purpose of EMacro, which is to save work.

2) Put setq()s in a preferences.el file.

This expects that users will ignore the nice Options menu, and
always be aware to edit this file, instead

3) Create an emacro customization group, and duplicate settings.

As you said, duplication is bad.

4) Ship emacs.el and xemacs.el files, with the custom-set-variables()
commands already set.

I've avoided sending my saved customizations, but this seems the
smoothest solution.

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

* Re: override defcustom
  2002-09-08  2:53 override defcustom Bruce Ingalls
@ 2002-09-08 20:24 ` Kai Großjohann
  0 siblings, 0 replies; 9+ messages in thread
From: Kai Großjohann @ 2002-09-08 20:24 UTC (permalink / raw)


Bruce Ingalls <bingalls@fit-zones.DELETE-THE-SPAM-BLOCK.com> writes:

> 2) Put setq()s in a preferences.el file.
>
> This expects that users will ignore the nice Options menu, and
> always be aware to edit this file, instead

I don't understand this.  I had a quick peek at emacro, and it
seems to contain a file init.el which is installed as ~/.emacs.  And
that file does (require 'emacro).  At the end of the file, Customize
might put its thing.

So if you execute (setq font-lock-maximum-decoration t) in emacro.el
or in a file loaded from there, then two things might happen:

(a) The user doesn't change it.  Then your default value takes.

(b) The user changes it via Customize.  Then the custom-set-variables
    statement comes last, so the Customize setting takes.

Isn't this exactly what you want?

Or is there still a misunderstanding involved?

There is only one problem with this: Customize will show the value as
"changed outside customize".  Maybe it would be nicer if it showed
"changed by emacro".  But this might be more a cosmetic problem.

If you tell Customize to change back to the default value, should it
set up the value you put in emacro, or should it set up the value
that comes up in "emacs -q -no-site-file"?

If you want "revert to default" to use your value, then you might be
able to use some low-level function to tel Customize what is the
default value.  (Ah, it seems to be (put
'font-lock-maximum-decoration 'standard-value (list YOUR-VALUE)).)  I
guess the advantage is also that Customize will not show "changed
outside Customize".

kai
-- 
A large number of young women don't trust men with beards.  (BFBS Radio)

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

end of thread, other threads:[~2002-09-08 20:24 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-09-08  2:53 override defcustom Bruce Ingalls
2002-09-08 20:24 ` Kai Großjohann
  -- strict thread matches above, loose matches on Subject: below --
2002-08-30 14:46 Bruce Ingalls
2002-08-31 16:19 ` Kai Großjohann
2002-09-01  3:27   ` Bruce Ingalls
2002-09-01 18:36     ` Kai Großjohann
2002-09-02 14:32       ` Kai Großjohann
2002-09-03  5:44         ` Bruce Ingalls
2002-09-03 13:04           ` Kai Großjohann

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).