unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Drew Adams <drew.adams@oracle.com>, 9300@debbugs.gnu.org
Subject: bug#9300: 24.0.50; `bounds-of-thing-at-point' does not return nil when just after THING
Date: Wed, 24 Feb 2016 02:52:36 +0200	[thread overview]
Message-ID: <27990eb0-3d4e-62c7-257d-7ea7a8204e2d@yandex.ru> (raw)
In-Reply-To: <e57a89a3-4fda-4cb7-91c2-646aee0cbd22@default>

On 02/23/2016 06:15 PM, Drew Adams wrote:

> Yes, it should return nil, as there is NO symbol at point.

If we ask the users, I'm guessing we'll get mixed answers on that, at 
least as a result of this long-standing thing-at-point behavior.

> It is your expectation that is wrong.  There are plenty of uses
> of thing-at-point that go far beyond just looking for a default
> value of a name near point or trying to complete a name before
> (not at) point.

What I'm saying is, "fixing" it will most likely break code in the wild. 
Not just mine.

> Those other uses include the need to test whether or not there
> IS a given THING at point.  The design itself depends on this
> difference: Is there a THING at point or not?

They can call (bounds-of-thing-at-point 'foo), and then compare the cdr 
with the value of point.

> The purpose of
> thingatpt.el is not only to maximize finding a THING that is
> _near_ point.  One purpose is to test whether there IS a THING
> AT point.

We're a long way from maximizing it. To see something closer to the 
other end of the spectrum, see the definition of find-tag-default-bounds 
before 
http://git.savannah.gnu.org/cgit/emacs.git/commit/?h=emacs-25&id=e72a26e00981a508569a0856125061310a3f64ac.

> I see (in emacs-devel) that you are now looking into
> picking up a name near point - but you are limiting that to the
> same line.

Not at all, see above.

>>> This is the design of the thingatpt code, and the reason why
>>> `<=' instead of `<' is a bug:
>>>
>>>    the function that is (get THING 'end-op) moves PAST the THING,
>>>    so that point is not on the THING.  This is true generally, no
>>>    matter the type of THING.
>>
>> That's not a quote from thingatpt.el.
>
> It is nevertheless the design (intention), clear from the code.

I'm not so clear on that. The following comment tells me the opposite 
(the position where a substring ends is normally the one _after_ its 
last character):

     ;; Try a second time, moving backward first and then forward,
     ;; so that we can find a thing that ends at ORIG.

If we didn't need to be able to find a thing that ends just before 
point, I don't think the implementation would need the "Try a second 
time" branch at all: when point if before the last character of a 
symbol, (forward-symbol) still works.





  reply	other threads:[~2016-02-24  0:52 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <<B1052724B2D446C59E233FC1BD437723@us.oracle.com>
2015-07-29  1:44 ` bug#9300: 24.0.50; `bounds-of-thing-at-point' does not return nil when just after THING 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 [this message]
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
2011-08-14 22:36 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-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

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=27990eb0-3d4e-62c7-257d-7ea7a8204e2d@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=9300@debbugs.gnu.org \
    --cc=drew.adams@oracle.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 public inbox

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

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