emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Any way to make interactive eval-defun run the :set function of a defcus


From: Robert Weiner
Subject: Any way to make interactive eval-defun run the :set function of a defcustom that has a separate :initialize property?
Date: Wed, 3 Aug 2016 13:20:00 -0400

Hi:

I use Emacs 25.0.94.  I seem to run into this fairly often now, so a solution would be very helpful.

For simplicity, say I have a string defcustom that is used as the display part of a menubar menu.  The initial value of the defcustom is a literal string but after initialization if this value is ever changed, I want the changed value to appear in the menu.  I have a function mymenu-update that performs the menu update, so I want this called whenever the value is changed but it cannot be called when the defcustom is first loaded and initialized because the menu is not yet ready for initialization.

So my defcustom has an :initialize property that just sets the static value of the string initially and a :set property that both sets the changed value and calls mymenu-update.  This works fine when I interactively edit the string in the customize interface and press Apply.

But if I interactively use eval-defun on the defcustom its value is changed but the menu is not updated.  The documentation of eval-defun is unclear in this case since it says that it resets the value to its initial value _expression_ but also claims that the :set function is run.  (I believe it should say that :set is run only if :initialize is not given though in looking at the code, it seems :set should be run).

So I want interactive eval-defun to call the :set function rather than the :initialize function, essentially doing what the function custom-reevaluate-setting does.  Is there a way to get this behavior without rewriting eval-defun?

Thanks,

Bob


reply via email to

[Prev in Thread] Current Thread [Next in Thread]