From: Eduardo Ochs <eduardoochs@gmail.com>
To: Jean Louis <bugs@gnu.support>
Cc: Help GNU Emacs <help-gnu-emacs@gnu.org>,
Drew Adams <drew.adams@oracle.com>
Subject: Re: Any packages using ThingAtPointPlus for activation?
Date: Tue, 3 Jan 2023 03:16:50 -0300 [thread overview]
Message-ID: <CADs++6jdqmpjoHNBWHBJbmrUM5Mz6awVLJQD+R6K5O40=EN9VA@mail.gmail.com> (raw)
In-Reply-To: <e6749e3132950dfa68c7c792b59cd654.support1@rcdrun.com>
On Mon, 2 Jan 2023 at 07:13, Jean Louis <bugs@gnu.support> wrote:
>
> Dear Drew,
>
> Regarding your library:
> https://www.emacswiki.org/emacs/ThingAtPointPlus
>
> You probably know Hyperbole and how M-RET works in Hyperbole. I like
> the concept and wish to use M-RET in similar fashion, though without
> Hyperbole package, so 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)))
> ;; the above would find UUID in databases or Org files and jump there.
> ((thing-at-point 'url) (browse-url (thing-at-point 'url)))
> ;; the above browse the URL
> ((thing-at-point 'email) (rcd-write-email user-full-name user-mail-address (thing-at-point 'email) (thing-at-point 'email)))
> ;; the above writes the e-mail to email address found at point
> ((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 "Could not find symbol `%s'" symbol)))))
> ;; the above finds definition of a function similar like xref but works outside of Emacs Lisp mode
> ((thing-at-point 'number) (hyperscope-isolate (thing-at-point 'number)))
> ;; the above would jump to elementary object in Hyperscope database
> (t (rcd-message "Hyperscope action not defined.")))))
> ;; Or I get warning
>
> ;; Easy to define global key
> (keymap-global-set "M-RET" #'hyperscope-action-button)
>
> I want to expand the concept by following thinking:
>
> - M-RET -- jump to default function
> - C-u 0 M-RET -- capture thing at point
> - C-u 1 M-RET -- share thing at point
> - C-u 2 M-RET -- etc. etc. etc.
>
> Point of this e-mail:
> ---------------------
>
> Before I continue expanding the concept, it is better I ask you and others about previous work.
>
> Do you know of any existing package(s), apart from Hyperbole, that
> deal in similar way with action keys andjumping based on what is found
> under the point?
>
> On MELPA, I see related packages, that have useful functions:
> https://melpa.org/#/?q=at-point
>
> And M-x package-list-packages did not give me some more relevant
> information about "thing" and "jump".
Hi Jean Louis,
just one comment... `hyperscope-action-button' is written in a way
that I don't like: it doesn't let us inspect what is the thing at
point before doing something with the thing at point, and so it is
hard to debug. I would factor it in at least two functions, and the
lower-level one would be something like this, but I've omitted the
case that tests for interned symbols...
(defun ee-thing-at-point ()
(cond ((thing-at-point 'symbol) (list 'symbol (thing-at-point 'symbol)))
((thing-at-point 'url) (list 'url (thing-at-point 'url)))
((thing-at-point 'email) (list 'email (thing-at-point 'email)))
((thing-at-point 'number) (list 'number (thing-at-point 'number)))
))
In eev I have something similar to that, but that classifies the
current buffer into several kinds instead of classifying the thing
around point into several kinds. It is here,
http://angg.twu.net/eev-current/eev-hlinks.el.html#ee-fhl-main-program
(find-eev "eev-hlinks.el" "ee-fhl-main-program")
and it is written in a way in which I can replace the code that
interprets the "program" by something more elegant without having to
change the "program" itself... which is good, because I think that the
current interpreter is not very well-written. But the current version
has a debugging mode that is decently good - try `M-1 M-h M-h' to see
what it shows.
Cheers,
Eduardo Ochs
http://angg.twu.net/#eev
next prev parent reply other threads:[~2023-01-03 6:16 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 ` [External] : " Drew Adams
2023-01-03 12:41 ` 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 ` Eduardo Ochs [this message]
2023-01-03 13:10 ` Any packages using ThingAtPointPlus for activation? 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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CADs++6jdqmpjoHNBWHBJbmrUM5Mz6awVLJQD+R6K5O40=EN9VA@mail.gmail.com' \
--to=eduardoochs@gmail.com \
--cc=bugs@gnu.support \
--cc=drew.adams@oracle.com \
--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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).