From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.help Subject: RE: using use-package Date: Fri, 14 Aug 2015 07:49:44 -0700 (PDT) Message-ID: <83d503e0-a21e-44e6-8522-5b07bee8dae2@default> References: <67cb463e-41f6-4f37-91ee-15d0fdb5ba9f@googlegroups.com> <20150812180621.32265.2E673ABE@ahiker.mooo.com> <87bnebnyyl.fsf@newcastle.ac.uk> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1439563824 5812 80.91.229.3 (14 Aug 2015 14:50:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 14 Aug 2015 14:50:24 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Aug 14 16:50:12 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZQGJ6-0007hH-IY for geh-help-gnu-emacs@m.gmane.org; Fri, 14 Aug 2015 16:50:08 +0200 Original-Received: from localhost ([::1]:46604 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZQGJ6-0006jM-6U for geh-help-gnu-emacs@m.gmane.org; Fri, 14 Aug 2015 10:50:08 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46071) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZQGIp-0006gZ-7p for help-gnu-emacs@gnu.org; Fri, 14 Aug 2015 10:49:55 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZQGIl-0000wq-Vb for help-gnu-emacs@gnu.org; Fri, 14 Aug 2015 10:49:51 -0400 Original-Received: from userp1040.oracle.com ([156.151.31.81]:45790) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZQGIl-0000wY-Oq for help-gnu-emacs@gnu.org; Fri, 14 Aug 2015 10:49:47 -0400 Original-Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t7EEnkPf014220 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 14 Aug 2015 14:49:46 GMT Original-Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.13.8/8.13.8) with ESMTP id t7EEnkEg006913 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Fri, 14 Aug 2015 14:49:46 GMT Original-Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by userv0122.oracle.com (8.13.8/8.13.8) with ESMTP id t7EEnk74018062 for ; Fri, 14 Aug 2015 14:49:46 GMT In-Reply-To: X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9 (901082) [OL 12.0.6691.5000 (x86)] X-Source-IP: userv0022.oracle.com [156.151.31.74] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 156.151.31.81 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:106588 Archived-At: > > 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. >=20 > 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: http://www.emacswiki.org/emacs/CustomizingAndSaving#GetCustomizeT= oRecognizeChangedPreference