all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: "Dmitry Gutov" <dgutov@yandex.ru>,
	"Andreas Röhler" <andreas.roehler@easy-emacs.de>,
	emacs-devel@gnu.org
Subject: RE: Fwd: Re: bug#9300: 24.0.50; `bounds-of-thing-at-point' does not return nil when just after THING
Date: Wed, 6 Jul 2016 23:31:25 +0000 (UTC)	[thread overview]
Message-ID: <a5d70097-9260-4c74-8761-883b3c7e2d21@default> (raw)
In-Reply-To: <4a8dc209-e526-24b4-ac63-de5c32bfed2c@yandex.ru>

> > The first thing I'd like to ask is whether the suffix "-at-point" means
> > the same thing everywhere it appears. If `bounds-of-thing-at-point' is the
> > only place where it differs, it's worth thinking about.
> 
> completion-at-point is the same as thing-at-point in this regard, currently.

(Of course it is.  All completion defaulting cares about is getting
something _near_ point, not determining _whether there is_ something
at point, and if there is, getting that.  It doesn't care to be precise
about what's _at_ point.  On the contrary; it wants to maximize getting
something near point.)

The _character_ "at" point (which is what this comes down to) is not
usually how we talk about this.  Point, like any other buffer position,
is always _between_ chars (or is at bob or eob).  We have functions
such as `char-after' and `char-before'.  So the more precise way of
talking about this is the character after (i.e., just after) point.

But the point (!) of the thing-at-point functions is to pick up a
thing that is really "at" some position.  And the point of the bug
report is that a position means a _single_ position.

In order to be precise, and thus to be generally usable, including in
a repetitive way, progressing through a buffer etc., the thing-at-point
functions need to refer to a single position - whether that be chosen
by convention to be the position just before the character in question
or the position just after it.

See the opening salvos of the bug report for a discussion of why
thing-at-point really means thing just after point.  I don't want
to repeat everything here (dunno why this was moved out of the bug
thread, either).

The point (!) of the bug report is that the thing-at-point feature
cannot reasonably mean just give me EITHER a thing before point OR
a thing after point (even if it gives you the first of those that
it finds).

That would be OK if all you expect of the functions is to grab
something _near_ point in the buffer, to use as a default value
(e.g. for completion or input).  It is not OK when it comes to
really making use of the functions in a precise way, and in
particular, a repetitive way, to progressively deal with things
through a buffer.

What's needed for a real thing-at-point is what the (simple) bug
fix provides: unambiguously provide the thing just after point -
only.  More generally, the functions need to return a thing at
some ONE position, however that position is decided on.  And they
need to return nil when there is no thing at that position.

On the other hand, what's needed (it would be an improvement) for
the more loose uses of thing-at-point, such as getting a default
value, is thing-NEAR-point functions.  And the bug report points
to exactly such (existing) functions, even with user or code
control over how near "near" is, horizontally and vertically.

That kind of function is appropriate in contexts where all you
care about is _getting something near point_, and you in fact
want to maximize the ability to getsomething and you don't need
to determine _whether or not_ there really is a thing at a given
position.

In sum, both are useful:

* Functions that deal with a thing AT a given position, precisely.
* Functions that deal with a thing NEAR a given position.

Both are addressed in the bug thread.  But the purpose of the bug
report is to get the former fixed so it DTRT: returns a thing at
the char just after point, or returns nil if there is none such.



  reply	other threads:[~2016-07-06 23:31 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-14 22:36 bug#9300: 24.0.50; `bounds-of-thing-at-point' does not return nil when just after THING Drew Adams
2016-06-20  9:21 ` Tino Calancha
2016-06-20 12:53   ` Dmitry Gutov
2016-06-20 13:11     ` Tino Calancha
2016-06-20 14:48   ` Eli Zaretskii
2016-06-21  3:01     ` Tino Calancha
     [not found]   ` <<8337o79arh.fsf@gnu.org>
2016-06-20 17:50     ` Drew Adams
2016-06-20 18:38       ` Andreas Röhler
2016-06-20 20:04       ` Eli Zaretskii
2016-06-21  6:14         ` Andreas Röhler
2016-06-21 12:50           ` Eli Zaretskii
2016-06-21 13:07             ` Andreas Röhler
2016-06-21 15:13               ` Eli Zaretskii
2016-06-21 13:31             ` Drew Adams
2016-06-21 15:16               ` Eli Zaretskii
2016-06-22  5:23             ` Fwd: " Andreas Röhler
2016-07-06 21:21               ` John Wiegley
2016-07-06 21:51                 ` Dmitry Gutov
2016-07-06 23:31                   ` Drew Adams [this message]
2016-07-07  8:00                     ` Andreas Röhler
2016-06-21 13:25           ` Drew Adams
     [not found]   ` <<<8337o79arh.fsf@gnu.org>
     [not found]     ` <<0e2c9c67-12a2-4712-92d2-e3c204f46838@default>
     [not found]       ` <<83twgn7hjx.fsf@gnu.org>
2016-06-20 23:34         ` Drew Adams
2016-06-20 23:59           ` Noam Postavsky
2016-06-21  0:47             ` Drew Adams
     [not found] <<B1052724B2D446C59E233FC1BD437723@us.oracle.com>
2015-07-29  1:44 ` Drew Adams
2016-01-15 13:33   ` Drew Adams
2016-02-23  1:01     ` Dmitry Gutov
2016-02-23  6:37       ` Drew Adams
2016-02-23  7:59         ` Andreas Röhler
2016-02-23 10:22         ` Dmitry Gutov
2016-02-23 16:15           ` Drew Adams
2016-02-24  0:52             ` Dmitry Gutov
2016-02-24  1:31               ` Drew Adams
2016-02-26  1:03                 ` Dmitry Gutov
2016-02-26  1:44                   ` Drew Adams
2016-02-26 10:15                     ` Dmitry Gutov
2016-02-26 14:39                       ` Drew Adams
2016-02-26 15:25                         ` Dmitry Gutov
2016-02-26 17:00                           ` Drew Adams
2022-04-28 11:24       ` Lars Ingebrigtsen
2022-04-28 15:49         ` 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=a5d70097-9260-4c74-8761-883b3c7e2d21@default \
    --to=drew.adams@oracle.com \
    --cc=andreas.roehler@easy-emacs.de \
    --cc=dgutov@yandex.ru \
    --cc=emacs-devel@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.