* lisp/thingatpt.el (thing-at-point--bounds-of-well-formed-url):
Make parentheses match work inside comments.
* test/lisp/thingatpt-tests.el (thing-at-point-url-in-comment): Add
unit test.
(save-restriction
(narrow-to-region (1- url-beg) (min end (point-max)))
(setq paren-end (ignore-errors
- (scan-lists (1- url-beg) 1 0))))
+ ;; Make the scan work inside comments.
+ (let ((parse-sexp-ignore-comments nil))
+ (scan-lists (1- url-beg) 1 0)))))
(not (blink-matching-check-mismatch (1- url-beg) paren-end))
(setq end (1- paren-end)))
;; Ensure PT is actually within BOUNDARY. Check the following
(should (equal (list-at-point)
(cdr str-res)))))))
+(ert-deftest thing-at-point-url-in-comment ()
+ (with-temp-buffer
+ (c-mode)
+ (insert "/* (http://foo/bar)\n(http://foo/bar(baz)) */\n")
+ (goto-char 6)
+ (should (equal (thing-at-point 'url) "http://foo/bar"))
+ (goto-char 23)
+ (should (equal (thing-at-point 'url) "http://foo/bar(baz)"))))
+
;;; thingatpt.el ends here