unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* multiple queries to delete excess backup version w/ custom
@ 2008-01-04 20:41 Tom Tromey
  2008-01-04 22:37 ` martin rudalics
  2008-01-05 14:31 ` Richard Stallman
  0 siblings, 2 replies; 20+ messages in thread
From: Tom Tromey @ 2008-01-04 20:41 UTC (permalink / raw)
  To: emacs-pretest-bug


Please write in English if possible, because the Emacs maintainers
usually do not have translators to read other languages for them.

Your bug report will be posted to the emacs-pretest-bug@gnu.org mailing list.

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:

Today I customized some calendar settings.
I made several changes in one page, then clicked "Save for future
sessions".

I got multiple dialog boxes, one after another, all asking whether I
wanted to delete excess backup versions of ~/.emacs.custom.

I think I should only be asked once per save, at most.
Not asking at all would also be ok by me.


If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
If you would like to further debug the crash, please read the file
/usr/share/emacs/22.0.990/etc/DEBUG for instructions.


In GNU Emacs 22.0.990.1 (i386-koji-linux-gnu, GTK+ Version 2.10.11)
 of 2007-05-23 on xenbuilder3.fedora.phx.redhat.com
Windowing system distributor `The X.Org Foundation', version 11.0.70101000
configured using `configure  '--build=i386-koji-linux-gnu' '--host=i386-koji-linux-gnu' '--target=i386-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--with-pop' '--with-sound' '--with-gtk' 'build_alias=i386-koji-linux-gnu' 'host_alias=i386-koji-linux-gnu' 'target_alias=i386-redhat-linux-gnu' 'CFLAGS=-DMAIL_USE_LOCKF -DSYSTEM_PURESIZE_EXTRA=16777216 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8
  default-enable-multibyte-characters: t

Major mode: Custom

Minor modes in effect:
  compilation-in-progress: (compilation grep grep grep grep grep grep grep grep grep gid gid grep)
  erc-menu-mode: t
  erc-autojoin-mode: t
  erc-ring-mode: t
  erc-pcomplete-mode: t
  erc-track-mode: t
  erc-track-minor-mode: t
  erc-match-mode: t
  erc-button-mode: t
  erc-fill-mode: t
  erc-stamp-mode: t
  erc-netsplit-mode: t
  erc-spelling-mode: t
  erc-truncate-mode: t
  erc-status-mode: t
  erc-services-mode: t
  erc-irccontrols-mode: t
  erc-noncommands-mode: t
  erc-readonly-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  unify-8859-on-encoding-mode: t
  utf-translate-cjk-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
<mouse-5> <double-down-mouse-5> <double-mouse-5> <triple-down-mouse-5> 
<triple-mouse-5> <down-mouse-5> <mouse-5> <help-echo> 
<down-mouse-1> <mouse-movement> <mouse-1> <help-echo> 
<down-mouse-1> <mouse-1> <help-echo> <down-mouse-1> 
<help-echo> <mouse-1> <help-echo> <help-echo> <help-echo> 
<help-echo> <down-mouse-1> <help-echo> <down-mouse-1> 
<help-echo> <help-echo> <down-mouse-1> <mouse-1> <help-echo> 
<help-echo> <down-mouse-1> <mouse-1> <help-echo> <down-mouse-1> 
<mouse-1> <help-echo> <down-mouse-1> <mouse-1> <down-mouse-1> 
<mouse-1> <help-echo> <help-echo> <down-mouse-1> <mouse-1> 
<down-mouse-1> <mouse-movement> <mouse-movement> <drag-mouse-1> 
<down-mouse-3> <mouse-3> <help-echo> <down-mouse-1> 
<mouse-1> <help-echo> <down-mouse-1> <help-echo> <mouse-movement> 
<mouse-movement> <drag-mouse-1> <down-mouse-1> <mouse-1> 
<help-echo> <switch-frame> <help-echo> <down-mouse-2> 
<help-echo> <mouse-2> <help-echo> C-c b <down-mouse-1> 
<mouse-1> y e a h <return> C-x 4 b c a l <tab> <M-backspace> 
<M-backspace> * c <tab> a l <tab> C-x 1 <help-echo> 
q C-c b C-c b C-x b c a l <tab> <return> C-x k <return> 
C-x b D <tab> <return> C-x k <return> <switch-frame> 
<help-echo> <next> <next> <next> <next> <next> <prior> 
<prior> <prior> <prior> <prior> <prior> <prior> <help-echo> 
<help-echo> <help-echo> <help-echo> <help-echo> <down-mouse-1> 
<mouse-movement> <help-echo> <mouse-1> <help-echo> 
<help-echo> <help-echo> <down-mouse-1> <mouse-1> <help-echo> 
<down-mouse-1> <mouse-1> z o C-g C-g C-z o C-x b * 
M e s <tab> <return> M-> C-c b <switch-frame> <switch-frame> 
<switch-frame> <help-echo> <switch-frame> <switch-frame> 
<help-echo> <help-echo> <help-echo> <help-echo> <down-mouse-1> 
<mouse-movement> <mouse-1> <help-echo> <help-echo> 
<help-echo> <down-mouse-1> <mouse-1> <help-echo> <help-echo> 
<down-mouse-1> <help-echo> <mouse-movement> <mouse-1> 
<help-echo> <help-echo> <help-echo> <down-mouse-1> 
<mouse-1> <switch-frame> <help-echo> <switch-frame> 
<down-mouse-5> <mouse-5> <next> <next> <next> <prior> 
<help-echo> <down-mouse-5> <mouse-5> <double-down-mouse-5> 
<double-mouse-5> <help-echo> <down-mouse-1> <mouse-movement> 
<mouse-2> <help-echo> <down-mouse-1> <mouse-1> <help-echo> 
<help-echo> <down-mouse-1> <mouse-1> <switch-frame> 
q <help-echo> <switch-frame> <help-echo> q <next> <help-echo> 
<down-mouse-1> <mouse-1> <help-echo> <help-echo> <help-echo> 
<down-mouse-1> <mouse-1> <help-echo> <help-echo> <next> 
<next> <prior> <prior> <prior> <next> <next> <next> 
<prior> <help-echo> <down-mouse-1> <mouse-1> <help-echo> 
<down-mouse-5> <mouse-5> <down-mouse-5> <mouse-5> <help-echo> 
<help-echo> <down-mouse-1> <mouse-1> <help-echo> <help-echo> 
<help-echo> <down-mouse-1> <mouse-1> <help-echo> <help-echo> 
<help-echo> <down-mouse-1> <mouse-1> <prior> <prior> 
<prior> <help-echo> <help-echo> <down-mouse-1> <help-echo> 
<mouse-movement> <mouse-1> <help-echo> <help-echo> 
<help-echo> <help-echo> <help-echo> <down-mouse-1> 
<mouse-1> <help-echo> M-x r e p o r t - e m <tab> b 
<tab> <return>

