all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#8667: 24.0.50; `bounds-of-thing-at-point' returns (N . N) for `comment'
@ 2011-05-13  0:46 Drew Adams
  2011-05-13  3:00 ` Drew Adams
  0 siblings, 1 reply; 31+ messages in thread
From: Drew Adams @ 2011-05-13  0:46 UTC (permalink / raw)
  To: 8667

emacs -Q
 
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))
      (real-beg
       (progn
        (funcall
         (or (get thing 'beginning-op)
             (lambda () (forward-thing thing -1))))
        (point))))
  ;; 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 24.0.50.1 (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
-Ic:/build/include'
 






^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2011-05-28  7:13 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-13  0:46 bug#8667: 24.0.50; `bounds-of-thing-at-point' returns (N . N) for `comment' Drew Adams
2011-05-13  3:00 ` Drew Adams
2011-05-13  5:56   ` Kevin Rodgers
2011-05-13 14:24     ` bug#8670: OT: " Drew Adams
2011-05-13 14:11   ` Stefan Monnier
2011-05-13 15:49     ` Drew Adams
2011-05-13 16:11       ` Drew Adams
2011-05-13 17:05         ` Stefan Monnier
2011-05-19 17:12           ` Drew Adams
2011-05-20  2:12             ` Stefan Monnier
2011-05-21 14:52               ` Drew Adams
2011-05-21 15:06                 ` Eli Zaretskii
2011-05-21 15:15                   ` Drew Adams
2011-05-21 15:52                     ` Eli Zaretskii
2011-05-21 18:18                       ` Drew Adams
2011-05-27 14:08                   ` Drew Adams
2011-05-27 14:11                     ` HTTP access to Emacs source code Drew Adams
2011-05-27 18:11                       ` Eli Zaretskii
2011-05-27 18:19                         ` Drew Adams
2011-05-27 20:51                           ` Drew Adams
2011-05-27 21:17                             ` Eli Zaretskii
2011-05-27 21:58                               ` Drew Adams
2011-05-27 23:01                               ` Christoph Scholtes
2011-05-27 23:05                                 ` Drew Adams
2011-05-27 23:40                                   ` Paul Eggert
2011-05-28  0:51                                     ` Stefan Monnier
2011-05-28  1:11                                       ` Glenn Morris
2011-05-28  7:13                                     ` Eli Zaretskii
2011-05-19 18:24     ` bug#8667: 24.0.50; `bounds-of-thing-at-point' returns (N . N) for `comment' Drew Adams
2011-05-20  2:18       ` Stefan Monnier
2011-05-21 14:51         ` Drew Adams

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.