From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Klaus Berndl Newsgroups: gmane.emacs.help Subject: Re: Changing a customizable variable programatically? Date: 18 Sep 2002 10:00:32 +0200 Organization: UTA/netway (Customer) Sender: help-gnu-emacs-admin@gnu.org Message-ID: References: NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: main.gmane.org 1032336963 17870 127.0.0.1 (18 Sep 2002 08:16:03 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 18 Sep 2002 08:16:03 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 17ra07-0004dg-00 for ; Wed, 18 Sep 2002 10:15:59 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 17ra0N-0003gv-00; Wed, 18 Sep 2002 04:16:15 -0400 Original-Path: shelby.stanford.edu!nntp.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!t-online.de!newsfeed.r-kom.de!newsfeed.completel.de!news.netway.at!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 34 Original-NNTP-Posting-Host: 195.96.24.28 Original-X-Trace: newsreader1.netway.at 1032336223 11722 195.96.24.28 (18 Sep 2002 08:03:43 GMT) Original-X-Complaints-To: abuse@netway.at Original-NNTP-Posting-Date: 18 Sep 2002 08:03:43 GMT User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 X-Forwarded: by - (DeleGate/7.5.3) Original-Xref: nntp.stanford.edu gnu.emacs.help:105014 Original-To: help-gnu-emacs@gnu.org Errors-To: help-gnu-emacs-admin@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.help:1569 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:1569 On 17 Sep 2002, Joe Casadonte wrote: > > Is there any way to change a defcustom'ed variable programatically, > and then have it saved via the custom mechanism for future use? I > basically want to give users two ways to change this particular > variable, one via a custom buffer, and one "in context". Is it as > simple as calling `custom-save-variables'? Any comments on breaking > the paradigm in this way? Thanks! > It is so simple! Look into the file the option *custom-file* points to (if nil then the file the variable *user-init-file* points to) and you will see there is nothing else then onw big `custom-set-variables' call. The only important thing for changing defcustom-options via elisp is not to use `setq' (or `let') because then all the :set, :initialize (and other) clauses of the defcustom-form will no be evaluated which can result in unwanted effects! But i strongly recommend always using the customize-feature of Emacs for changing defcustom-options! BTW, just for my interest: What do you mean with "in context"?? Ciao, klaus -- Klaus Berndl mailto: klaus.berndl@sdm.de sd&m AG http://www.sdm.de software design & management Thomas-Dehler-Str. 27, 81737 München, Germany Tel +49 89 63812-392, Fax -220