|
From: | Douglas Lewan |
Subject: | Re: Compiling a recursive macro |
Date: | Fri, 12 Jun 2020 12:11:56 -0400 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 |
On 6/12/20 6:49 AM, Michael Heerdegen wrote:
Douglas Lewan <d.lewan2000@gmail.com> writes:They are buffer-local. Definition of such a variable spans the tree of buffers in question. I suppose I could just define them in the root buffer, but then I'd also need to use a specialized getter instead of the variable itself. The latter definitely seems preferable to me. If there's a way to do this with emacs lisp's natural scoping, I'm more than happy to learn.If you want to use local variables: `make-local-variable' makes a variable local in the current buffer, `make-variable-buffer-local' generally; both are functions (not special forms or macros). And the getter is `buffer-local-value'; also a function. Michael.
Indeed. The macros I've written wrap (make-local-variable), but contain logic that reflects the structure that I'm working with. The package is intended to be generic, so expecting the user to rewrite the logic over and over seems inappropriate.
BTW both (make-local-variable) and (make-variable-buffer-local) are written in C, so they can have direct and transparent access to symbols. That's a luxury that mere emacs lisp programmers don't have with functions.
-- ,Doug d.lewan2000@gmail.com (908) 720 7908 If this is what winning looks like, I'd hate to see what losing is.
[Prev in Thread] | Current Thread | [Next in Thread] |