From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.help Subject: Re: defcustom: changing from defvar - order of execution Date: Wed, 04 May 2005 11:03:26 -0400 Organization: Bell Sympatico Message-ID: <877jifnilm.fsf-monnier+gnu.emacs.help@gnu.org> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1115242511 442 80.91.229.2 (4 May 2005 21:35:11 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 4 May 2005 21:35:11 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed May 04 23:35:08 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DTRW4-0000yx-K6 for geh-help-gnu-emacs@m.gmane.org; Wed, 04 May 2005 23:34:49 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DTRdS-0007Cx-HQ for geh-help-gnu-emacs@m.gmane.org; Wed, 04 May 2005 17:42:26 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!cyclone.bc.net!nrc-news.nrc.ca!newsflash.concordia.ca!News.Dal.Ca!ursa-nb00s0.nbnet.nb.ca!nf3.bellglobal.com!nf1.bellglobal.com!nf2.bellglobal.com!news20.bellglobal.com.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) Cancel-Lock: sha1:7wGFBi+iMYIlSzIGuBpxrb8ha2M= Original-Lines: 31 Original-NNTP-Posting-Host: 67.71.118.90 Original-X-Complaints-To: abuse@sympatico.ca Original-X-Trace: news20.bellglobal.com 1115219006 67.71.118.90 (Wed, 04 May 2005 11:03:26 EDT) Original-NNTP-Posting-Date: Wed, 04 May 2005 11:03:26 EDT Original-Xref: shelby.stanford.edu gnu.emacs.help:130651 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:26303 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:26303 > Second setup - library foo.el has this: > (defcustom foovar nil) > (defun foo-fn () foovar) > Second setup - user has this in .emacs, after customizing > foovar to `t' with Customize: > (load-library "foo") > (foo-fn) > ... > (custom-set-variables '(foovar t)...) > When .emacs is loaded, (foo-fn) is executed, foovar is (has > default value) `nil', so (foo-fn) returns `nil'. You're comparing two different elisp package code and two different .emacs code. Try to separate those two cases; it will help you understand the problem. E.g. changing the elisp package to use defcustom, but without the user changing her .emacs will not result in any problem. The problem comes when the user replaces her "setq at the beginning" with a "custom-set-var at the end". It's only weakly related to the use of custom since the same behavior appears if you move the setq, or if you move the custom-set-var. Stefan