emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r104219: * lisp/thingatpt.el (bounds-


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r104219: * lisp/thingatpt.el (bounds-of-thing-at-point): Return nil rather than
Date: Fri, 13 May 2011 14:02:56 -0300
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 104219
fixes bug(s): http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8667
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Fri 2011-05-13 14:02:56 -0300
message:
  * lisp/thingatpt.el (bounds-of-thing-at-point): Return nil rather than
  bounds for the empty string.
modified:
  lisp/ChangeLog
  lisp/thingatpt.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-05-13 02:06:35 +0000
+++ b/lisp/ChangeLog    2011-05-13 17:02:56 +0000
@@ -1,9 +1,14 @@
+2011-05-13  Stefan Monnier  <address@hidden>
+
+       * thingatpt.el (bounds-of-thing-at-point): Return nil rather than
+       bounds for the empty string (bug#8667).
+
 2011-05-13  Glenn Morris  <address@hidden>
 
        * mail/feedmail.el (feedmail-buffer-to-sendmail): Require sendmail.
 
        * mail/sendmail.el (sendmail-program): Try executable-find first.
-       (sendmail-send-it): sendmail-program cannot be unbound.
+       (sendmail-send-it): `sendmail-program' cannot be unbound.
 
        * calendar/appt.el (appt-make-list): Simplify.
        (appt-time-msg-list): Doc fix.

=== modified file 'lisp/thingatpt.el'
--- a/lisp/thingatpt.el 2011-03-24 16:38:12 +0000
+++ b/lisp/thingatpt.el 2011-05-13 17:02:56 +0000
@@ -89,18 +89,19 @@
              (or (get thing 'beginning-op)
                  (lambda () (forward-thing thing -1))))
            (let ((beg (point)))
-             (if (not (and beg (> beg orig)))
+             (if (<= beg orig)
                  ;; If that brings us all the way back to ORIG,
                  ;; it worked.  But END may not be the real end.
                  ;; So find the real end that corresponds to BEG.
+                  ;; FIXME: in which cases can `real-end' differ from `end'?
                  (let ((real-end
                         (progn
                           (funcall
                            (or (get thing 'end-op)
                                 (lambda () (forward-thing thing 1))))
                           (point))))
-                   (if (and beg real-end (<= beg orig) (<= orig real-end))
-                       (cons beg real-end)))
+                   (when (and (<= orig real-end) (< beg real-end))
+                      (cons beg real-end)))
                (goto-char orig)
                ;; Try a second time, moving backward first and then forward,
                ;; so that we can find a thing that ends at ORIG.
@@ -117,7 +118,7 @@
                          (or (get thing 'beginning-op)
                               (lambda () (forward-thing thing -1))))
                         (point))))
-                 (if (and real-beg end (<= real-beg orig) (<= orig end))
+                 (if (and (<= real-beg orig) (<= orig end) (< real-beg end))
                      (cons real-beg end))))))
        (error nil)))))
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]