aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2011-05-13 14:02:56 -0300
committerStefan Monnier2011-05-13 14:02:56 -0300
commitf278f87fe6b2556d2152c72b0f9460b44bb4ff24 (patch)
tree2e690df8b81381224f5fe55132aebf42cb310cf8
parentceb90e51986a8aa3e6e141137013fe454db48a78 (diff)
downloademacs-f278f87fe6b2556d2152c72b0f9460b44bb4ff24.tar.gz
emacs-f278f87fe6b2556d2152c72b0f9460b44bb4ff24.zip
* lisp/thingatpt.el (bounds-of-thing-at-point): Return nil rather than
bounds for the empty string. Fixes: debbugs:8667
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/thingatpt.el9
2 files changed, 11 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 3fa18d2480b..b4807f7d279 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,9 +1,14 @@
12011-05-13 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * thingatpt.el (bounds-of-thing-at-point): Return nil rather than
4 bounds for the empty string (bug#8667).
5
12011-05-13 Glenn Morris <rgm@gnu.org> 62011-05-13 Glenn Morris <rgm@gnu.org>
2 7
3 * mail/feedmail.el (feedmail-buffer-to-sendmail): Require sendmail. 8 * mail/feedmail.el (feedmail-buffer-to-sendmail): Require sendmail.
4 9
5 * mail/sendmail.el (sendmail-program): Try executable-find first. 10 * mail/sendmail.el (sendmail-program): Try executable-find first.
6 (sendmail-send-it): sendmail-program cannot be unbound. 11 (sendmail-send-it): `sendmail-program' cannot be unbound.
7 12
8 * calendar/appt.el (appt-make-list): Simplify. 13 * calendar/appt.el (appt-make-list): Simplify.
9 (appt-time-msg-list): Doc fix. 14 (appt-time-msg-list): Doc fix.
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."
89 (or (get thing 'beginning-op) 89 (or (get thing 'beginning-op)
90 (lambda () (forward-thing thing -1)))) 90 (lambda () (forward-thing thing -1))))
91 (let ((beg (point))) 91 (let ((beg (point)))
92 (if (not (and beg (> beg orig))) 92 (if (<= beg orig)
93 ;; If that brings us all the way back to ORIG, 93 ;; If that brings us all the way back to ORIG,
94 ;; it worked. But END may not be the real end. 94 ;; it worked. But END may not be the real end.
95 ;; So find the real end that corresponds to BEG. 95 ;; So find the real end that corresponds to BEG.
96 ;; FIXME: in which cases can `real-end' differ from `end'?
96 (let ((real-end 97 (let ((real-end
97 (progn 98 (progn
98 (funcall 99 (funcall
99 (or (get thing 'end-op) 100 (or (get thing 'end-op)
100 (lambda () (forward-thing thing 1)))) 101 (lambda () (forward-thing thing 1))))
101 (point)))) 102 (point))))
102 (if (and beg real-end (<= beg orig) (<= orig real-end)) 103 (when (and (<= orig real-end) (< beg real-end))
103 (cons beg real-end))) 104 (cons beg real-end)))
104 (goto-char orig) 105 (goto-char orig)
105 ;; Try a second time, moving backward first and then forward, 106 ;; Try a second time, moving backward first and then forward,
106 ;; so that we can find a thing that ends at ORIG. 107 ;; so that we can find a thing that ends at ORIG.
@@ -117,7 +118,7 @@ of the textual entity that was found."
117 (or (get thing 'beginning-op) 118 (or (get thing 'beginning-op)
118 (lambda () (forward-thing thing -1)))) 119 (lambda () (forward-thing thing -1))))
119 (point)))) 120 (point))))
120 (if (and real-beg end (<= real-beg orig) (<= orig end)) 121 (if (and (<= real-beg orig) (<= orig end) (< real-beg end))
121 (cons real-beg end)))))) 122 (cons real-beg end))))))
122 (error nil))))) 123 (error nil)))))
123 124