all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Is there a way of setting a variable only when it exists?
@ 2022-03-14  6:00 Marcin Borkowski
  2022-03-14 12:52 ` Eli Zaretskii
                   ` (2 more replies)
  0 siblings, 3 replies; 37+ messages in thread
From: Marcin Borkowski @ 2022-03-14  6:00 UTC (permalink / raw)
  To: Help Gnu Emacs mailing list

Hi all,

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?

TIA,

-- 
Marcin Borkowski
http://mbork.pl



^ permalink raw reply	[flat|nested] 37+ messages in thread

end of thread, other threads:[~2022-03-19  9:25 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-14  6:00 Is there a way of setting a variable only when it exists? Marcin Borkowski
2022-03-14 12:52 ` Eli Zaretskii
2022-03-14 13:16 ` Stefan Monnier via Users list for the GNU Emacs text editor
2022-03-14 13:48   ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-03-15  6:17     ` Marcin Borkowski
2022-03-15  6:50       ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-03-15  6:58       ` Jean Louis
2022-03-15  7:45         ` Marcin Borkowski
2022-03-15  8:12           ` Jean Louis
2022-03-15  7:49         ` tomas
2022-03-15  8:13           ` Jean Louis
2022-03-15  8:36             ` tomas
2022-03-15  9:28               ` Jean Louis
2022-03-15 10:01                 ` tomas
2022-03-15 11:29                 ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-03-15  8:14           ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-03-15 15:33         ` [External] : " Drew Adams
2022-03-15 15:38       ` Drew Adams
2022-03-16 18:32         ` Marcin Borkowski
2022-03-16  0:47       ` Michael Heerdegen
2022-03-16 18:33         ` Marcin Borkowski
2022-03-16  6:02       ` Tomas Nordin
2022-03-16  6:37         ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-03-16 18:34         ` Marcin Borkowski
2022-03-15  6:48     ` Jean Louis
2022-03-14 22:09 ` Michael Heerdegen
2022-03-15  6:16   ` Marcin Borkowski
2022-03-15  7:05     ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-03-16  0:25     ` Michael Heerdegen
2022-03-16 18:33       ` Marcin Borkowski
2022-03-16 19:25         ` Michael Heerdegen
2022-03-18  5:58           ` Marcin Borkowski
2022-03-16 20:35         ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-03-17 20:47           ` Stefan Monnier via Users list for the GNU Emacs text editor
2022-03-18  5:59             ` Marcin Borkowski
2022-03-18 17:59           ` Jean Louis
2022-03-19  9:25             ` Emanuel Berg via Users list for the GNU Emacs text editor

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.