all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: ken <gebser@mousecar.com>
To: help-gnu-emacs@gnu.org
Subject: Re: re-defvar a variable without reloading emacs
Date: Sat, 13 Jun 2009 19:48:57 -0400	[thread overview]
Message-ID: <4A343AE9.5040102@mousecar.com> (raw)
In-Reply-To: <C351E3B6AC7C4C309180D8659E25F0E9@us.oracle.com>

Drew,

Excellent answer... 400% better than an expert's... it reminds us that
the meaning of "guru" is "teacher".

But much thanks to all who replied.


On 06/13/2009 11:19 AM Drew Adams wrote:
>>> 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.
> 
> 
> 




  reply	other threads:[~2009-06-13 23:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-13 12:51 re-defvar a variable without reloading emacs ken
2009-06-13 13:15 ` Eli Zaretskii
2009-06-13 15:19   ` Drew Adams
2009-06-13 23:48     ` ken [this message]
     [not found] <mailman.563.1244897480.2239.help-gnu-emacs@gnu.org>
2009-06-13 13:54 ` Markus Triska

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A343AE9.5040102@mousecar.com \
    --to=gebser@mousecar.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.