[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: |
Eli Zaretskii |
Subject: |
Re: Is there a way of setting a variable only when it exists? |
Date: |
Mon, 14 Mar 2022 14:52:02 +0200 |
> From: Marcin Borkowski <mbork@mbork.pl>
> Date: Mon, 14 Mar 2022 07:00:33 +0100
>
> I'd like to be able to say something like
>
> (setq-safe hello "world")
>
> so that `hello' is set to `"world"' if it is an existing variable (e.g.,
> defined by `defvar') and an error is raised if `hello' does not exist.
>
> Rationale: I'm setting an internal Emacs variable. At the same time,
> I submitted a feature request to turn it into a user option, so that
> it's possible that in a future version of Emacs it's going to change its
> name (it has two dashes in it). I want to be warned then that I need to
> change my `init.el' accordingly.
>
> I assume it would be fairly easy to code such a macro (using `boundp'),
> but maybe it exists already?
Why not just use boundp?
- Is there a way of setting a variable only when it exists?, Marcin Borkowski, 2022/03/14
- Re: Is there a way of setting a variable only when it exists?,
Eli Zaretskii <=
- Re: Is there a way of setting a variable only when it exists?, Stefan Monnier, 2022/03/14
- Re: Is there a way of setting a variable only when it exists?, Emanuel Berg, 2022/03/14
- Re: Is there a way of setting a variable only when it exists?, tomas, 2022/03/15
- Re: Is there a way of setting a variable only when it exists?, Jean Louis, 2022/03/15
- Re: Is there a way of setting a variable only when it exists?, tomas, 2022/03/15
- Re: Is there a way of setting a variable only when it exists?, Jean Louis, 2022/03/15