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: defvar and defcustom Date: Wed, 4 Nov 2009 09:55:57 -0800 Message-ID: <543DEF35D58A406AAF8102AD0B159BAB@us.oracle.com> References: <7ef820cc-f622-4994-b682-d8e28649d194@x25g2000prf.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1257357414 11140 80.91.229.12 (4 Nov 2009 17:56:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 4 Nov 2009 17:56:54 +0000 (UTC) To: "'rustom'" , Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Nov 04 18:56:47 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1N5k68-0001rt-2O for geh-help-gnu-emacs@m.gmane.org; Wed, 04 Nov 2009 18:56:44 +0100 Original-Received: from localhost ([127.0.0.1]:53799 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N5k67-0004B3-H2 for geh-help-gnu-emacs@m.gmane.org; Wed, 04 Nov 2009 12:56:43 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N5k5j-0004Aq-5J for help-gnu-emacs@gnu.org; Wed, 04 Nov 2009 12:56:19 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N5k5d-0004A6-ER for help-gnu-emacs@gnu.org; Wed, 04 Nov 2009 12:56:17 -0500 Original-Received: from [199.232.76.173] (port=32857 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N5k5d-0004A2-9T for help-gnu-emacs@gnu.org; Wed, 04 Nov 2009 12:56:13 -0500 Original-Received: from rcsinet12.oracle.com ([148.87.113.124]:22130 helo=rgminet12.oracle.com) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1N5k5c-0001Ct-RK for help-gnu-emacs@gnu.org; Wed, 04 Nov 2009 12:56:13 -0500 Original-Received: from acsinet15.oracle.com (acsinet15.oracle.com [141.146.126.227]) by rgminet12.oracle.com (Switch-3.3.1/Switch-3.3.1) with ESMTP id nA4HriRE001587 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 4 Nov 2009 17:53:45 GMT Original-Received: from acsmt355.oracle.com (acsmt355.oracle.com [141.146.40.155]) by acsinet15.oracle.com (Switch-3.3.1/Switch-3.3.1) with ESMTP id nA4HlQ7i010430; Wed, 4 Nov 2009 17:57:37 GMT Original-Received: from abhmt012.oracle.com by acsmt357.oracle.com with ESMTP id 81808401257357357; Wed, 04 Nov 2009 11:55:57 -0600 Original-Received: from dradamslap1 (/130.35.178.194) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 04 Nov 2009 09:55:57 -0800 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <7ef820cc-f622-4994-b682-d8e28649d194@x25g2000prf.googlegroups.com> Thread-Index: AcpddeSFlfTWb8xKQiCEEjKU89a2vQAAAzmg X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 X-Source-IP: acsmt355.oracle.com [141.146.40.155] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090202.4AF1C037.00F3:SCFMA4539814,ss=1,fgs=0 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 1) 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:69477 Archived-At: > Whats the diff between defvar and defcustom? > IOW if defvar defines a non-customise variable how is it different > from setq? Read the excellent manual: `C-h i', choose `Elisp', then `i defvar'. 1. setq vs defvar: * defvar does not change the value of its variable, if it already has a value. * defvar lets you attach a doc string. * defvar applies only to the default value of a variable, not to a local value. In this, it is like setq-default. 2. defcustom vs defvar: * defcustom is intended for customizable user options, that is, for user customization using Customize. * defvar defines a non-Customizable user option if the doc string starts with `*'. You can set the option value interactively, with `M-x set-variable', but you cannot use Customize with it. * defcustom lets you control the type of the variable's value (using keyword :type). * defcustom lets you group variables, for modularity (using keyword :group). * defcustom lets you do lots more to control the variable's value - what happens regarding its initialization, what happens each time it is set, and so on. * defcustom variables are saved persistently (in your `custom-file' or in your init file if you have no `custom-file'). That will get you started, but there is no substitute for exploring the manual for this (and looking at examples in the Emacs code).