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

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

Re: Setting value 1 when matching two strings


From: Heime
Subject: Re: Setting value 1 when matching two strings
Date: Sun, 16 Oct 2022 16:33:34 +0000

------- Original Message -------
On Sunday, October 16th, 2022 at 4:23 PM, Dr Rainer Woitok 
<rainer.woitok@gmail.com> wrote:


> Heime,
> 
> On Sunday, 2022-10-16 15:51:44 +0000, you wrote:
> 
> > This code sets "isel" to value "1" if "actm" matches "vert". I want to 
> > extend this so that value "1"
> > is also set when "actm" matches "horz".
> > 
> > (let ( (isel (if (equal "vert" actm) 1 -1)) )
> > 
> > Thus when "actm" matches "vert" or "horz", then "isel" has value "1". 
> > Otherwise "isel" has value "-1".
> 
> 
> In case you don't really need "vert" as a string but could as well use
> the symbol 'vert, you could use "eq" rather than "equal". And if you
> want two or more alternatives, you could use
> 
> (member actm '("vert" "horz"))
> 
> or
> 
> (memq actm '(vert horz))
> 
> Sincerely,
> Rainer

Am actually using "completing-read".  Thusly, to follow your strategy I have to 
convert to symbols
after using "completing-read".  What conversion approach would you have in mind?

  (interactive
   (list
    (let ( (cseq '("vert" "partial-disab" "disable" "horz")) )
      (completing-read "icomplt: " cseq nil t "horz"))))





reply via email to

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