unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: help-gnu-emacs@gnu.org
Subject: Re: setting the mode of a buffer
Date: Thu, 13 Mar 2014 08:26:24 -0400	[thread overview]
Message-ID: <jwvmwgu1e70.fsf-monnier+gmane.emacs.help@gnu.org> (raw)
In-Reply-To: slrnli1nb5.37u.joost.m.kremers@j.kremers4.news.arnhem.chello.nl

> Reevaluating a defcustom will normally reset the value of the variable,
> so there's no need to unload and reload the file. 

C-h f defcustom

   [...]
   :initialize
   	VALUE should be a function used to initialize the
   	variable.  It takes two arguments, the symbol and value
   	given in the `defcustom' call.  The default is
   	`custom-initialize-reset'.
   [...]

C-h f custom-initialize-reset

   [...]
   The value is either the symbol's current value
    (as obtained using the `:get' function), if any,
   [...]

So, no, re-evaluating a defcustom will typically leave the variable at its
old value.

M-: (progn (defcustom sm-t 1 "hhaha") (defcustom sm-t 2 "hhaha") sm-t) RET

returns 1, not 2.  IOW, it works more like defvar than like defconst.


        Stefan




  reply	other threads:[~2014-03-13 12:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.16657.1394156425.10748.help-gnu-emacs@gnu.org>
2014-03-07  8:47 ` setting the mode of a buffer Joost Kremers
2014-03-07 11:28   ` lee
     [not found]   ` <mailman.16664.1394193871.10748.help-gnu-emacs@gnu.org>
2014-03-12 22:19     ` Joost Kremers
2014-03-13 12:26       ` Stefan Monnier [this message]
2014-03-15 21:12         ` lee
2014-03-15 21:09       ` lee
     [not found]       ` <mailman.17152.1394713615.10748.help-gnu-emacs@gnu.org>
2014-03-17 11:17         ` Joost Kremers
2014-03-07  0:10 lee

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=jwvmwgu1e70.fsf-monnier+gmane.emacs.help@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).