unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Jean Louis <bugs@gnu.support>
Cc: Help GNU Emacs <help-gnu-emacs@gnu.org>
Subject: RE: [External] : Any packages using ThingAtPointPlus for activation?
Date: Tue, 3 Jan 2023 19:54:52 +0000	[thread overview]
Message-ID: <SJ0PR10MB5488F1F455B1791D5A0F01D2F3F49@SJ0PR10MB5488.namprd10.prod.outlook.com> (raw)
In-Reply-To: <Y7QijqbosJb389jx@protected.localdomain>

> > > (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.

(That seems unrelated to the text you quoted.)

Feel free to code what you (think you) want. ;-)

I don't see the point of that, but that doesn't
mean it has no point.  Why would you want to
spend time gathering all (of some set, presumably)
the possible things at point?

I suppose I can imagine your wanting to try to get
THING1 first, and if there is none, then try to
get THING2, etc. That's something else again.  You
could easily write code that does that, given a
list of THINGS.  Cf. `run-hook-with-args-until-success'.

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

Using `let', so you eval some sexp only once,
isn't only (or necessarily at all) a matter
of speed.  Among other things, it can also
make your code more readable: it becomes
clear what's already been done, and you can
give variables names that are relevant to the
current context.  E.g., you might use some
function that returns a list only for its
Boolean value (nil or not), and in the current
context that value might have a particular use
or meaning - so naming it can make your code
(especially if the defun is large) more
readable.

(Of course, this kind of thing is personal style.)

> > 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?

As I said: `fboundp'.  Or if you want to include only
real functions (not macros etc.), then `functionp'.

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

Yep.  I showed the use of `fboundp' in the example
code I sent.

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

I don't understand the question.  Can you rephrase it?

> Judging by the inspection of command {C-h v} it is following:
> - I should use (boundp SYMBOL) to recognize if it is variable

Yes, if you want a bound variable, and not just a
var that's only declared with a vacuous defvar:
(defvar foo).

> > 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?

Of course.  If you don't bookmark it there's no
bookmark for it.

  reply	other threads:[~2023-01-03 19:54 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 [this message]
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

  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=SJ0PR10MB5488F1F455B1791D5A0F01D2F3F49@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.
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).