Recent messages:
Wrote /home/tromey/.emacs.custom [4 times]
Custom-no-edit: You can't edit this part of the Custom buffer [2 times]
Quit [2 times]
Mark set
Wrote /home/tromey/.emacs.custom
Marking diary entries...done [2 times]
To install your edits, invoke [State] and choose the Set operation
Marking holidays...done
Marking diary entries...done [2 times]
Wrote /home/tromey/.emacs.custom [3 times]

Tom

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

* Re: multiple queries to delete excess backup version w/ custom
  2008-01-04 22:37 ` martin rudalics
@ 2008-01-04 22:28   ` Tom Tromey
  2008-01-04 23:11     ` martin rudalics
  0 siblings, 1 reply; 20+ messages in thread
From: Tom Tromey @ 2008-01-04 22:28 UTC (permalink / raw)
  To: martin rudalics; +Cc: emacs-pretest-bug

>>>>> "martin" == martin rudalics <rudalics@gmx.at> writes:

>> Not asking at all would also be ok by me.
martin> In this case set `delete-old-versions' to t.

martin> See also section 23.3.2.3 of the Emacs manual (Automatic
martin> Deletion of Backups).

Yeah, I know about that.  I was just referring to the specific case of
saving the custom file.

Anyway the original problem is, IMO, still a bug.  Saving the custom
file should not ask the same question multiple times.

Tom

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

* Re: multiple queries to delete excess backup version w/ custom
  2008-01-04 20:41 multiple queries to delete excess backup version w/ custom Tom Tromey
@ 2008-01-04 22:37 ` martin rudalics
  2008-01-04 22:28   ` Tom Tromey
  2008-01-05 14:31 ` Richard Stallman
  1 sibling, 1 reply; 20+ messages in thread
From: martin rudalics @ 2008-01-04 22:37 UTC (permalink / raw)
  To: Tom Tromey; +Cc: emacs-pretest-bug

> Not asking at all would also be ok by me.

In this case set `delete-old-versions' to t.

See also section 23.3.2.3 of the Emacs manual (Automatic
Deletion of Backups).

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

* Re: multiple queries to delete excess backup version w/ custom
  2008-01-04 23:11     ` martin rudalics
@ 2008-01-04 22:50       ` Tom Tromey
  2008-01-05 10:21         ` martin rudalics
  2008-01-06  8:09         ` Richard Stallman
  0 siblings, 2 replies; 20+ messages in thread
From: Tom Tromey @ 2008-01-04 22:50 UTC (permalink / raw)
  To: martin rudalics; +Cc: emacs-pretest-bug

>>>>> "martin" == martin rudalics <rudalics@gmx.at> writes:

>> Saving the custom file should not ask the same question multiple times.
martin> Does this happen with `custom-save-all'?

I used the mouse to click the button labelled "Save for Future Sessions".

"C-h k" followed by a click on that button shows documentation for
widget-button-click -- not very helpful.  C-h k RET with point on the
button just shows docs for Custom-newline -- also not very helpful.

Finally I figured out that M-x describe-char followed by
middle-clicking on 'push-button', followed by left-clicking the
'[show]' text next to :action, shows:

#[(widget &optional event)
  "\300 \207"
  [Custom-save]
  1]

I found this sequence extremely obscure.

Apparently Custom-save calls custom-save-all.
But, when I evalled (custom-save-all) by hand, it only asked once.

Tom

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

* Re: multiple queries to delete excess backup version w/ custom
  2008-01-04 22:28   ` Tom Tromey
@ 2008-01-04 23:11     ` martin rudalics
  2008-01-04 22:50       ` Tom Tromey
  0 siblings, 1 reply; 20+ messages in thread
From: martin rudalics @ 2008-01-04 23:11 UTC (permalink / raw)
  To: Tom Tromey; +Cc: emacs-pretest-bug

> Saving the custom file should not ask the same question multiple times.

Does this happen with `custom-save-all'?

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

* Re: multiple queries to delete excess backup version w/ custom
  2008-01-04 22:50       ` Tom Tromey
@ 2008-01-05 10:21         ` martin rudalics
  2008-01-05 18:42           ` Tom Tromey
  2008-01-06  8:09         ` Richard Stallman
  1 sibling, 1 reply; 20+ messages in thread
From: martin rudalics @ 2008-01-05 10:21 UTC (permalink / raw)
  To: Tom Tromey; +Cc: emacs-pretest-bug

> martin> Does this happen with `custom-save-all'?
>
> I used the mouse to click the button labelled "Save for Future Sessions".
>
> "C-h k" followed by a click on that button shows documentation for
> widget-button-click -- not very helpful.  C-h k RET with point on the
> button just shows docs for Custom-newline -- also not very helpful.
>
> Finally I figured out that M-x describe-char followed by
> middle-clicking on 'push-button', followed by left-clicking the
> '[show]' text next to :action, shows:
>
> #[(widget &optional event)
>   "\300 \207"
>   [Custom-save]
>   1]
>
> I found this sequence extremely obscure.

It is.  Personally, I experienece great difficulties reading custom and
widget code.

> Apparently Custom-save calls custom-save-all.
> But, when I evalled (custom-save-all) by hand, it only asked once.

Could you please try to edebug `Custom-save' and/or `custom-save-all' to
find out why and how it's getting called repeatedly.  This should get
fixed for Emacs 22.2.

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

* Re: multiple queries to delete excess backup version w/ custom
  2008-01-04 20:41 multiple queries to delete excess backup version w/ custom Tom Tromey
  2008-01-04 22:37 ` martin rudalics
@ 2008-01-05 14:31 ` Richard Stallman
  1 sibling, 0 replies; 20+ messages in thread
From: Richard Stallman @ 2008-01-05 14:31 UTC (permalink / raw)
  To: Tom Tromey; +Cc: emacs-pretest-bug

    Today I customized some calendar settings.
    I made several changes in one page, then clicked "Save for future
    sessions".

    I got multiple dialog boxes, one after another, all asking whether I
    wanted to delete excess backup versions of ~/.emacs.custom.

That probably means it is saving the file multiple times.
It would be better to save it just once.  Can you debug
why it is getting saved multiple times by this one operation?

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

