all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Pedro Andres Aranda Gutierrez <paaguti@gmail.com>,
	emacs-devel <emacs-devel@gnu.org>
Subject: RE: Re: [External] : Re: Adding custom providers for thingatpt.el (was: [PATCH] Add support for 'thing-at-point' to get URL at point)
Date: Wed, 8 May 2024 18:14:55 +0000	[thread overview]
Message-ID: <SJ0PR10MB5488A3BE62A58A2E7BF7331CF3E52@SJ0PR10MB5488.namprd10.prod.outlook.com> (raw)
In-Reply-To: <CAO48Bk97scjnRwHTegBHDQC61E0EOtgvZaKLsz27qYyvamL2Aw@mail.gmail.com>

>> At the risk of veering off-topic (I mainly care about adding
>> 'bounds-of-thing-at-point-provider-alist' and
>> 'forward-thing-provider-alist'), would adding a new optional STRICT
>> argument to 'thing-at-point' and friends be an ok resolution for
>> everyone? This argument would enable Drew's proposed behavior. That way,
>> users get all the nice behavior by default just like today, and
>> programmers who require strict correctness in their code also have an
>> option.
>
> 1+ if STRICT means thing starting at point
> and without it we may need to look for the
> beginning of the thing (lazy point setting)....

Why "starting" at point?  STRICT shouldn't mean
checking whether a THING starts at point.

The "strict" behavior that's needed is checking
_whether_ there is a THING at point, that is,
checking whether the char at point (which really
means just after point) is on/inside a THING.

That's for `bounds-of-thing-at-point' etc.  For
thing-at-point etc., IF there's a THING at point
then that THING is the non-nil value returned.

In terms of implementation, I suggest you take
a look at the code in thingatpt+.el.  Look at
functions `tap-bounds-of-thing-at-point' and
`tap-thing-at-point'.  Just remove the `tap-'
prefix for code that DTRT.  The file Commentary
explains things in detail.

My code adds an optional arg SYNTAX-TABLE, but
you need not bother with that.  Elisp now has
`with-syntax-table', which can be used as a
workaround if there's no such argument.

In the end, `bounds-of-thing-at-point' and
`thing-at-point' should return nil if there's
no THING at the char at point.

For "lax" behavior that corresponds to the
current vanilla behavior, if the strict
behavior would return nil then they return
what the strict behavior would return at
(1- point).

But really such a lax behavior is pretty lame.
What's needed, for trying to grab a THING near
point is not just checking backward one char
but checking backward, forward, up, and down
N chars, where N determines what "near" means.

thingatpt+.el provides two user options,
`tap-near-point-x-distance' and
`tap-near-point-y-distance', the max number of
chars from point to check for a THING (for X:
left and right, for Y: up and down).  Setting
the Y value to zero constrains search to the
same line as point.

  reply	other threads:[~2024-05-08 18:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-08 16:09 Re: [External] : Re: Adding custom providers for thingatpt.el (was: [PATCH] Add support for 'thing-at-point' to get URL at point) Pedro Andres Aranda Gutierrez
2024-05-08 18:14 ` Drew Adams [this message]
2024-05-09  5:46   ` Pedro Andres Aranda Gutierrez
2024-05-15  8:06   ` Jean Louis
2024-05-15 20:56     ` Drew Adams
2024-05-15 21:25       ` Jean Louis
2024-05-15 21:56         ` Drew Adams
  -- strict thread matches above, loose matches on Subject: below --
2023-11-06 19:45 [PATCH] Add support for 'thing-at-point' to get URL at point Jim Porter
2023-11-06 20:11 ` Adding custom providers for thingatpt.el (was: [PATCH] Add support for 'thing-at-point' to get URL at point) Ihor Radchenko
2023-11-06 20:53   ` Jim Porter
2024-02-05 15:07     ` Ihor Radchenko
2024-02-05 22:44       ` Jim Porter
2024-04-12 12:41         ` Ihor Radchenko
2024-04-12 22:30           ` Jim Porter
2024-04-29  4:26             ` Jim Porter
2024-04-29 18:14               ` Ihor Radchenko
2024-04-30  4:42                 ` Jim Porter
2024-04-30 11:39                   ` Ihor Radchenko
2024-04-30 18:27                     ` Jim Porter
2024-04-30 21:10                       ` [External] : " Drew Adams
2024-05-07  1:08                         ` Jim Porter
2024-05-07  1:52                           ` Drew Adams

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=SJ0PR10MB5488A3BE62A58A2E7BF7331CF3E52@SJ0PR10MB5488.namprd10.prod.outlook.com \
    --to=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    --cc=paaguti@gmail.com \
    /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.