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

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

[nongnu] elpa/markdown-mode 8ae552c405 1/2: Don't spell check against pa


From: ELPA Syncer
Subject: [nongnu] elpa/markdown-mode 8ae552c405 1/2: Don't spell check against pandoc references
Date: Thu, 2 Jun 2022 23:58:35 -0400 (EDT)

branch: elpa/markdown-mode
commit 8ae552c405529b19919c05a4620aa8c30fded64a
Author: Shohei YOSHIDA <syohex@gmail.com>
Commit: Shohei YOSHIDA <syohex@gmail.com>

    Don't spell check against pandoc references
---
 CHANGES.md             | 11 +++++++----
 markdown-mode.el       |  8 +++++++-
 tests/markdown-test.el |  4 ++++
 3 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index 5232113e9f..383b394365 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -10,13 +10,16 @@
       whole header line. [GH-705][]
 
 *   Improvements:
-    -   `markdown` passes `buffer-file-name` as a parameter to
-        `markdown-command` when `markdown-command-needs-filename` is
-        `t` and `markdown-command` is a function.
-    -   Support newer version Eldoc ships with Emacs 28.
+    - `markdown` passes `buffer-file-name` as a parameter to
+      `markdown-command` when `markdown-command-needs-filename` is
+      `t` and `markdown-command` is a function.
+    - Support newer version Eldoc ships with Emacs 28.
+    - Don't spell-check against pandoc references. [GH-572][]
 
+  [gh-572]: https://github.com/jrblevin/markdown-mode/issues/572
   [gh-705]: https://github.com/jrblevin/markdown-mode/issues/705
 
+
 # Markdown Mode 2.5
 
 *   **Breaking changes:**
diff --git a/markdown-mode.el b/markdown-mode.el
index edd09a72cf..ed9cfbfa64 100644
--- a/markdown-mode.el
+++ b/markdown-mode.el
@@ -2237,6 +2237,11 @@ Depending on your font, some reasonable choices are:
 
 ;;; Compatibility =============================================================
 
+(defun markdown--pandoc-reference-p ()
+  (let ((bounds (bounds-of-thing-at-point 'word)))
+    (when (and bounds (char-before (car bounds)))
+      (= (char-before (car bounds)) ?@))))
+
 (defun markdown-flyspell-check-word-p ()
   "Return t if `flyspell' should check word just before point.
 Used for `flyspell-generic-check-word-predicate'."
@@ -2252,7 +2257,8 @@ Used for `flyspell-generic-check-word-predicate'."
                                         markdown-markup-face
                                         markdown-plain-url-face
                                         markdown-inline-code-face
-                                        markdown-url-face)))
+                                        markdown-url-face))
+            (markdown--pandoc-reference-p))
         (prog1 nil
           ;; If flyspell overlay is put, then remove it
           (let ((bounds (bounds-of-thing-at-point 'word)))
diff --git a/tests/markdown-test.el b/tests/markdown-test.el
index 49cd5be24a..a21f17be86 100644
--- a/tests/markdown-test.el
+++ b/tests/markdown-test.el
@@ -7055,6 +7055,8 @@ ccc
 eee
 
 <!-- fff -->
+
+@ref9999
 "
     (flyspell-buffer)
     (search-forward "aaa")
@@ -7068,6 +7070,8 @@ eee
     (search-forward "eee")
     (should (markdown-test-flyspell-incorrect-word-p))
     (search-forward "fff") ;; in comment
+    (should-not (markdown-test-flyspell-incorrect-word-p))
+    (search-forward "@ref") ;; pandoc reference
     (should-not (markdown-test-flyspell-incorrect-word-p))))
 
 (ert-deftest test-markdown-flyspell/remove-overlay ()



reply via email to

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