branch: elpa/raku-mode
commit 6f3c29a29c6442c9e0e97d5acb560152adfefe87
Author: Hinrik Örn Sigurðsson <[email protected]>
Commit: Hinrik Örn Sigurðsson <[email protected]>
Add back the filename constraint
I accidentally removed it in 6fa383e.
---
perl6-mode.el | 28 +++++++++++++++-------------
1 file changed, 15 insertions(+), 13 deletions(-)
diff --git a/perl6-mode.el b/perl6-mode.el
index 7ff958a322..8385001aee 100644
--- a/perl6-mode.el
+++ b/perl6-mode.el
@@ -67,19 +67,21 @@
(defun perl6-magic-matcher ()
"Return non-nil if the current buffer is probably a Perl 6 file."
- (let ((case-fold-search nil)
- (keep-going t)
- (found-perl6 nil))
- (while keep-going
- (cond ((looking-at "^ *\\(?:#.*\\)?$")
- nil)
- ((looking-at perl6-magic-pattern)
- (setq keep-going nil
- found-perl6 t))
- (t
- (setq keep-going nil)))
- (beginning-of-line 2))
- found-perl6))
+ (and (and (stringp buffer-file-name)
+ (string-match "\\.\\(?:t\\|p[lm]\\)\\'" buffer-file-name))
+ (let ((case-fold-search nil)
+ (keep-going t)
+ (found-perl6 nil))
+ (while keep-going
+ (cond ((looking-at "^ *\\(?:#.*\\)?$")
+ nil)
+ ((looking-at perl6-magic-pattern)
+ (setq keep-going nil
+ found-perl6 t))
+ (t
+ (setq keep-going nil)))
+ (beginning-of-line 2))
+ found-perl6)))
;;;###autoload
(add-to-list 'magic-mode-alist '(perl6-magic-matcher . perl6-mode))