[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: |
Tue, 15 Mar 2022 07:50:43 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
Marcin Borkowski wrote:
>>> want to do something else. In that case, the something
>>> else tends to depend on the specifics so (if (boundp
>>> 'foo) (setq foo ..) ...) is about s good as it gets.
>>
>> If it exists set it with `setq'. If it doesn't exist,
>> create and set it ... with `setq'?
>
> What if it's an internal Emacs variable which might become
> a user option one day (I submitted a bug report about it)
> and then my customization silently disappears? It's the
> "silently" part I want to guard against...
Yeah, that whole system ... *mumble*
But here you go,
(let ((var (variable-at-point t))) ; ANY-SYMBOL
(when (and (custom-variable-p var)
(get var 'custom-set) )
(message "user variable") ))
--
underground experts united
https://dataswamp.org/~incal
- Re: Is there a way of setting a variable only when it exists?, (continued)
- 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
- 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?, Emanuel Berg, 2022/03/15
- Re: Is there a way of setting a variable only when it exists?, Emanuel Berg, 2022/03/15
- RE: [External] : Re: Is there a way of setting a variable only when it exists?, Drew Adams, 2022/03/15
- Re: Is there a way of setting a variable only when it exists?,
Emanuel Berg <=
- RE: [External] : Re: Is there a way of setting a variable only when it exists?, Drew Adams, 2022/03/15
- Re: [External] : Re: Is there a way of setting a variable only when it exists?, Marcin Borkowski, 2022/03/16
- Re: Is there a way of setting a variable only when it exists?, Michael Heerdegen, 2022/03/15
- Re: Is there a way of setting a variable only when it exists?, Marcin Borkowski, 2022/03/16
- Re: Is there a way of setting a variable only when it exists?, Tomas Nordin, 2022/03/16
- Re: Is there a way of setting a variable only when it exists?, Marcin Borkowski, 2022/03/16
- Re: Is there a way of setting a variable only when it exists?, Emanuel Berg, 2022/03/17
- 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?, Michael Heerdegen, 2022/03/14