[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: setting the mode of a buffer
From: |
lee |
Subject: |
Re: setting the mode of a buffer |
Date: |
Sat, 15 Mar 2014 22:12:56 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> 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.
Awesome --- it means I just have to do it right and use functions to set
up things and don`t need to unload the mode anymore :)
I got this mode from somewhere quite a while ago, and I think it isn`t
done right. There isn`t anything to disable it, either.
--
Knowledge is volatile and fluid. Software is power.