[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-bug-tracker] bug#8667: closed (24.0.50; `bounds-of-thing-at-point
GNU bug Tracking System
[Emacs-bug-tracker] bug#8667: closed (24.0.50; `bounds-of-thing-at-point' returns (N . N) for `comment')
Sat, 21 May 2011 14:54:02 +0000
Your message dated Sat, 21 May 2011 07:52:58 -0700
with message-id <address@hidden>
and subject line RE: bug#8667: 24.0.50; `bounds-of-thing-at-point' returns (N .
N) for `comment'
has caused the GNU bug report #8667,
regarding 24.0.50; `bounds-of-thing-at-point' returns (N . N) for `comment'
to be marked as done.
(If you believe you have received this mail in error, please contact
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message ---
24.0.50; `bounds-of-thing-at-point' returns (N . N) for `comment'
Thu, 12 May 2011 17:46:33 -0700
Put point at position 3061 in file thingatpt.el (i.e., just before the
`a' of `condition-case').
M-: (bounds-of-thing-at-point 'comment)
returns (3061 . 3061), which represents an empty thing, "".
This happens at most positions, probably all positions outside a comment.
The code should handle this kind of case correctly (in other respects it
seems to work OK for comments).
The problem is that there is no `beginning-op' or `end-op' and all of
the calls to `forward-thing' (with 1 and -1) do not move point at all,
and return nil. So the code falls through to the end:
(let ((end (point))
(or (get thing 'beginning-op)
(lambda () (forward-thing thing -1))))
;; real-beg = end = (point). Result is (cons 3061 . 3061).
(if (and real-beg end (<= real-beg orig) (<= orig end))
(cons real-beg end)))
`bounds-of-thing-at-point' should foresee such a case (that `forward-THING' does
nothing). IOW, it should of course be fixed for this problem.
But it sounds like `forward-comment' should also be fixed so that it acts like
other `forward-THING' functions, and not just be a no-op when outside a comment.
In GNU Emacs 188.8.131.52 (i386-mingw-nt5.1.2600)
of 2011-05-10 on 3249CTO
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (4.5) --no-opt --cflags
--- End Message ---
--- Begin Message ---
RE: bug#8667: 24.0.50; `bounds-of-thing-at-point' returns (N . N) for `comment'
Sat, 21 May 2011 07:52:58 -0700
> > No, I don't think you did. I just downloaded the latest
> > thingatpt.el. There is no fix AFAICT.
> From which branch?
In the past that has always given the trunk AFAIK. And in the past it has been
the _only_ HTTP access that has been reliable (works). But apparently it is no
longer kept up-to-date.
I just now tried
and got this, which is typically the case:
Please try again
Sorry, there was a problem connecting to the Launchpad server.
Try reloading this page in a minute or two. If the problem persists,
let us know in the #launchpad IRC channel on Freenode.
Thanks for your patience.
It used to be easy to access Emacs source code via HTTP (back when you used CVS,
IIRC). Now it is difficult, even if occasionally still possible. After
repeatedly trying that second URL, I was finally able to get your fixed file.
The first part of this bug report does seem to be fixed: no empty thing
The second part is not fixed. `bounds-of-thing-at-point' can still return a
cons when it should return nil. It can easily return a cons that represents a
purely whitespace, non-comment for thing-type `comment'. This in turn means
that `thing-at-point' returns a whitespace, non-comment for thing-type
This is a bug in `thingatpt.el'. It is either a bug in
`bounds-of-thing-at-point', if we expect that general function to DTRT in this
case, or it is a bug in that there is a missing function
`bounds-of-comment-at-point' and consequent (put 'comment
'bounds-of-thing-at-point 'bounds-of-comment-at-point). Or some such fix.
I already gave the recipe to reproduce the bug. I can repeat it if necessary.
`b-o-t-a-p' depends for its generic effect on functions such as `forward-THING'.
Sometimes that is enough to make `b-o-t-a-p' DTRT; sometimes it is not enough.
When it is not, as in this case, other measures need to be taken, such as
defining a THING-specific `bounds-of-THING-at-point' function and putting that
on the THING symbol as property `bounds-of-thing-at-point'.
One way or the other, and there are several alternatives, this needs to be
fixed. It is a bug for `b-o-t-a-p' to return non-nil when there is no comment
at point, and thus for `thing-at-point' to return a non-nil, non-comment value.
--- End Message ---