[Top][All Lists]

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

RE: using use-package

From: Drew Adams
Subject: RE: using use-package
Date: Fri, 14 Aug 2015 07:49:44 -0700 (PDT)

> > I'd love to be able to do something like
> > (custom-setq my-variable 10)
> > which sets the variable, but does not result in the "the value of
> > this variable has been changed outside of customize" message in Custom.
> You can try customize-set-variable.

Yes.  (Or `customize-set-value', depending on what you want.)

Or use this, which is the part of `customize-set-(variable|value)'
that does what you are asking for:

(defun tell-customize-option-has-changed (option &optional msgp)
  "Tell Customize that OPTION, changed outside Customize, is now set."
  (interactive "vOption: \np")
  (put option 'customized-value (list (custom-quote (symbol-value option))))
  (when msgp (message "Option `%s' is now set (but NOT saved)" option)))

And for a face:

(defun tell-customize-face-has-changed (face &optional msgp)
  "Tell Customize that FACE, changed outside Customize, is now set.
The definition of symbol FACE for the current frame is used."
  (interactive (list (read-face-name "Face") t))
  (put face 'customized-face (list (list 't (face-attr-construct face))))
  (put face 'customized-face-comment (get face 'face-comment))
  (put face 'face-modified nil)
  (when msgp (message "Face `%s' is now set (but NOT saved)" face))))

In short:

 - option: (put OPTION 'customized-value
                (list (custom-quote (symbol-value OPTION))))

 - face:   (put FACE 'customized-face SPEC)
           (face-spec-set FACE SPEC)  ; See `face-spec-set' doc.

See also:

reply via email to

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