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

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

RE: [External] : Any packages using ThingAtPointPlus for activation?


From: Drew Adams
Subject: RE: [External] : Any packages using ThingAtPointPlus for activation?
Date: Wed, 4 Jan 2023 15:42:20 +0000

> > > You referred to let
> > > inside of `cond' but me, I would let using `let' to
> > > get the preferred thing-at-point before the `cond'.
> >
> > No, I didn't.  I meant what you said: use `let' to
> > bind a var to the THING you want.  Then use `cond' or
> > `cl-case' or whatever to test that value using the var.
> 
> `cond' is the one to recognize which type of
> thing at point is there, as I need to recognize
> among many various conditions, and they
> may not be only thing at point.

Sorry, I forgot your original code.  Yes, you're
checking for a given THING in each `cond' clause.
And then you use the same `thing-at-point' call
again, after knowing that you've found a THING
of the given type, in order to do something with it.

My original reply was OK; my reply quoted above was
mistaken, as I'd forgotten what you were doing.

You could nevertheless avoid repeating the same
`thing-at-point' call in each clause, if you
wanted.  I agree that in most cases the time
spent, and the added noise (repetition) in the
code, are both negligible.

But if you did want to avoid the repetition you
could do this:

(let (thg) ; Just bind it.
  (cond ((setq thg (thing-at-point 'uuid))
         (rcd-db-uuid-action thg))
        ((setq thg (thing-at-point 'url))
         (browse-url thg))
        ...))

reply via email to

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