emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/markdown-mode 49fa5fe 2/2: Merge pull request #636 from jr


From: ELPA Syncer
Subject: [nongnu] elpa/markdown-mode 49fa5fe 2/2: Merge pull request #636 from jrblevin/issue-634
Date: Sun, 8 Aug 2021 10:57:41 -0400 (EDT)

branch: elpa/markdown-mode
commit 49fa5fec926b46a3c98d42d2db7faf5901f59781
Merge: f28e263 ecac0e7
Author: Shohei YOSHIDA <syohex@gmail.com>
Commit: GitHub <noreply@github.com>

    Merge pull request #636 from jrblevin/issue-634
    
    Fix issue of inserting code block at end of buffer
---
 CHANGES.md             |  4 +++-
 markdown-mode.el       |  3 ++-
 tests/markdown-test.el | 11 ++++++++++-
 3 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index 2f0d95f..742162d 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -67,7 +67,8 @@
         instead of globally
     -   Modify only the buffer-local part of
         `syntax-propertize-extend-region-functions`.
-    -   Fix list highlighting issue in code block
+    -   Fix list highlighting issue in code block [GH-631][]
+    -   Fix exception when inserting code block at end of buffer [GH-634][]
 
   [gh-290]: https://github.com/jrblevin/markdown-mode/issues/290
   [gh-311]: https://github.com/jrblevin/markdown-mode/issues/311
@@ -97,6 +98,7 @@
   [gh-622]: https://github.com/jrblevin/markdown-mode/issues/622
   [gh-625]: https://github.com/jrblevin/markdown-mode/issues/625
   [gh-631]: https://github.com/jrblevin/markdown-mode/issues/631
+  [gh-634]: https://github.com/jrblevin/markdown-mode/issues/634
 
 # Markdown Mode 2.4
 
diff --git a/markdown-mode.el b/markdown-mode.el
index 8011637..725a6b9 100644
--- a/markdown-mode.el
+++ b/markdown-mode.el
@@ -1552,7 +1552,8 @@ MIDDLE-BEGIN is the start of the \"middle\" section of 
the block."
                          (cl-third fence-spec)
                          (list middle-begin close-begin))
       ;; If the block is a YAML block, propertize the declarations inside
-      (markdown-syntax-propertize-yaml-metadata middle-begin close-begin)
+      (when (< middle-begin close-begin) ;; workaround #634
+        (markdown-syntax-propertize-yaml-metadata middle-begin close-begin))
       ;; Propertize closing line of fenced block.
       (put-text-property close-begin close-end
                          (cl-cadadr fence-spec) close-data))))
diff --git a/tests/markdown-test.el b/tests/markdown-test.el
index 41eb2e5..7a4018b 100644
--- a/tests/markdown-test.el
+++ b/tests/markdown-test.el
@@ -6312,12 +6312,21 @@ Details: 
https://github.com/jrblevin/markdown-mode/issues/534";
                            (append markdown-gfm-additional-languages
                                    markdown-gfm-recognized-languages))))))))
 
+(ert-deftest test-markdown-gfm/insert-code-block-at-end-of-buffer ()
+  "Insert GFM code block at end of buffer.
+Details: https://github.com/jrblevin/markdown-mode/issues/634";
+  (markdown-test-string-gfm ""
+    (goto-char (point-max))
+    (execute-kbd-macro (read-kbd-macro "C-c C-s C RET"))
+    ;; don't raise exception
+    (should t)))
+
 (ert-deftest test-markdown-gfm/code-block-font-lock ()
   "GFM code block font lock test."
   (markdown-test-file-gfm "gfm.text"
     (markdown-test-range-has-face 2639 2641 'markdown-markup-face) ; ```
     (markdown-test-range-has-face 2642 2645 'markdown-language-keyword-face) ; 
lang
-    (markdown-test-range-has-face 2647 2728 'markdown-pre-face) ; code
+    (markdown-test-range-has-face 2647 2728 'markdown-pre-face)      ; code
     (markdown-test-range-has-face 2730 2732 'markdown-markup-face))) ; ```
 
 (ert-deftest test-markdown-gfm/code-block-font-lock-2 ()



reply via email to

[Prev in Thread] Current Thread [Next in Thread]