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

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

[nongnu] elpa/raku-mode 3cf62b8383 002/253: Only check if .t/.pl/.pm fil


From: ELPA Syncer
Subject: [nongnu] elpa/raku-mode 3cf62b8383 002/253: Only check if .t/.pl/.pm files contain Perl 6 code
Date: Sat, 29 Jan 2022 08:28:34 -0500 (EST)

branch: elpa/raku-mode
commit 3cf62b8383e3a3d77516c70725ad6d49bbf9d0d9
Author: Hinrik Örn Sigurðsson <hinrik.sig@gmail.com>
Commit: Hinrik Örn Sigurðsson <hinrik.sig@gmail.com>

    Only check if .t/.pl/.pm files contain Perl 6 code
    
    Also fixed it to not match "usev6".
---
 perl6-mode.el | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/perl6-mode.el b/perl6-mode.el
index e6c36e8c46..1840e7a451 100644
--- a/perl6-mode.el
+++ b/perl6-mode.el
@@ -58,8 +58,15 @@
 ;;;###autoload
 (add-to-list 'auto-mode-alist '("\\.p[lm]?6\\'" . perl6-mode))
 
+(defvar perl6--content-pattern
+  "^ *\\(?:use +v6\\|\\(?:\\(?:my\\|our\\) 
+\\)?\\(?:module\\|class\\|role\\|grammar\\)\\)")
+
 ;;;###autoload
-(add-to-list 'magic-mode-alist '("^ *\\(?:use *v6\\|\\(?:\\(?:my\\|our\\) 
+\\)?\\(?:module\\|class\\|role\\|grammar\\)\\)" . perl6-mode))
+(add-to-list 'magic-mode-alist '((lambda ()
+                                   (and
+                                     (and (stringp buffer-file-name)
+                                          (string-match 
"\\.\\(?:t\\|p[lm]\\)\\'" buffer-file-name))
+                                     (re-search-forward perl6--content-pattern 
4096 t))) . perl6-mode))
 
 (provide 'perl6-mode)
 



reply via email to

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