all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Jean Louis <bugs@gnu.support>, Help GNU Emacs <help-gnu-emacs@gnu.org>
Subject: RE: [External] : Any packages using ThingAtPointPlus for activation?
Date: Mon, 2 Jan 2023 17:08:19 +0000	[thread overview]
Message-ID: <SJ0PR10MB54880525EDEA0D3D462FF17DF3F79@SJ0PR10MB5488.namprd10.prod.outlook.com> (raw)
In-Reply-To: <e6749e3132950dfa68c7c792b59cd654.support1@rcdrun.com>

> Regarding your library `thingatpt+.el':
> 
> You probably know Hyperbole and how M-RET works in Hyperbole.

Nope, sorry.  I probably don't know about most things
available with Emacs - many, anyway.

> [I wish] to jump to various functions by using
> thing-at-point plus. It gives me freedom to easier
> define what I need, and if nothing found I can still
> include Hyperbole function on the end.
> 
> The concept to "jump" based on some things at point, 
> is useful. I jump faster to various pieces of information.
> 
> Here is the preliminary function that shows the concept:
> 
> (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.

> 	((thing-at-point 'url)...)
> 	((thing-at-point 'email)...)
> 	((thing-at-point 'symbol)
> 	 (let ((symbol (intern (thing-at-point 'symbol))))
> 	   (cond ((fboundp symbol)
> 		  (find-function symbol))
> 		 ((boundp symbol)
> 		  (find-variable symbol))
> 		 (t (rcd-warning-message "...")))))
>    ...

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.

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.

You can also define a function to give you the
bounds (limits) of a thing, e.g., the bounds of
the Lisp function named at point:

(put 'lisp-function 'tap-bounds-of-thing-at-point
     'tap-bounds-of-lisp-function-at-point)

(defun tap-bounds-of-lisp-function-at-point ()
  "Return bounds of the Lisp function at point.
Return nil if none is found."
  (and (lisp-function-at-point)
       (tap-bounds-of-thing-at-point 'symbol)))

> Do you know of any existing package(s), apart from Hyperbole, that
> deal in similar way with action keys and jumping based on what is found
> under the point?

I'm the wrong person to ask about what packages
are available for things.

But the Emacs manual, node `Xref' tells you about
ways to find the source code (definitions) for
existing "identifiers", which can be any "syntactical
subunit of [a] program: a function, a subroutine, a
method, a class, a data type, a macro, etc."

https://www.gnu.org/software/emacs/manual/html_node/emacs/Xref.html

That may help to some extent.  But you apparently
want to jump to other kinds of things.

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.

Hopefully others will have other suggestions.



  reply	other threads:[~2023-01-02 17:08 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-02 10:12 Any packages using ThingAtPointPlus for activation? Jean Louis
2023-01-02 17:08 ` Drew Adams [this message]
2023-01-03 12:41   ` [External] : " Jean Louis
2023-01-03 19:54     ` Drew Adams
2023-01-03 20:23       ` Jean Louis
2023-01-03 22:47         ` Drew Adams
2023-01-04  8:46           ` Jean Louis
2023-01-04 15:42             ` Drew Adams
2023-01-04 16:03             ` Eduardo Ochs
2023-01-05  5:42               ` Jean Louis
2023-01-05  8:37   ` ThingAtPointPlus, and extending things at point Jean Louis
2023-01-05 17:00     ` [External] : " Drew Adams
2023-01-06 15:49       ` Jean Louis
2023-01-06 16:23       ` Jean Louis
2023-01-06 17:30         ` Drew Adams
2023-01-06 17:43           ` Jean Louis
2023-01-06 18:21             ` Drew Adams
2023-01-03  6:16 ` Any packages using ThingAtPointPlus for activation? Eduardo Ochs
2023-01-03 13:10   ` Jean Louis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SJ0PR10MB54880525EDEA0D3D462FF17DF3F79@SJ0PR10MB5488.namprd10.prod.outlook.com \
    --to=drew.adams@oracle.com \
    --cc=bugs@gnu.support \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.