help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Is there a way of setting a variable only when it exists?


From: Emanuel Berg
Subject: Re: Is there a way of setting a variable only when it exists?
Date: Wed, 16 Mar 2022 07:37:32 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Tomas Nordin wrote:

> What about doing an assert of sorts
>
> (message "some--internal-var is %S" some--internal-var)
> (setq some--internal-var 42)
>
> It will crash your init process if some--internal-var is void.

Byte-compile

  (message "some--internal-var is %S" some--internal-var)

and the byte-compiler will tell you

  Warning: reference to free variable ‘some--internal-var’

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

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