|
From: | Nicolas Richard |
Subject: | Re: Any disadvantages of using put/get instead of defvar? |
Date: | Fri, 21 Feb 2014 11:29:23 +0100 |
User-agent: | Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
>> You could also define the variable inside the function, i.e., that's a >> buffer-local counter: >> (defun counter () >> (defvar counter-var 1) >> (setq-local counter-var (1+ counter-var))) > > I'd recommend against it. Its semantics is pretty much the same as > > (defun counter () > (defvar counter-var 1) > (setq-local counter-var (1+ counter-var))) Did you mean this instead ? (defvar counter-var 1) (defun counter () (setq-local counter-var (1+ counter-var))) -- Nico.
[Prev in Thread] | Current Thread | [Next in Thread] |