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

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

[nongnu] elpa/markdown-mode a18ba97 2/2: Merge pull request #664 from jr


From: ELPA Syncer
Subject: [nongnu] elpa/markdown-mode a18ba97 2/2: Merge pull request #664 from jrblevin/issue-663
Date: Sun, 17 Oct 2021 07:57:47 -0400 (EDT)

branch: elpa/markdown-mode
commit a18ba9731412fecafd1849fa1fdf0de5ea2f36ce
Merge: 862ae8a 0032d6f
Author: Shohei YOSHIDA <syohex@gmail.com>
Commit: GitHub <noreply@github.com>

    Merge pull request #664 from jrblevin/issue-663
    
    Check both beginning/end of code block are valid
---
 CHANGES.md       | 2 ++
 markdown-mode.el | 9 +++++----
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index 4cae4f4..427aef5 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -44,6 +44,7 @@
     -   Give `markdown-table-at-point-p-function` a non-nil default.
         Simplify `markdown-table-at-point-p` accordingly.
     -   Auto set `sh-shell` when `markdown-edit-code-block` enter indirect 
buffer with `sh-mode`
+    -   Add value check and avoid raising the exception at 
`markdown-edit-code-block` [GH-663][]
 
 *   Bug fixes:
     -   Fix issue with `nil` being returned from 
`markdown-imenu-create-nested-index` [GH-578][]
@@ -115,6 +116,7 @@
   [gh-641]: https://github.com/jrblevin/markdown-mode/issues/641
   [gh-649]: https://github.com/jrblevin/markdown-mode/issues/649
   [gh-652]: https://github.com/jrblevin/markdown-mode/issues/652
+  [gh-663]: https://github.com/jrblevin/markdown-mode/issues/663
 
 # Markdown Mode 2.4
 
diff --git a/markdown-mode.el b/markdown-mode.el
index 9c52cd3..bd4f8d2 100644
--- a/markdown-mode.el
+++ b/markdown-mode.el
@@ -8797,7 +8797,8 @@ at the END of code blocks."
   (goto-char (- beg 1))
   (let ((block-indentation (current-indentation)))
     (when (> block-indentation 0)
-      (indent-rigidly beg end block-indentation))))
+      (indent-rigidly beg end block-indentation)))
+  (font-lock-ensure))
 
 (defun markdown-edit-code-block ()
   "Edit Markdown code block in an indirect buffer."
@@ -8805,8 +8806,8 @@ at the END of code blocks."
   (save-excursion
     (if (fboundp 'edit-indirect-region)
         (let* ((bounds (markdown-get-enclosing-fenced-block-construct))
-               (begin (and bounds (goto-char (nth 0 bounds)) (point-at-bol 2)))
-               (end (and bounds (goto-char (nth 1 bounds)) (point-at-bol 1))))
+               (begin (and bounds (not (null (nth 0 bounds))) (goto-char (nth 
0 bounds)) (point-at-bol 2)))
+               (end (and bounds(not (null (nth 1 bounds)))  (goto-char (nth 1 
bounds)) (point-at-bol 1))))
           (if (and begin end)
               (let* ((indentation (and (goto-char (nth 0 bounds)) 
(current-indentation)))
                      (lang (markdown-code-block-lang))
@@ -8816,7 +8817,7 @@ at the END of code blocks."
                       (lambda (_parent-buffer _beg _end)
                         (funcall mode)))
                      (indirect-buf (edit-indirect-region begin end 
'display-buffer)))
-                  ;; reset `sh-shell' when indirect buffer
+                ;; reset `sh-shell' when indirect buffer
                 (when (and (not (member system-type '(ms-dos windows-nt)))
                            (member mode '(shell-script-mode sh-mode))
                            (member lang (append



reply via email to

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