emacs-devel
[Top][All Lists]
Advanced

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

Re: Calling (package-initialize) sooner during initialization


From: Wolfgang Jenkner
Subject: Re: Calling (package-initialize) sooner during initialization
Date: Tue, 28 Apr 2015 16:54:52 +0200
User-agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (berkeley-unix)

On Tue, Apr 28 2015, Oleh Krehel wrote:

>>> (defmacro csetq (variable value)
>>> `(funcall (or (get ',variable 'custom-set) 'set-default) ',variable ,
>> value))
[...]
> A plain setq doesn't get in the way, but it also doesn't call the :set
> property of defcustom. For instance, this works fine:
>
>     (csetq ediff-diff-options "-w")
>
> but this doesn't work:
>
>     (setq ediff-diff-options "-w")

This example also shows that the variable's docstring doesn't always
mention that a custom setter is used :-(

So, I wonder if `describe-variable' shouldn't add this automatically,
like in the following (barely tested) patch:

-- >8 --
Subject: [PATCH] * lisp/help-fns.el (describe-variable): Mention a custom
 setter.

---
 lisp/help-fns.el | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 7ecd271..3eb9271 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -910,6 +910,16 @@ file-local variable.\n")
 
            ;; Make a link to customize if this variable can be customized.
            (when (custom-variable-p variable)
+              (let ((misfeature (get variable 'custom-set)))
+                (when misfeature
+                  (terpri)
+                  (terpri)
+                  (princ "This variable's `custom-set' property has the value")
+                  (if (symbolp misfeature)
+                      (with-current-buffer standard-output
+                        (insert (format " `%s'." misfeature)))
+                    (terpri)
+                    (pp misfeature))))
              (let ((customize-label "customize"))
                (terpri)
                (terpri)
-- 
2.3.6





reply via email to

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