emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Defvar not called at top level


From: Arthur Miller
Subject: Re: Defvar not called at top level
Date: Thu, 25 Nov 2021 04:04:53 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> Arthur Miller [2021-11-24 11:47:16] wrote:
>> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>>> Arthur Miller [2021-11-23 14:28:04] wrote:
>>>> Just a question: why is it important to call defvar from top level?
>>>> I would like to have some code that generates some other code, amongs that 
>>>> to
>>>> declare few global symbols with auto generated docs as well.
>>>
>>> Presumably you can do this with
>>>
>>>     (defmacro FOO (..) ... `(defvar ...) ...)
>>>
>>>     (FOO ...)
>>>
>>>> If I call those from a defun/macro normally I get that warning that defvar 
>>>> is
>>>> not called at top level;
>>>
>>> Can you show the actual warning?
>>
>>
>> Thank you for the answer; it seems like I can't :).
>>
>> I am sorry, I had too many things in my head and confused things. It was not
>> "defvar" it was "defvar-local". I appologize.
>
> So the warning was not about `defvar` but about `make-variable-buffer-local`.

Yes. Caused by defvar-locals I pasted in.

> The reason for this warning is to catch the widespread confusion between
> `make-variable-buffer-local` and `make-local-variable`.

Aha. I thought it was more like it's easy to create a binding in wrong buffer.

Anyway, thanks.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]