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

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

Re: Setting numecir values according to symbol


From: Heime
Subject: Re: Setting numecir values according to symbol
Date: Sun, 30 Oct 2022 22:12:52 +0000

------- Original Message -------
On Sunday, October 30th, 2022 at 1:01 PM, Emanuel Berg <incal@dataswamp.org> 
wrote:


> Stefan Monnier via Users list for the GNU Emacs text editor wrote:
> 
> > > (defvar mbcomplt 0)
> > > 
> > > (cond
> > > ((eq armg 'auto) (setq mbcomplt 0)
> > > ((eq armg 'icomplt-horz) (setq mbcomplt 1)
> > > ((eq armg 'icomplt-vert) (setq mbcomplt 2)
> > > ((eq armg 'ivy) (setq mbcomplt 3)
> > > ((eq armg 'vertico) (setq mbcomplt 4)
> > > ((eq armg 'helm) (setq mbcomplt 5)))

I did simplify this with the following "cl-case".  Am interested in seeing
how a can implement the equivalent using "pcase".

(setq mbcomplt
  (cl-case armg
    ('auto 0)
    ('icomplt-horz 1)
    ('icomplt-vert 2)
    ('ivy 3)
    ('vertico 4)
    ('helm 5)))

Would this be all, as below?

(setq mbcomplt
  (pcase armg
    ('auto 0)
    ('icomplt-horz 1)
    ('icomplt-vert 2)
    ('ivy 3)
    ('vertico 4)
    ('helm 5)))






reply via email to

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