wael-zwaiter@gmx.com writes: > Is the following valid? > > (setq-local devi 0.18 > scal 1.0) No, because setq-local only accepts one two arguments (variable and value). Try C-h o setq-local, and you'll see it's documentation. >> Sent: Sunday, February 14, 2021 at 4:42 AM >> From: "Philip Kaludercic" >> To: "Christopher Dimech" >> Cc: wael-zwaiter@gmx.com, "Help Gnu Emacs" >> Subject: Re: Setting variables, argumunts in defun >> >> Christopher Dimech writes: >> >> > I am trying to use pcase on a string, but do need some direction >> > on how to use it. >> >> Pcase is usually used like this >> >> (pcase objv >> ("enable" >> (setq devi 0.18) >> (setq scal 0.2)) >> ("disable" >> (setq devi 0.18) >> (setq scal 1.0))) >> >> the first element it the expression that the execution depends on, and >> every possible branch starts with a case. What you are doing looks more >> like a cond-expression: >> >> (cond ((string-equal objv "enable") >> (setq devi 0.18) >> (setq scal 0.2)) >> ((string-equal objv "disable") >> (setq devi 0.18) >> (setq scal 1.0))) >> >> That being said, it's probably better to use a symbol ('enable and >> 'disable) or a boolean value write this. Exploiting the fact that setq >> can assign multiple variables at one, you could also write >> >> (if (eq objv 'enable) >> (setq devi 0.18 >> scal 0.2) >> (setq devi 0.18 >> scal 1.0)) >> >> though depending on what you are doing, it might be better to avoid >> setting global variables in the first place. >> >> > (pcase (string-match "enable" objv) >> > ( >> > (setq devi 0.18) >> > (setq scal 0.2) ) >> > >> > ( (string-match "disable" objv) >> > (setq devi 0.0) >> > (setq scal 1.0) ) >> > >> > ) >> > >> > >> >> Sent: Sunday, February 14, 2021 at 4:14 AM >> >> From: wael-zwaiter@gmx.com >> >> To: "Help Gnu Emacs" >> >> Subject: Setting variables, argumunts in defun >> >> >> >> I would like to set up devi and scal by selecting either one or >> >> the other. Wow can I do this in elisp. Should I pass parameters >> >> to the function. Can one pass a string, then check its contents? >> >> >> >> (defun deviscal () >> >> >> >> (setq devi 0.18) >> >> (setq scal 0.2) >> >> >> >> (setq devi 0.0) >> >> (setq scal 1.0) ) >> >> >> >> >> >> >> >> >> >> >> > >> > >> >> -- >> Philip K. >> -- Philip K.