[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/raku-mode e0639c89a3 230/253: Merge pull request #35 from
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/raku-mode e0639c89a3 230/253: Merge pull request #35 from tmtvl/24-highlight-pod-the-same-as-comments |
Date: |
Sat, 29 Jan 2022 08:29:01 -0500 (EST) |
branch: elpa/raku-mode
commit e0639c89a3a29e9196e298951da6c3a79fb944e8
Merge: 43fd562825 357a72be71
Author: Tim Van den Langenbergh <tmt_vdl@gmx.com>
Commit: GitHub <noreply@github.com>
Merge pull request #35 from tmtvl/24-highlight-pod-the-same-as-comments
Add comment-style highlighting to POD.
---
raku-font-lock.el | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 50 insertions(+)
diff --git a/raku-font-lock.el b/raku-font-lock.el
index dd10f85ffc..90b60bc048 100644
--- a/raku-font-lock.el
+++ b/raku-font-lock.el
@@ -372,6 +372,53 @@ opening delimiter."
(put-text-property (1- (point)) (point)
'syntax-table (string-to-syntax ">")))))
+(defun raku-syntax-propertize-pod-code-blocks (limit)
+ "Add syntax properties to code blocks in POD."
+ (while (search-forward "=begin code" limit t)
+ (let ((code-beg (point))
+ (code-end (- (search-forward "=end code" limit t)
+ (length "=end code"))))
+ (put-text-property code-beg (1+ code-beg)
+ 'syntax-table (string-to-syntax ">"))
+ (put-text-property (1- code-end) code-end
+ 'syntax-table (string-to-syntax "<"))
+ (remove-text-properties code-beg code-end '(syntax-multiline nil))
+ (raku-syntax-propertize code-beg code-end))))
+
+(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))
+ (raku-syntax-propertize code-beg (point))))))
+
+(defun raku-syntax-propertize-pod (limit)
+ "Add syntax properties to POD."
+ (let ((pod-beg (- (point) (length "=begin pod")))
+ (pod-end (search-forward "=end pod" limit t)))
+ (save-excursion
+ (put-text-property (1- pod-beg) pod-beg
+ 'syntax-table (string-to-syntax "<"))
+ (put-text-property pod-end (1+ pod-end)
+ 'syntax-table (string-to-syntax ">"))
+ (put-text-property pod-beg pod-end
+ 'syntax-multiline t)
+ (goto-char pod-beg)
+ (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»).
@@ -431,6 +478,9 @@ Takes arguments START and END which delimit the region to
propertize."
(and identifier (group "::"))))
(1 "_")
(2 "_"))
+ ;; pod
+ ((rx "=begin pod")
+ (0 (ignore (raku-syntax-propertize-pod end))))
;; comments
((rx "#")
(0 (ignore (raku-syntax-propertize-comment end))))
- [nongnu] elpa/raku-mode e53f3d4f94 194/253: Update README, (continued)
- [nongnu] elpa/raku-mode e53f3d4f94 194/253: Update README, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode f3256bb3fd 159/253: add some more test names, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 282dd2c9e1 199/253: detect '.raku' and '.rakumod' extensions, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode afad310b14 198/253: Remove 'paragraph-separate variable, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 3ae6b19b24 235/253: Make keybindings more understandable, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 357a72be71 229/253: Fix syntax highlighting for code blocks in POD., ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 43fd562825 227/253: Merge pull request #36 from matiaslina/dont-highlight-operators-in-variables, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 5f885f4961 177/253: There's no need to install this, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode f6dcbaf9a4 190/253: Add raku exec path to customization group, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 3d43b91d82 209/253: Add syntax highlighting to REPL., ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode e0639c89a3 230/253: Merge pull request #35 from tmtvl/24-highlight-pod-the-same-as-comments,
ELPA Syncer <=
- [nongnu] elpa/raku-mode 4ed7c06294 200/253: also detect '.rakutest' extension, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode b6a5535e27 219/253: Merge pull request #29 from tmtvl/auto-insert-skeletons, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 8a6e17f174 234/253: Merge pull request #41 from anquegi/master, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 6fa383e25f 003/253: More robust magic matching of Perl 6 code, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode ce3ef00b82 026/253: Syntax propertize <quoted words>, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 3cf62b8383 002/253: Only check if .t/.pl/.pm files contain Perl 6 code, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 1b0698744b 015/253: Move Perl 6 detection into perl6-detect.el, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 2f3b6f5eec 039/253: Remvoe superfluous space, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 1a7cb03101 050/253: Slight change in wording, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 4b8f5150d6 063/253: Break line in two, ELPA Syncer, 2022/01/29