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

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

[nongnu] elpa/yaml-mode 7f41037 087/124: Merge pull request #57 from Kaa


From: ELPA Syncer
Subject: [nongnu] elpa/yaml-mode 7f41037 087/124: Merge pull request #57 from Kaali/master
Date: Sun, 29 Aug 2021 11:36:18 -0400 (EDT)

branch: elpa/yaml-mode
commit 7f4103736178fc6e3a9a9ba3b3d0516986ab8b71
Merge: 28c3403 f991710
Author: Vasilij Schneidermann <mail@vasilij.de>
Commit: GitHub <noreply@github.com>

    Merge pull request #57 from Kaali/master
    
    Support for apostrophe in words
---
 yaml-mode.el | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/yaml-mode.el b/yaml-mode.el
index e257379..00f0c2d 100644
--- a/yaml-mode.el
+++ b/yaml-mode.el
@@ -245,7 +245,8 @@ that key is pressed to begin a block literal."
    "Additional expressions to highlight in YAML mode.")
 
 (defun yaml-mode-syntax-propertize-function (beg end)
-  "Unhighlight foo#bar tokens between BEG and END."
+  "Override buffer's syntax table for special syntactic constructs."
+  ;; Unhighlight foo#bar tokens between BEG and END.
   (save-excursion
     (goto-char beg)
     (while (search-forward "#" end t)
@@ -255,7 +256,20 @@ that key is pressed to begin a block literal."
         (when (and (not (bolp))
                    (not (memq (preceding-char) '(?\s ?\t))))
           (put-text-property (point) (1+ (point))
-                             'syntax-table (string-to-syntax "_")))))))
+                             'syntax-table (string-to-syntax "_"))))))
+
+  ;; If quote is detected as a syntactic string start but appeared
+  ;; after a non-whitespace character, then mark it as syntactic word.
+  (save-excursion
+    (goto-char beg)
+    (while (search-forward "'" end t)
+      (when (nth 8 (syntax-ppss))
+        (save-excursion
+          (forward-char -1)
+          (when (and (not (bolp))
+                     (not (memq (preceding-char) '(?\s ?\t))))
+            (put-text-property (point) (1+ (point))
+                               'syntax-table (string-to-syntax "w"))))))))
 
 (defun yaml-font-lock-block-literals (bound)
   "Find lines within block literals.



reply via email to

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