* Setting numeric value according to symbol with cl-case
@ 2022-10-30 10:21 Heime
2022-10-30 10:53 ` Emanuel Berg
2022-10-30 12:57 ` Stefan Monnier via Users list for the GNU Emacs text editor
0 siblings, 2 replies; 3+ messages in thread
From: Heime @ 2022-10-30 10:21 UTC (permalink / raw)
To: Heime via Users list for the GNU Emacs text editor
Is this a good way to set a numeric value to a variable depending
on a whether another variable was set to a particular symbol. Have
been scrutinising the possibility of setting a value to the symbol
itself, but do not know how.
(setq mbcomplt
(cl-case armg
('auto 0)
('icomplt-horz 1)
('icomplt-vert 2)
('ivy 3)
('vertico 4)
('helm 5)))
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Setting numeric value according to symbol with cl-case
2022-10-30 10:21 Setting numeric value according to symbol with cl-case Heime
@ 2022-10-30 10:53 ` Emanuel Berg
2022-10-30 12:57 ` Stefan Monnier via Users list for the GNU Emacs text editor
1 sibling, 0 replies; 3+ messages in thread
From: Emanuel Berg @ 2022-10-30 10:53 UTC (permalink / raw)
To: help-gnu-emacs
Heime wrote:
> Is this a good way to set a numeric value to a variable
> depending on a whether another variable was set to
> a particular symbol
Is it a good way to set a variable based on some
other variable?
It's a good WAY to do it ...
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Setting numeric value according to symbol with cl-case
2022-10-30 10:21 Setting numeric value according to symbol with cl-case Heime
2022-10-30 10:53 ` Emanuel Berg
@ 2022-10-30 12:57 ` Stefan Monnier via Users list for the GNU Emacs text editor
1 sibling, 0 replies; 3+ messages in thread
From: Stefan Monnier via Users list for the GNU Emacs text editor @ 2022-10-30 12:57 UTC (permalink / raw)
To: help-gnu-emacs
> (setq mbcomplt
> (cl-case armg
> ('auto 0)
> ('icomplt-horz 1)
> ('icomplt-vert 2)
> ('ivy 3)
> ('vertico 4)
> ('helm 5)))
Obviously, you should use `pcase` rather than `cl-case` since you
intuitively chose the `pcase` syntax for your patterns (for `cl-case`
they kind of work but don't really do what you think).
Stefan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-10-30 12:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-30 10:21 Setting numeric value according to symbol with cl-case Heime
2022-10-30 10:53 ` Emanuel Berg
2022-10-30 12:57 ` Stefan Monnier via Users list for the GNU Emacs text editor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).