diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2011-05-13 14:02:56 -0300 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2011-05-13 14:02:56 -0300 |
commit | f278f87fe6b2556d2152c72b0f9460b44bb4ff24 (patch) | |
tree | 2e690df8b81381224f5fe55132aebf42cb310cf8 /lisp/thingatpt.el | |
parent | ceb90e51986a8aa3e6e141137013fe454db48a78 (diff) | |
download | emacs-f278f87fe6b2556d2152c72b0f9460b44bb4ff24.tar.gz |
* lisp/thingatpt.el (bounds-of-thing-at-point): Return nil rather than
bounds for the empty string.
Fixes: debbugs:8667
Diffstat (limited to 'lisp/thingatpt.el')
-rw-r--r-- | lisp/thingatpt.el | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lisp/thingatpt.el b/lisp/thingatpt.el index a56c3e4d501..a2aeb2e6d67 100644 --- a/lisp/thingatpt.el +++ b/lisp/thingatpt.el @@ -89,18 +89,19 @@ of the textual entity that was found." (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 @@ of the textual entity that was found." (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))))) |