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: re-defvar a variable without reloading emacs Date: Sat, 13 Jun 2009 08:19:57 -0700 Message-ID: References: <4A33A0BF.6030701@mousecar.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 1244906432 10835 80.91.229.12 (13 Jun 2009 15:20:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 13 Jun 2009 15:20:32 +0000 (UTC) To: Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Jun 13 17:20:29 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 1MFV1w-0005Vx-5w for geh-help-gnu-emacs@m.gmane.org; Sat, 13 Jun 2009 17:20:29 +0200 Original-Received: from localhost ([127.0.0.1]:46488 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MFV1v-00021m-Dw for geh-help-gnu-emacs@m.gmane.org; Sat, 13 Jun 2009 11:20:27 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MFV1Y-00021Y-8H for help-gnu-emacs@gnu.org; Sat, 13 Jun 2009 11:20:04 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MFV1S-00021J-Rf for help-gnu-emacs@gnu.org; Sat, 13 Jun 2009 11:20:03 -0400 Original-Received: from [199.232.76.173] (port=59613 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MFV1S-00021G-P7 for help-gnu-emacs@gnu.org; Sat, 13 Jun 2009 11:19:58 -0400 Original-Received: from rcsinet11.oracle.com ([148.87.113.123]:50888 helo=rgminet11.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 1MFV1S-0006nd-D3 for help-gnu-emacs@gnu.org; Sat, 13 Jun 2009 11:19:58 -0400 Original-Received: from rgminet15.oracle.com (rcsinet15.oracle.com [148.87.113.117]) by rgminet11.oracle.com (Switch-3.3.1/Switch-3.3.1) with ESMTP id n5DFKr7j008428 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sat, 13 Jun 2009 15:20:54 GMT Original-Received: from abhmt006.oracle.com (abhmt006.oracle.com [141.146.116.15]) by rgminet15.oracle.com (Switch-3.3.1/Switch-3.3.1) with ESMTP id n5DFJwOt026068 for ; Sat, 13 Jun 2009 15:19:58 GMT Original-Received: from dradamslap1 (/141.144.64.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 13 Jun 2009 08:19:52 -0700 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: Thread-Index: AcnsKzCbk89udhVeRsmF4/lbvDdxpQADZ3KQ X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 X-Source-IP: abhmt006.oracle.com [141.146.116.15] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A010202.4A33C399.0033:SCFSTAT5015188,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:65247 Archived-At: > > I've got a defvar'd variable in my .emacs which I want to > > redefine. But rerunning (defvar somevar "someval") doesn't work... > > according to the docs, this is the correct behavior. So is there > > some way to redefine this variable without reloading the whole of emacs? > > Use setq. It depends what is meant: 1. If you mean that you have already evaluated (e.g. loaded) the code (defvar somevar "someval"), and you have now edited that code to (defvar somevar "newval"), and you want to evaluate that interactively, see node `Evaluating Emacs Lisp Expressions' in the Emacs manual. It says you can put the cursor somewhere on the expression and hit `C-M-x', to do what you want. 2. If you mean that you have want to be able to evaluate (e.g. load) the code (defvar somevar "someval") and then evaluate (load) some other code that redefines `somevar', then use (setq somevar "newval") as that other code. `setq' always assigns a value. `defvar' assigns a value only the first time it is evaluated, normally, but `C-M-x' overrides this, making it assign a value again.