]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix bug in thing-at-point--bounds-of-well-formed-url
authorLeo Liu <sdl.web@gmail.com>
Thu, 9 Jul 2015 02:18:00 +0000 (10:18 +0800)
committerLeo Liu <sdl.web@gmail.com>
Thu, 9 Jul 2015 02:19:42 +0000 (10:19 +0800)
* lisp/thingatpt.el (thing-at-point--bounds-of-well-formed-url): Make
  sure boundary contains current point.

lisp/thingatpt.el

index c26b9be1da890865cfbb3a459e31ec30fc059a04..84ffcca52905d1c7775d25cc26e1cc17f5a9adbc 100644 (file)
@@ -361,7 +361,7 @@ the bounds of a possible ill-formed URI (one lacking a scheme)."
       (if found
          (cons (match-beginning 1) (match-end 1))))))
 
-(defun thing-at-point--bounds-of-well-formed-url (beg end _pt)
+(defun thing-at-point--bounds-of-well-formed-url (beg end pt)
   (save-excursion
     (goto-char beg)
     (let (url-beg paren-end regexp)
@@ -388,7 +388,11 @@ the bounds of a possible ill-formed URI (one lacking a scheme)."
                                 (scan-lists (1- url-beg) 1 0))))
             (not (blink-matching-check-mismatch (1- url-beg) paren-end))
             (setq end (1- paren-end)))
-       (cons url-beg end)))))
+       ;; Ensure PT is actually within BOUNDARY. Check the following
+       ;; example with point on the beginning of the line:
+       ;;
+       ;; 3,1406710489,http://gnu.org,0,"0"
+       (and (<= url-beg pt end) (cons url-beg end))))))
 
 (put 'url 'thing-at-point 'thing-at-point-url-at-point)