[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Defvar not called at top level
From: |
Stefan Monnier |
Subject: |
Re: Defvar not called at top level |
Date: |
Wed, 24 Nov 2021 08:38:22 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
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`.
The reason for this warning is to catch the widespread confusion between
`make-variable-buffer-local` and `make-local-variable`.
Stefan