[Top][All Lists]

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

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

From: Jean Louis
Subject: Re: [External] : Any packages using ThingAtPointPlus for activation?
Date: Tue, 3 Jan 2023 15:41:50 +0300
User-agent: Mutt/2.2.9+54 (af2080d) (2022-11-21)

* Drew Adams <> [2023-01-02 20:10]:
> > (defun hyperscope-action-button (&optional prefix)
> >   (interactive "p")
> >   (cond ((thing-at-point 'uuid) (rcd-db-uuid-action (thing-at-point
> > 'uuid)))
> I suggest you don't invoke `thing-at-point' multiple
> times needlessly.  Use `let', to do the work only once.

I would rather like to have universal thing at point that would
identify all possible elements at once and give me list of it.

I understand repetitions, I may consider let later, maybe not. It is
not matter of speed now, neither style. It is thinkering stage.

> Don't use (`thing-at-point 'symbol) for this.
> Perhaps unfortunately, Emacs has that return text at
> point that has symbol syntax - in the current mode.
> It doesn't return a Lisp symbol name at point
> (unless you're in `emacs-lisp-mode').

> Use `symbol-at-point' (or, if you want only currently
> defined Elisp symbols, `tap-symbol-at-point').  They
> return a Lisp symbol - no need to intern.

Alright, but I would like to recognize only symbols which are defined,
like functions and variables and not symbols which are not defined.

How do I recognize if function is defined?

I use (fboundp 'system-move-file-to-trash) ➜ t

How I recognize if variable is one variable defined anywhere globally?

Judging by the inspection of command {C-h v} it is following:

- I should use (boundp SYMBOL) to recognize if it is variable

> If you want, instead of doing such a `cond' here,
> just define functions `lisp-function-at-point' and
> `lisp-var-at-point'.  Then you can use those anytime
> you like, not just here.  The code and Commentary in
> `thingatpt+.el' shows you how to do that.  E.g.,
> (defun lisp-function-at-point
>   "Return a Lisp function at point, or nil."
>   (tap-form-at-point 'symbol 'fboundp))
> `tap-form-at-point' (and vanilla `form-at-point')
> returns a Lisp object corresponding the textual
> THING that's its first object, provided that that
> Lisp object satisfies the PREDICATE that is its
> second object.

That is great.

> Bookmarks do that - you can define a bookmark type
> for "jumping" to anything.  That's the original
> purpose of Emacs bookmarks.  And "jump" can mean
> whatever you like.  You can use thing-at-point
> to get the name of a thing of a particular kind at
> point, and then jump to it using a bookmark.

Does it mean I would need to bookmark it first before using a bookmark?


Take action in Free Software Foundation campaigns:

In support of Richard M. Stallman

reply via email to

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