From 971c372b6ee933cc990b2a4fcbe7d04afc9e44dd Mon Sep 17 00:00:00 2001 From: Jason Blevins Date: Tue, 21 Nov 2017 00:08:51 -0500 Subject: [PATCH] Don't move point in markdown-in-comment-p --- markdown-mode.el | 2 +- tests/markdown-test.el | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/markdown-mode.el b/markdown-mode.el index 5ee014a..309c486 100644 --- a/markdown-mode.el +++ b/markdown-mode.el @@ -1968,7 +1968,7 @@ Group 3 matches all attributes and whitespace following the tag name.") (defsubst markdown-in-comment-p (&optional pos) "Return non-nil if POS is in a comment. If POS is not given, use point instead." - (nth 4 (syntax-ppss pos))) + (save-excursion (nth 4 (syntax-ppss pos)))) (defun markdown-syntax-propertize-extend-region (start end) "Extend START to END region to include an entire block of text. diff --git a/tests/markdown-test.el b/tests/markdown-test.el index 35fac67..ebdbd98 100644 --- a/tests/markdown-test.el +++ b/tests/markdown-test.el @@ -3625,6 +3625,14 @@ only partially propertized." (forward-line) (should-not (markdown-inline-code-at-point-p)))) +(ert-deftest test-markdown-parsing/in-comment-p-position () + "Test `markdown-in-comment-p'." + (markdown-test-string + "HTML comment" + (should (eq (point) (point-min))) + (should-not (markdown-in-comment-p (point-max))) + (should (eq (point) (point-min))))) + (ert-deftest test-markdown-parsing/match-comments () "Test `markdown-match-comments'." (markdown-test-string @@ -3655,7 +3663,7 @@ x: x `x` " (should (markdown-match-code (point-max))) - (should (= (point) 17)) + (should (= (point) 18)) (should (equal (match-data t) '(14 17 14 15 15 16 16 17))) (should-not (markdown-match-code (point-max))))) -- 2.11.4.GIT