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

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

[nongnu] elpa/raku-mode 0cf896d274 228/253: Uncomment pod lines starting


From: ELPA Syncer
Subject: [nongnu] elpa/raku-mode 0cf896d274 228/253: Uncomment pod lines starting with whitespace.
Date: Sat, 29 Jan 2022 08:29:01 -0500 (EST)

branch: elpa/raku-mode
commit 0cf896d274f6222b5344e54cc9549b670a4811ae
Author: Tim Van den Langenbergh <tmt_vdl@gmx.com>
Commit: Tim Van den Langenbergh <tmt_vdl@gmx.com>

    Uncomment pod lines starting with whitespace.
    
    Unless they start with a pod tag.
---
 raku-font-lock.el | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/raku-font-lock.el b/raku-font-lock.el
index 880fb30701..6a5e95d0ef 100644
--- a/raku-font-lock.el
+++ b/raku-font-lock.el
@@ -384,6 +384,23 @@ opening delimiter."
                          'syntax-table (string-to-syntax "<"))
       (remove-text-properties code-beg code-end '(syntax-multiline nil)))))
 
+(defun raku-syntax-propertize-pod-inline-code (limit)
+  "Add syntax properties to inline code blocks in POD."
+  (while (and
+          (re-search-forward "^\s*\n\s+[^\s]" limit t))
+    (backward-char)
+    (unless (looking-at 
"=\(begin\|end\|head\|for\|para\|item\|defn\|comment\)")
+      (let ((code-beg (1- (point))))
+        (re-search-forward "^[^\s]" limit t)
+        (when (looking-back "^[^\s]" code-beg)
+          (forward-line -1)
+          (end-of-line))
+        (put-text-property (1- code-beg) code-beg
+                           'syntax-table (string-to-syntax ">"))
+        (put-text-property (point) (1+ (point))
+                           'syntax-table (string-to-syntax "<"))
+        (remove-text-properties code-beg (point) '(syntax-multiline nil))))))
+
 (defun raku-syntax-propertize-pod (limit)
   "Add syntax properties to POD."
   (let ((pod-beg (- (point) (length "=begin pod")))
@@ -396,7 +413,9 @@ opening delimiter."
       (put-text-property pod-beg pod-end
                          'syntax-multiline t)
       (goto-char pod-beg)
-      (raku-syntax-propertize-pod-code-blocks pod-end))))
+      (raku-syntax-propertize-pod-code-blocks pod-end)
+      (goto-char pod-beg)
+      (raku-syntax-propertize-pod-inline-code pod-end))))
 
 (defun raku-syntax-propertize-angles (open-angles)
   "Add syntax properties to angle-bracketed quotes (e.g. <foo> and «bar»).



reply via email to

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