Re: Using cl-case on symbols

Heime <[email protected]> Wed, 08 Jul 2026 21:52:00 +0000
Newsgroups gmane.emacs.help
Message-ID <g1kh0mny7S3e7NJF-j5f_QLXG2I1GhyYAnj14z77c2juQf40q38Gx90lwY273VntKO8PWiG8wDiVnDE82GOOdkumXLylSIBeUx1HiXNbnHk=@protonmail.com>
On Tuesday, July 7th, 2026 at 5:00 PM, Tassilo Horn <[email protected]> wrote:

> Heime <[email protected]> writes:
> 
> > It has been suggested to me about using the following `cl-case'
> > construct for checking ACTM against a list of symbols.  With `cond' I
> > would have to use ((or (eq actm 'add) (eq actm 'remove))
> >
> > How is it that `cond' does not work on symbols but `cl-case' does?
> 
> `cond' works with everything because you define the complete condition
> yourself.  E.g.,
> 
>   (cond
>     ((> i 17) 'i-is-greater-than-17)
>     (t        'i-is-something-else))
> 
> `cl-case' is more specialized.  It only tests for equality or set
> membership using `eql'/`memql'.  So the above greater-than test is not
> feasible to express with `cl-case' (well, unless you write a clause with
> a list containing all numbers > 17 of which there are many).
> 
> > Although I have looked at the documentation of `cl-case', there is
> > no indication on its appropriateness to symbols.
> 
> As said above, `cl-case' uses `eql' for comparison.  Two interned
> symbols with the same name are `eq' so they are `eql', too.  Keywords
> can also be compared with `eq' (and thus `eql').  And numbers can be
> compared with `eql'.  So these are the types suitable for a `cl-case'
> expression.  For example, strings are NOT suited.
> 
> HTH,
> Tassilo


For ACTM being the symbol 'add or 'remove, why is the KEYLIST 
not ('add 'remove), but rather (add remove)?

	   (cl-case actm
             ((add remove)
                (funcall hka mdhook #'kronaire-regexp)
                (funcall hka mdhook #'outline-minor-mode))
>