* Re: multiple queries to delete excess backup version w/ custom
  2008-01-05 10:21         ` martin rudalics
@ 2008-01-05 18:42           ` Tom Tromey
  2008-01-05 22:29             ` martin rudalics
  2008-01-06 10:46             ` Richard Stallman
  0 siblings, 2 replies; 20+ messages in thread
From: Tom Tromey @ 2008-01-05 18:42 UTC (permalink / raw)
  To: martin rudalics; +Cc: emacs-pretest-bug

>>>>> "martin" == martin rudalics <rudalics@gmx.at> writes:

martin> Could you please try to edebug `Custom-save' and/or
martin> `custom-save-all' to find out why and how it's getting called
martin> repeatedly.  This should get fixed for Emacs 22.2.

I read through the code a little.

Custom-save does this:

    (custom-command-apply
           (lambda (child)
             (when (memq (widget-get child :custom-state)
                         '(modified set changed rogue))
               (widget-apply child :custom-save)))
           "Save all settings in this buffer? " t)

Which, AFAICT, means "send the :custom-save message to each modified
widget".

Searching for :custom-save shows that it maps to things like
custom-variable-save, custom-face-save, etc.

Looking at custom-variable-save, it calls custom-save-all toward the
end.  I suppose this makes sense because you can save a single setting
via the State menu.

At least, that's my analysis.  I'm sorry, but I didn't actually step
through with the debugger.

I can think of a few ways to fix this.

One idea would be a global which tells custom-save-all not to call
save-buffer.  Then, bind this when sending :custom-save to the widgets
in Custom-save.

Another idea would be to turn off backups for the custom file, or to
otherwise arrange not to ask the user questions when saving.

Tom

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

* Re: multiple queries to delete excess backup version w/ custom
  2008-01-05 18:42           ` Tom Tromey
@ 2008-01-05 22:29             ` martin rudalics
  2008-01-05 23:46               ` Per Abrahamsen
  2008-01-06 10:46             ` Richard Stallman
  1 sibling, 1 reply; 20+ messages in thread
From: martin rudalics @ 2008-01-05 22:29 UTC (permalink / raw)
  To: Tom Tromey; +Cc: emacs-pretest-bug, Per Abrahamsen

 > Custom-save does this:
 >
 >     (custom-command-apply
 >            (lambda (child)
 >              (when (memq (widget-get child :custom-state)
 >                          '(modified set changed rogue))
 >                (widget-apply child :custom-save)))
 >            "Save all settings in this buffer? " t)
 >
 > Which, AFAICT, means "send the :custom-save message to each modified
 > widget".
 >
 > Searching for :custom-save shows that it maps to things like
 > custom-variable-save, custom-face-save, etc.
 >
 > Looking at custom-variable-save, it calls custom-save-all toward the
 > end.  I suppose this makes sense because you can save a single setting
 > via the State menu.
 >
 > At least, that's my analysis.  I'm sorry, but I didn't actually step
 > through with the debugger.

And at the very end `Custom-save' hilariously calls `custom-save-all'
one more time.  Your analysis seems correct.  I wonder though why this
issue has never been brought up before.

 > I can think of a few ways to fix this.  One idea would be a global
 > which tells custom-save-all not to call save-buffer.  Then, bind this
 > when sending :custom-save to the widgets in Custom-save.

That's probably the way to go.  Could you propose a patch along these
lines?

 > Another idea would be to turn off backups for the custom file, or to
 > otherwise arrange not to ask the user questions when saving.

Rather not.  If you save your customizations in .emacs, there's quite
some chance that some silly modifications you made to it get stored
along with the customizations.  You should be able to back up from this.
Not asking questions means overriding the user's decisions.

Per what do you think?

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

* Re: multiple queries to delete excess backup version w/ custom
  2008-01-05 22:29             ` martin rudalics
@ 2008-01-05 23:46               ` Per Abrahamsen
  2008-01-06 10:09                 ` martin rudalics
  0 siblings, 1 reply; 20+ messages in thread
From: Per Abrahamsen @ 2008-01-05 23:46 UTC (permalink / raw)
  To: martin rudalics; +Cc: Tom Tromey, emacs-pretest-bug

On Jan 5, 2008 11:29 PM, martin rudalics <rudalics@gmx.at> wrote:

> Per what do you think?

Eh, am I supposed to have an opinion?  Yes, customize-save-all can be
called multiple times.   And yes, that is a bug, not a feature.
Fixing it will require either some careful analysis figuring out all
possible ways it can be called with the possibility of forgetting
some, or some gross hack like an "inhibit" variable.  Your choice.

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

* Re: multiple queries to delete excess backup version w/ custom
  2008-01-04 22:50       ` Tom Tromey
  2008-01-05 10:21         ` martin rudalics
@ 2008-01-06  8:09         ` Richard Stallman
  1 sibling, 0 replies; 20+ messages in thread
From: Richard Stallman @ 2008-01-06  8:09 UTC (permalink / raw)
  To: Tom Tromey; +Cc: rudalics, emacs-pretest-bug

    "C-h k" followed by a click on that button shows documentation for
    widget-button-click -- not very helpful.  C-h k RET with point on the
    button just shows docs for Custom-newline -- also not very helpful.

It would be useful to enhance C-h k to get the documentation of what
a specific button does.  Would someone like to do that?

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

* Re: multiple queries to delete excess backup version w/ custom
  2008-01-05 23:46               ` Per Abrahamsen
@ 2008-01-06 10:09                 ` martin rudalics
  2008-01-06 13:26                   ` Per Abrahamsen
  0 siblings, 1 reply; 20+ messages in thread
From: martin rudalics @ 2008-01-06 10:09 UTC (permalink / raw)
  To: Per Abrahamsen; +Cc: Tom Tromey, emacs-pretest-bug

 > Eh, am I supposed to have an opinion?  Yes, customize-save-all can be
 > called multiple times.   And yes, that is a bug, not a feature.
 > Fixing it will require either some careful analysis figuring out all
 > possible ways it can be called with the possibility of forgetting
 > some, or some gross hack like an "inhibit" variable.  Your choice.

Thank you for responding.  The doc-string of `Custom-save' says

   "Set all edited settings, then save all settings that have been set."

which inherently reduces to

   (widget-apply child :custom-set)

followed by

   (custom-save-all)

Can you recall why you needed

   (widget-apply child :custom-save)

here, that is, something like:

   "Save all edited settings, then save all settings that have been set."

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

* Re: multiple queries to delete excess backup version w/ custom
  2008-01-05 18:42           ` Tom Tromey
  2008-01-05 22:29             ` martin rudalics
@ 2008-01-06 10:46             ` Richard Stallman
  1 sibling, 0 replies; 20+ messages in thread
From: Richard Stallman @ 2008-01-06 10:46 UTC (permalink / raw)
  To: Tom Tromey; +Cc: rudalics, emacs-pretest-bug

    Another idea would be to turn off backups for the custom file, or to
    otherwise arrange not to ask the user questions when saving.

Those backups are important.  The fix is to make this operation save
the file just once.

Rewriting Custom-save might be a good solution.
Your first solution is ok too:

    One idea would be a global which tells custom-save-all not to call
    save-buffer.  Then, bind this when sending :custom-save to the widgets
    in Custom-save.

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

* Re: multiple queries to delete excess backup version w/ custom
  2008-01-06 10:09                 ` martin rudalics
@ 2008-01-06 13:26                   ` Per Abrahamsen
  2008-01-06 16:09                     ` martin rudalics
  0 siblings, 1 reply; 20+ messages in thread
From: Per Abrahamsen @ 2008-01-06 13:26 UTC (permalink / raw)
  To: martin rudalics; +Cc: Tom Tromey, emacs-pretest-bug

On Jan 6, 2008 11:09 AM, martin rudalics <rudalics@gmx.at> wrote:
> Thank you for responding.  The doc-string of `Custom-save' says
>
>    "Set all edited settings, then save all settings that have been set."
>
> which inherently reduces to
>
>    (widget-apply child :custom-set)
>
> followed by
>
>    (custom-save-all)
>
> Can you recall why you needed
>
>    (widget-apply child :custom-save)
>
> here, that is, something like:
>
>    "Save all edited settings, then save all settings that have been set."

custom-save-all will only save options that are explicitly marked for saving.

:custom-set will set the option and mark it as set (customized), but
will not mark it for saving.

:custom-save  should mark the option for saving, without actually saving.

The bug is that :custom-save actually saves the option (and perhaps
that it is poorly named, should be :custom-mark-for-saving).

The problem is that the functions used for implementing the
:custom-save method, such as custom-variable-save, are also sometimes
used in contexts where you want to save the option immediately.  These
places the function should be split into one that marks only (and is
used as the :custom-save (or :custom-mark-for--saving) method), and
one that additionally calls custom-save-all.

PS: describe-text-properties (or Edit -> Text Properties -> Describe
Properties) is a great help when debugging various kind of forms, it
knows about both the button and widget abstractions on top of text
properties and overlays.

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

* Re: multiple queries to delete excess backup version w/ custom
  2008-01-06 13:26                   ` Per Abrahamsen
@ 2008-01-06 16:09                     ` martin rudalics
  2008-01-06 18:22                       ` Per Abrahamsen
  0 siblings, 1 reply; 20+ messages in thread
From: martin rudalics @ 2008-01-06 16:09 UTC (permalink / raw)
  To: Per Abrahamsen; +Cc: Tom Tromey, emacs-pretest-bug

 > The problem is that the functions used for implementing the
 > :custom-save method, such as custom-variable-save, are also sometimes
 > used in contexts where you want to save the option immediately.  These
 > places the function should be split into one that marks only (and is
 > used as the :custom-save (or :custom-mark-for--saving) method), and
 > one that additionally calls custom-save-all.

Thanks for the clarification.  Can you enumerate (some of) the instances
where I "want to save the option immediately"?  For example,
`custom-group-save' currently does not call `custom-save-all' and seems
to rely on `custom-variable-save' and `custom-face-save' to do that.

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

* Re: multiple queries to delete excess backup version w/ custom
  2008-01-06 16:09                     ` martin rudalics
@ 2008-01-06 18:22                       ` Per Abrahamsen
  2008-01-06 19:21                         ` martin rudalics
  0 siblings, 1 reply; 20+ messages in thread
From: Per Abrahamsen @ 2008-01-06 18:22 UTC (permalink / raw)
  To: martin rudalics; +Cc: Tom Tromey, emacs-pretest-bug

On Jan 6, 2008 5:09 PM, martin rudalics <rudalics@gmx.at> wrote:
> Thanks for the clarification.  Can you enumerate (some of) the instances
> where I "want to save the option immediately"?

No.  But look at each of the functions used for implementing
:custom-save, and look at where else they are called.

-- Per

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

* Re: multiple queries to delete excess backup version w/ custom
  2008-01-06 18:22                       ` Per Abrahamsen
@ 2008-01-06 19:21                         ` martin rudalics
  2008-01-06 19:58                           ` Per Abrahamsen
  0 siblings, 1 reply; 20+ messages in thread
From: martin rudalics @ 2008-01-06 19:21 UTC (permalink / raw)
  To: Per Abrahamsen; +Cc: Tom Tromey, emacs-pretest-bug

 > No.  But look at each of the functions used for implementing
 > :custom-save, and look at where else they are called.

I can find only `custom-variable-save', `custom-face-save', and
`custom-group-save'.  And these are called only from the respective
widgets and the corresponding menu entries.  Hence, all I'd have to do
is, in `Custom-save' and `custom-group-save' call the method
:custom-mark-for-saving for the respective children, implement that
method with a function just like custom-...-save but with the call to
`custom-save-all' omitted.  Or have I overseen something?

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

* Re: multiple queries to delete excess backup version w/ custom
  2008-01-06 19:21                         ` martin rudalics
@ 2008-01-06 19:58                           ` Per Abrahamsen
  2008-01-06 22:22                             ` martin rudalics
  2008-01-10  9:51                             ` martin rudalics
  0 siblings, 2 replies; 20+ messages in thread
From: Per Abrahamsen @ 2008-01-06 19:58 UTC (permalink / raw)
  To: martin rudalics; +Cc: Tom Tromey, emacs-pretest-bug

On Jan 6, 2008 8:21 PM, martin rudalics <rudalics@gmx.at> wrote:
> I can find only `custom-variable-save', `custom-face-save', and
> `custom-group-save'.  And these are called only from the respective
> widgets and the corresponding menu entries.  Hence, all I'd have to do
> is, in `Custom-save' and `custom-group-save' call the method
> :custom-mark-for-saving for the respective children, implement that
> method with a function just like custom-...-save but with the call to
> `custom-save-all' omitted.  Or have I overseen something?

You might want to implement the function that saves as a call to the
function that merely marks for saving, followed by a call to to
custom-save-all, rather than duplicate the code.

If you invent a :custom-mark-for-saving, you will no longer need a
:custom-save method.

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

* Re: multiple queries to delete excess backup version w/ custom
  2008-01-06 19:58                           ` Per Abrahamsen
@ 2008-01-06 22:22                             ` martin rudalics
  2008-01-10  9:51                             ` martin rudalics
  1 sibling, 0 replies; 20+ messages in thread
From: martin rudalics @ 2008-01-06 22:22 UTC (permalink / raw)
  To: Per Abrahamsen; +Cc: Tom Tromey, emacs-pretest-bug

 > You might want to implement the function that saves as a call to the
 > function that merely marks for saving, followed by a call to to
 > custom-save-all, rather than duplicate the code.

Good.  But the end of `custom-variable-save' reads as

     (custom-save-all)
     (custom-variable-state-set widget)
     (custom-redraw-magic widget)))

and I think I should still do the last two calls _after_ calling
`custom-save-all' - just in case the latter throws an error.

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

* Re: multiple queries to delete excess backup version w/ custom
  2008-01-06 19:58                           ` Per Abrahamsen
  2008-01-06 22:22                             ` martin rudalics
@ 2008-01-10  9:51                             ` martin rudalics
  1 sibling, 0 replies; 20+ messages in thread
From: martin rudalics @ 2008-01-10  9:51 UTC (permalink / raw)
  To: Per Abrahamsen; +Cc: Tom Tromey, emacs-pretest-bug

[-- Attachment #1: Type: text/plain, Size: 774 bytes --]

 > You might want to implement the function that saves as a call to the
 > function that merely marks for saving, followed by a call to to
 > custom-save-all, rather than duplicate the code.
 >
 > If you invent a :custom-mark-for-saving, you will no longer need a
 > :custom-save method.

I've attached a patch against the trunk to handle the problem along
these lines.  The patch tries to resolve this problem when erasing
customizations as well.  In particular the patch should

- handle saving and erasing customizations _as before_, but

- when saving or erasing more than one setting, save the buffer to your
   customization file _once only_.

To avoid regression, it would be very valuable if a few people confirmed
that the patch gives good results.  Please try it.

[-- Attachment #2: cus-edit.patch --]
[-- Type: text/plain, Size: 22692 bytes --]

*** cus-edit.el.~1.340.~	Sun Jan  6 10:39:00 2008
--- cus-edit.el	Thu Jan 10 10:17:42 2008
***************
*** 826,841 ****
  
  (defun Custom-save (&rest ignore)
    "Set all edited settings, then save all settings that have been set.
! If a setting was edited and set before, this saves it.
! If a setting was merely edited before, this sets it then saves it."
    (interactive)
!   (if (custom-command-apply
!        (lambda (child)
! 	 (when (memq (widget-get child :custom-state)
! 		     '(modified set changed rogue))
! 	   (widget-apply child :custom-save)))
!        "Save all settings in this buffer? " t)
!       (custom-save-all)))
  
  (defun custom-reset (widget &optional event)
    "Select item from reset menu."
--- 826,844 ----
  
  (defun Custom-save (&rest ignore)
    "Set all edited settings, then save all settings that have been set.
! If a setting was edited and set before, this saves it.  If a
! setting was merely edited before, this sets it then saves it."
    (interactive)
!   (when (custom-command-apply
! 	 (lambda (child)
! 	   (when (memq (widget-get child :custom-state)
! 		       '(modified set changed rogue))
! 	     (widget-apply child :custom-mark-to-save)))
! 	 "Save all settings in this buffer? " t)
!     ;; Save changes to buffer and redraw.
!     (custom-save-all)
!     (dolist (child custom-options)
!       (widget-apply child :custom-state-set-and-redraw))))
  
  (defun custom-reset (widget &optional event)
    "Select item from reset menu."
***************
*** 865,884 ****
  	 (widget-apply widget :custom-reset-saved)))
     "Reset all settings (current values and buffer text) to saved values? "))
  
  (defun Custom-reset-standard (&rest ignore)
!   "Erase all customization (either current or saved) for the group members.
  The immediate result is to restore them to their standard values.
  This operation eliminates any saved values for the group members,
  making them as if they had never been customized at all."
    (interactive)
!   (custom-command-apply
!    (lambda (widget)
!      (and (or (null (widget-get widget :custom-standard-value))
! 	      (widget-apply widget :custom-standard-value))
! 	  (memq (widget-get widget :custom-state)
! 		'(modified set changed saved rogue))
! 	  (widget-apply widget :custom-reset-standard)))
!    "Erase all customizations for settings in this buffer? " t))
  
  ;;; The Customize Commands
  
--- 868,934 ----
  	 (widget-apply widget :custom-reset-saved)))
     "Reset all settings (current values and buffer text) to saved values? "))
  
+ ;; The next two variables are bound to '(t) by `Custom-reset-standard'
+ ;; and `custom-group-reset-standard'.  If these variables are nil, both
+ ;; `custom-variable-reset-standard' and `custom-face-reset-standard'
+ ;; save, reset and redraw the handled widget immediately.  Otherwise,
+ ;; they add the widget to the corresponding list and leave it to
+ ;; `custom-reset-standard-save-and-update' to save, reset and redraw it.
+ (defvar custom-reset-standard-variables-list nil)
+ (defvar custom-reset-standard-faces-list nil)
+ 
+ ;; The next function was excerpted from `custom-variable-reset-standard'
+ ;; and `custom-face-reset-standard' and is used to avoid calling
+ ;; `custom-save-all' repeatedly (and thus saving settings to file one by
+ ;; one) when erasing all customizations.
+ (defun custom-reset-standard-save-and-update ()
+   "Save settings and redraw after erasing customizations."
+   (when (or (and custom-reset-standard-variables-list
+ 		 (not (eq custom-reset-standard-variables-list  '(t))))
+ 	    (and custom-reset-standard-faces-list
+ 		 (not (eq custom-reset-standard-faces-list '(t)))))
+     ;; Save settings to file.
+     (custom-save-all)
+     ;; Set state of and redraw variables.
+     (dolist (widget custom-reset-standard-variables-list)
+       (unless (eq widget t)
+ 	(widget-put widget :custom-state 'unknown)
+ 	(custom-redraw widget)))
+     ;; Set state of and redraw faces.
+     (dolist (widget custom-reset-standard-faces-list)
+       (unless (eq widget t)
+ 	(let* ((symbol (widget-value widget))
+ 	       (child (car (widget-get widget :children)))
+ 	       (value (get symbol 'face-defface-spec))
+ 	       (comment-widget (widget-get widget :comment-widget)))
+ 	  (put symbol 'face-comment nil)
+ 	  (widget-value-set child
+ 			    (custom-pre-filter-face-spec
+ 			     (list (list t (custom-face-attributes-get
+ 					    symbol nil)))))
+ 	  ;; This call manages the comment visibility
+ 	  (widget-value-set comment-widget "")
+ 	  (custom-face-state-set widget)
+ 	  (custom-redraw-magic widget))))))
+ 
  (defun Custom-reset-standard (&rest ignore)
!   "Erase all customizations (either current or saved) in current buffer.
  The immediate result is to restore them to their standard values.
  This operation eliminates any saved values for the group members,
  making them as if they had never been customized at all."
    (interactive)
!   ;; Bind these temporarily.
!   (let ((custom-reset-standard-variables-list '(t))
! 	(custom-reset-standard-faces-list '(t)))
!     (custom-command-apply
!      (lambda (widget)
!        (and (or (null (widget-get widget :custom-standard-value))
! 		(widget-apply widget :custom-standard-value))
! 	    (memq (widget-get widget :custom-state)
! 		  '(modified set changed saved rogue))
! 	    (widget-apply widget :custom-mark-to-reset-standard)))
!      "Erase all customizations for settings in this buffer? " t)
!     (custom-reset-standard-save-and-update)))
  
  ;;; The Customize Commands
  
***************
*** 1535,1541 ****
        (widget-insert "Editing a setting changes only the text in this buffer."
  		     (if init-file
  			 "
! To set apply your changes, use the Save or Set buttons.
  Saving a change normally works by editing your init file."
  		       "
  Currently, these settings cannot be saved for future Emacs sessions,
--- 1585,1591 ----
        (widget-insert "Editing a setting changes only the text in this buffer."
  		     (if init-file
  			 "
! To apply your changes, use the Save or Set buttons.
  Saving a change normally works by editing your init file."
  		       "
  Currently, these settings cannot be saved for future Emacs sessions,
***************
*** 2441,2451 ****
    :value-create 'custom-variable-value-create
    :action 'custom-variable-action
    :custom-set 'custom-variable-set
!   :custom-save 'custom-variable-save
    :custom-reset-current 'custom-redraw
    :custom-reset-saved 'custom-variable-reset-saved
    :custom-reset-standard 'custom-variable-reset-standard
!   :custom-standard-value 'custom-variable-standard-value)
  
  (defun custom-variable-type (symbol)
    "Return a widget suitable for editing the value of SYMBOL.
--- 2491,2503 ----
    :value-create 'custom-variable-value-create
    :action 'custom-variable-action
    :custom-set 'custom-variable-set
!   :custom-mark-to-save 'custom-variable-mark-to-save
    :custom-reset-current 'custom-redraw
    :custom-reset-saved 'custom-variable-reset-saved
    :custom-reset-standard 'custom-variable-reset-standard
!   :custom-mark-to-reset-standard 'custom-variable-mark-to-reset-standard
!   :custom-standard-value 'custom-variable-standard-value
!   :custom-state-set-and-redraw 'custom-variable-state-set-and-redraw)
  
  (defun custom-variable-type (symbol)
    "Return a widget suitable for editing the value of SYMBOL.
***************
*** 2807,2814 ****
      (custom-variable-state-set widget)
      (custom-redraw-magic widget)))
  
! (defun custom-variable-save (widget)
!   "Set and save the value for the variable being edited by WIDGET."
    (let* ((form (widget-get widget :custom-form))
  	 (state (widget-get widget :custom-state))
  	 (child (car (widget-get widget :children)))
--- 2859,2866 ----
      (custom-variable-state-set widget)
      (custom-redraw-magic widget)))
  
! (defun custom-variable-mark-to-save (widget)
!   "Set value and mark for saving the variable edited by WIDGET."
    (let* ((form (widget-get widget :custom-form))
  	 (state (widget-get widget :custom-state))
  	 (child (car (widget-get widget :children)))
***************
*** 2846,2855 ****
  	   (put symbol 'variable-comment comment)
  	   (put symbol 'saved-variable-comment comment)))
      (put symbol 'customized-value nil)
!     (put symbol 'customized-variable-comment nil)
!     (custom-save-all)
!     (custom-variable-state-set widget)
!     (custom-redraw-magic widget)))
  
  (defun custom-variable-reset-saved (widget)
    "Restore the saved value for the variable being edited by WIDGET.
--- 2898,2915 ----
  	   (put symbol 'variable-comment comment)
  	   (put symbol 'saved-variable-comment comment)))
      (put symbol 'customized-value nil)
!     (put symbol 'customized-variable-comment nil)))
! 
! (defsubst custom-variable-state-set-and-redraw (widget)
!   "Set state of variable widget WIDGET and redraw with current settings."
!   (custom-variable-state-set widget)
!   (custom-redraw-magic widget))
! 
! (defun custom-variable-save (widget)
!   "Save value of variable edited by widget WIDGET."
!   (custom-variable-mark-to-save widget)
!   (custom-save-all)
!   (custom-variable-state-set-and-redraw widget))
  
  (defun custom-variable-reset-saved (widget)
    "Restore the saved value for the variable being edited by WIDGET.
***************
*** 2875,2886 ****
      ;; This call will possibly make the comment invisible
      (custom-redraw widget)))
  
! (defun custom-variable-reset-standard (widget)
!   "Restore the standard setting for the variable being edited by WIDGET.
! This operation eliminates any saved setting for the variable,
! restoring it to the state of a variable that has never been customized.
! The value that was current before this operation
! becomes the backup value, so you can get it again."
    (let* ((symbol (widget-value widget)))
      (if (get symbol 'standard-value)
  	(custom-variable-backup-value widget)
--- 2935,2944 ----
      ;; This call will possibly make the comment invisible
      (custom-redraw widget)))
  
! (defun custom-variable-mark-to-reset-standard (widget)
!   "Mark to restore standard setting for the variable edited by widget WIDGET.
! If `custom-reset-standard-variables-list' is nil, save, reset and
! redraw the widget immediately."
    (let* ((symbol (widget-value widget)))
      (if (get symbol 'standard-value)
  	(custom-variable-backup-value widget)
***************
*** 2890,2902 ****
      (put symbol 'customized-variable-comment nil)
      (custom-push-theme 'theme-value symbol 'user 'reset)
      (custom-theme-recalc-variable symbol)
!     (when (or (get symbol 'saved-value) (get symbol 'saved-variable-comment))
!       (put symbol 'saved-value nil)
!       (put symbol 'saved-variable-comment nil)
!       (custom-save-all))
!     (widget-put widget :custom-state 'unknown)
!     ;; This call will possibly make the comment invisible
!     (custom-redraw widget)))
  
  (defun custom-variable-backup-value (widget)
    "Back up the current value for WIDGET's variable.
--- 2948,2979 ----
      (put symbol 'customized-variable-comment nil)
      (custom-push-theme 'theme-value symbol 'user 'reset)
      (custom-theme-recalc-variable symbol)
!     (if (and custom-reset-standard-variables-list
! 	     (or (get symbol 'saved-value) (get symbol 'saved-variable-comment)))
! 	(progn
! 	  (put symbol 'saved-value nil)
! 	  (put symbol 'saved-variable-comment nil)
! 	  ;; Append this to `custom-reset-standard-variables-list' to
! 	  ;; have `custom-reset-standard-save-and-update' save setting
! 	  ;; to the file, update the widget's state, and redraw it.
! 	  (setq custom-reset-standard-variables-list
! 		(cons widget custom-reset-standard-variables-list)))
!       (when (or (get symbol 'saved-value) (get symbol 'saved-variable-comment))
! 	(put symbol 'saved-value nil)
! 	(put symbol 'saved-variable-comment nil)
! 	(custom-save-all))
!       (widget-put widget :custom-state 'unknown)
!       ;; This call will possibly make the comment invisible
!       (custom-redraw widget))))
! 
! (defun custom-variable-reset-standard (widget)
!   "Restore standard setting for the variable edited by WIDGET.
! This operation eliminates any saved setting for the variable,
! restoring it to the state of a variable that has never been customized.
! The value that was current before this operation
! becomes the backup value, so you can get it again."
!   (let (custom-reset-standard-variables-list)
!     (custom-variable-mark-to-reset-standard widget)))
  
  (defun custom-variable-backup-value (widget)
    "Back up the current value for WIDGET's variable.
***************
*** 3172,3182 ****
    :custom-category 'face
    :custom-form nil ; defaults to value of `custom-face-default-form'
    :custom-set 'custom-face-set
!   :custom-save 'custom-face-save
    :custom-reset-current 'custom-redraw
    :custom-reset-saved 'custom-face-reset-saved
    :custom-reset-standard 'custom-face-reset-standard
    :custom-standard-value 'custom-face-standard-value
    :custom-menu 'custom-face-menu-create)
  
  (define-widget 'custom-face-all 'editable-list
--- 3249,3261 ----
    :custom-category 'face
    :custom-form nil ; defaults to value of `custom-face-default-form'
    :custom-set 'custom-face-set
!   :custom-mark-to-save 'custom-face-mark-to-save
    :custom-reset-current 'custom-redraw
    :custom-reset-saved 'custom-face-reset-saved
    :custom-reset-standard 'custom-face-reset-standard
+   :custom-mark-to-reset-standard 'custom-face-mark-to-reset-standard
    :custom-standard-value 'custom-face-standard-value
+   :custom-state-set-and-redraw 'custom-face-state-set-and-redraw
    :custom-menu 'custom-face-menu-create)
  
  (define-widget 'custom-face-all 'editable-list
***************
*** 3321,3326 ****
--- 3400,3406 ----
  	   ;; Update buttons.
  	   (widget-put widget :buttons buttons)
  	   ;; Insert documentation.
+ 	   (widget-put widget :documentation-indent 3)
  	   (widget-add-documentation-string-button
  	    widget :visibility-widget 'custom-visibility)
  
***************
*** 3510,3517 ****
      (custom-face-state-set widget)
      (custom-redraw-magic widget)))
  
! (defun custom-face-save (widget)
!   "Save in `.emacs' the face attributes in WIDGET."
    (let* ((symbol (widget-value widget))
  	 (child (car (widget-get widget :children)))
  	 (value (custom-post-filter-face-spec (widget-value child)))
--- 3590,3597 ----
      (custom-face-state-set widget)
      (custom-redraw-magic widget)))
  
! (defun custom-face-mark-to-save (widget)
!   "Mark for saving the face edited by WIDGET."
    (let* ((symbol (widget-value widget))
  	 (child (car (widget-get widget :children)))
  	 (value (custom-post-filter-face-spec (widget-value child)))
***************
*** 3532,3541 ****
      (put symbol 'customized-face nil)
      (put symbol 'face-comment comment)
      (put symbol 'customized-face-comment nil)
!     (put symbol 'saved-face-comment comment)
!     (custom-save-all)
!     (custom-face-state-set widget)
!     (custom-redraw-magic widget)))
  
  ;; For backward compatibility.
  (define-obsolete-function-alias 'custom-face-save-command 'custom-face-save
--- 3612,3629 ----
      (put symbol 'customized-face nil)
      (put symbol 'face-comment comment)
      (put symbol 'customized-face-comment nil)
!     (put symbol 'saved-face-comment comment)))
! 
! (defsubst custom-face-state-set-and-redraw (widget)
!   "Set state of face widget WIDGET and redraw with current settings."
!   (custom-face-state-set widget)
!   (custom-redraw-magic widget))
! 
! (defun custom-face-save (widget)
!   "Save the face edited by WIDGET."
!   (custom-face-mark-to-save widget)
!   (custom-save-all)
!   (custom-face-state-set-and-redraw widget))
  
  ;; For backward compatibility.
  (define-obsolete-function-alias 'custom-face-save-command 'custom-face-save
***************
*** 3564,3573 ****
  (defun custom-face-standard-value (widget)
    (get (widget-value widget) 'face-defface-spec))
  
! (defun custom-face-reset-standard (widget)
!   "Restore WIDGET to the face's standard attribute values.
! This operation eliminates any saved attributes for the face,
! restoring it to the state of a face that has never been customized."
    (let* ((symbol (widget-value widget))
  	 (child (car (widget-get widget :children)))
  	 (value (get symbol 'face-defface-spec))
--- 3652,3661 ----
  (defun custom-face-standard-value (widget)
    (get (widget-value widget) 'face-defface-spec))
  
! (defun custom-face-mark-to-reset-standard (widget)
!   "Restore widget WIDGET to the face's standard attribute values.
! If `custom-reset-standard-faces-list' is nil, save, reset and
! redraw the widget immediately."
    (let* ((symbol (widget-value widget))
  	 (child (car (widget-get widget :children)))
  	 (value (get symbol 'face-defface-spec))
***************
*** 3579,3597 ****
      (custom-push-theme 'theme-face symbol 'user 'reset)
      (face-spec-set symbol value t)
      (custom-theme-recalc-face symbol)
!     (when (or (get symbol 'saved-face) (get symbol 'saved-face-comment))
!       (put symbol 'saved-face nil)
!       (put symbol 'saved-face-comment nil)
!       (custom-save-all))
!     (put symbol 'face-comment nil)
!     (widget-value-set child
! 		      (custom-pre-filter-face-spec
! 		       (list (list t (custom-face-attributes-get
! 				      symbol nil)))))
!     ;; This call manages the comment visibility
!     (widget-value-set comment-widget "")
!     (custom-face-state-set widget)
!     (custom-redraw-magic widget)))
  
  ;;; The `face' Widget.
  
--- 3667,3703 ----
      (custom-push-theme 'theme-face symbol 'user 'reset)
      (face-spec-set symbol value t)
      (custom-theme-recalc-face symbol)
!     (if (and custom-reset-standard-faces-list
! 	     (or (get symbol 'saved-face) (get symbol 'saved-face-comment)))
! 	;; Do this later.
! 	(progn
! 	  (put symbol 'saved-face nil)
! 	  (put symbol 'saved-face-comment nil)
! 	  ;; Append this to `custom-reset-standard-faces-list' and have
! 	  ;; `custom-reset-standard-save-and-update' save setting to the
! 	  ;; file, update the widget's state, and redraw it.
! 	  (setq custom-reset-standard-faces-list
! 		(cons widget custom-reset-standard-faces-list)))
!       (when (or (get symbol 'saved-face) (get symbol 'saved-face-comment))
! 	(put symbol 'saved-face nil)
! 	(put symbol 'saved-face-comment nil)
! 	(custom-save-all))
!       (put symbol 'face-comment nil)
!       (widget-value-set child
! 			(custom-pre-filter-face-spec
! 			 (list (list t (custom-face-attributes-get
! 					symbol nil)))))
!       ;; This call manages the comment visibility
!       (widget-value-set comment-widget "")
!       (custom-face-state-set widget)
!       (custom-redraw-magic widget))))
! 
! (defun custom-face-reset-standard (widget)
!   "Restore WIDGET to the face's standard attribute values.
! This operation eliminates any saved attributes for the face,
! restoring it to the state of a face that has never been customized."
!   (let (custom-reset-standard-faces-list)
!     (custom-face-mark-to-reset-standard widget)))
  
  ;;; The `face' Widget.
  
***************
*** 3736,3745 ****
    :action 'custom-group-action
    :custom-category 'group
    :custom-set 'custom-group-set
!   :custom-save 'custom-group-save
    :custom-reset-current 'custom-group-reset-current
    :custom-reset-saved 'custom-group-reset-saved
    :custom-reset-standard 'custom-group-reset-standard
    :custom-menu 'custom-group-menu-create)
  
  (defun custom-group-sample-face-get (widget)
--- 3842,3853 ----
    :action 'custom-group-action
    :custom-category 'group
    :custom-set 'custom-group-set
!   :custom-mark-to-save 'custom-group-mark-to-save
    :custom-reset-current 'custom-group-reset-current
    :custom-reset-saved 'custom-group-reset-saved
    :custom-reset-standard 'custom-group-reset-standard
+   :custom-mark-to-reset-standard 'custom-group-mark-to-reset-standard
+   :custom-state-set-and-redraw 'custom-group-state-set-and-redraw
    :custom-menu 'custom-group-menu-create)
  
  (defun custom-group-sample-face-get (widget)
***************
*** 4034,4044 ****
      (when (eq (widget-get child :custom-state) 'modified)
        (widget-apply child :custom-set))))
  
! (defun custom-group-save (widget)
!   "Save all modified group members."
    (dolist (child (widget-get widget :children))
      (when (memq (widget-get child :custom-state) '(modified set))
!       (widget-apply child :custom-save))))
  
  (defun custom-group-reset-current (widget)
    "Reset all modified group members."
--- 4142,4164 ----
      (when (eq (widget-get child :custom-state) 'modified)
        (widget-apply child :custom-set))))
  
! (defun custom-group-mark-to-save (widget)
!   "Mark all modified group members for saving."
    (dolist (child (widget-get widget :children))
      (when (memq (widget-get child :custom-state) '(modified set))
!       (widget-apply child :custom-mark-to-save))))
! 
! (defsubst custom-group-state-set-and-redraw (widget)
!   "Set state of group widget WIDGET and redraw with current settings."
!   (dolist (child (widget-get widget :children))
!     (when (memq (widget-get child :custom-state) '(modified set))
!       (widget-apply child :custom-state-set-and-redraw))))
! 
! (defun custom-group-save (widget)
!   "Save all modified group members."
!   (custom-group-mark-to-save widget)
!   (custom-save-all)
!   (custom-group-state-set-and-redraw widget))
  
  (defun custom-group-reset-current (widget)
    "Reset all modified group members."
***************
*** 4054,4063 ****
  
  (defun custom-group-reset-standard (widget)
    "Reset all modified, set, or saved group members."
    (dolist (child (widget-get widget :children))
      (when (memq (widget-get child :custom-state)
  		'(modified set saved))
!       (widget-apply child :custom-reset-standard))))
  
  (defun custom-group-state-update (widget)
    "Update magic."
--- 4174,4190 ----
  
  (defun custom-group-reset-standard (widget)
    "Reset all modified, set, or saved group members."
+   (let ((custom-reset-standard-variables-list '(t))
+ 	(custom-reset-standard-faces-list '(t)))
+     (custom-group-mark-to-reset-standard widget)
+     (custom-reset-standard-save-and-update)))
+ 
+ (defun custom-group-mark-to-reset-standard (widget)
+   "Mark to reset all modified, set, or saved group members."
    (dolist (child (widget-get widget :children))
      (when (memq (widget-get child :custom-state)
  		'(modified set saved))
!       (widget-apply child :custom-mark-to-reset-standard))))
  
  (defun custom-group-state-update (widget)
    "Update magic."

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

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

end of thread, other threads:[~2008-01-10  9:51 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-04 20:41 multiple queries to delete excess backup version w/ custom Tom Tromey
2008-01-04 22:37 ` martin rudalics
2008-01-04 22:28   ` Tom Tromey
2008-01-04 23:11     ` martin rudalics
2008-01-04 22:50       ` Tom Tromey
2008-01-05 10:21         ` martin rudalics
2008-01-05 18:42           ` Tom Tromey
2008-01-05 22:29             ` martin rudalics
2008-01-05 23:46               ` Per Abrahamsen
2008-01-06 10:09                 ` martin rudalics
2008-01-06 13:26                   ` Per Abrahamsen
2008-01-06 16:09                     ` martin rudalics
2008-01-06 18:22                       ` Per Abrahamsen
2008-01-06 19:21                         ` martin rudalics
2008-01-06 19:58                           ` Per Abrahamsen
2008-01-06 22:22                             ` martin rudalics
2008-01-10  9:51                             ` martin rudalics
2008-01-06 10:46             ` Richard Stallman
2008-01-06  8:09         ` Richard Stallman
2008-01-05 14:31 ` Richard Stallman

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

	https://git.savannah.gnu.org/cgit/emacs.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).