summaryrefslogtreecommitdiff
path: root/lisp/thingatpt.el
diff options
context:
space:
mode:
authorPhilipp Stephani <phst@google.com>2017-06-15 11:49:56 +0200
committerPhilipp Stephani <phst@google.com>2017-06-16 18:06:28 +0200
commit3b6e01cccf89ba0f3485751125f43463bc429345 (patch)
tree439adae70db311405f2abd6369ad75004eb2eca4 /lisp/thingatpt.el
parentea196ebb93188b0962f478f5dec0ff0645c4da10 (diff)
downloademacs-3b6e01cccf89ba0f3485751125f43463bc429345.tar.gz
Correctly detect URLs surrounded by parentheses in comments
* 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.
Diffstat (limited to 'lisp/thingatpt.el')
-rw-r--r--lisp/thingatpt.el4
1 files changed, 3 insertions, 1 deletions
diff --git a/lisp/thingatpt.el b/lisp/thingatpt.el
index 25e01df70ee..7c3d73e52b7 100644
--- a/lisp/thingatpt.el
+++ b/lisp/thingatpt.el
@@ -380,7 +380,9 @@ the bounds of a possible ill-formed URI (one lacking a scheme)."
(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