From 11199da7f8edf37fc0f8409630024119067f078b Mon Sep 17 00:00:00 2001 From: Jason Blevins Date: Sat, 12 Mar 2016 15:09:10 -0500 Subject: [PATCH] Move point past comment opening Fixes GH-117, where was not being highlighted or uncommented correctly. --- markdown-mode.el | 6 ++++-- tests/markdown-test.el | 6 ++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/markdown-mode.el b/markdown-mode.el index f4757103..05016f0c 100644 --- a/markdown-mode.el +++ b/markdown-mode.el @@ -1910,13 +1910,15 @@ start which was previously propertized." (let ((open-beg (match-beginning 0))) (put-text-property open-beg (1+ open-beg) 'syntax-table (string-to-syntax "<")) - (markdown-syntax-propertize-comments (1+ open-beg) end))) + (markdown-syntax-propertize-comments + (min (1+ (match-end 0)) end (point-max)) end))) ;; Comment end ((and in-comment (re-search-forward markdown-regex-comment-end end t)) (put-text-property (1- (match-end 0)) (match-end 0) 'syntax-table (string-to-syntax ">")) - (markdown-syntax-propertize-comments (match-end 0) end)) + (markdown-syntax-propertize-comments + (min (1+ (match-end 0)) end (point-max)) end)) ;; Nothing found (t nil)))) diff --git a/tests/markdown-test.el b/tests/markdown-test.el index 111708e5..8ba0870d 100644 --- a/tests/markdown-test.el +++ b/tests/markdown-test.el @@ -2245,6 +2245,12 @@ for (var i = 0; i < 10; i++) { (markdown-test-range-face-equals (point-min) (1- (point-max)) markdown-comment-face))) +(ert-deftest test-markdown-font-lock/comment-angle-bracket () + "Regression test for GH-117." + (markdown-test-string "" + (markdown-test-range-face-equals (point-min) (1- (point-max)) + markdown-comment-face))) + (ert-deftest test-markdown-font-lock/footnote-markers-links () "Test an edge case involving footnote markers and inline reference links." (markdown-test-string "Harvard[^1] [tuition][]"