[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/raku-mode b6a5535e27 219/253: Merge pull request #29 from
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/raku-mode b6a5535e27 219/253: Merge pull request #29 from tmtvl/auto-insert-skeletons |
Date: |
Sat, 29 Jan 2022 08:29:00 -0500 (EST) |
branch: elpa/raku-mode
commit b6a5535e273494d564842db6b519f7ce9f358928
Merge: e4d8b0230a 0968a528bb
Author: Tim Van den Langenbergh <tmt_vdl@gmx.com>
Commit: GitHub <noreply@github.com>
Merge pull request #29 from tmtvl/auto-insert-skeletons
Auto insert skeletons
Thanks for the feedback, @Altai-man and @matiaslina
---
README.md | 32 +++++++++++++++++
raku-skeletons.el | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 133 insertions(+)
diff --git a/README.md b/README.md
index e2e83cd1a9..58aec1cdb1 100644
--- a/README.md
+++ b/README.md
@@ -70,6 +70,38 @@ The REPL will start if needed with this keybindings.
Use <kbd>M-x customize-group RET raku</kbd> to customize Raku Mode.
+## Template skeletons
+
+Included are two skeletons (file templates) that can be auto-inserted with
+auto-insert-mode:
+
+* `raku-script-skeleton`, and
+* `raku-module-skeleton`.
+
+To use them, add them to your auto-insert-alist (`M-x customize-option RET
+auto-insert-alist`) with the conditions of your choice.
+
+To insert them when you create a new file with the `.raku` or `.rakumod`
+extension, use the following matching regular expressions:
+
+* For `raku-script-skeleton`: `\.raku\'`.
+* For `raku-module-skeleton`: `\.rakumod\`.
+
+Alternatively you can add them in your .emacs using `define-auto-insert`:
+
+```Emacs Lisp
+(define-auto-insert
+ '("\\.rakumod\\'" . "Raku module skeleton")
+ 'raku-module-skeleton)
+(define-auto-insert
+ '("\\.raku\\'" . "Raku script skeleton")
+ 'raku-script-skeleton)
+```
+
+The full path to the Raku executable for the shebang, as well as the default
+auth information for a module can be defined in the Raku Skeleton customization
+group, `M-x customize-group RET raku-skeleton`.
+
## Contribute
Pull requests are welcome.
diff --git a/raku-skeletons.el b/raku-skeletons.el
new file mode 100644
index 0000000000..9d4dc744c6
--- /dev/null
+++ b/raku-skeletons.el
@@ -0,0 +1,101 @@
+;;; raku-skeletons.el --- Skeletons for Raku file auto insertion. -*-
lexical-binding: t; -*-
+
+;; Copyright (C) 2020 Tim Van den Langenbergh
+
+;; Author: Tim Van den Langenbergh <tmt_vdl@gmx.com>
+;; URL: https://github.com/raku/raku-mode
+;; Keywords: languages, convenience, files
+;; Version: 0.1
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Some skeletons for auto-insertion in Raku files.
+
+;;; Code:
+(require 'raku-mode)
+
+(defgroup raku-skeletons nil
+ "Skeletons for Raku files."
+ :prefix "raku-skeleton-"
+ :group 'raku)
+
+;; Need the full path for the #!. Simply setting it to `raku' may not be ideal.
+(defcustom full-raku-path "/usr/bin/env raku"
+ "Path to the Raku executable."
+ :type 'string
+ :group 'raku-skeletons)
+
+;; A string for `:auth<auth-id>';
+(defcustom auth-id user-login-name
+ "Module author information."
+ :type 'string
+ :group 'raku-skeletons)
+
+(define-skeleton raku-script-skeleton
+ "Skeleton for Raku scripts."
+ nil
+ "#!" (progn full-raku-path) \n
+ "use v6;" \n
+ \n
+ "sub MAIN () {" \n
+ > _ \n
+ "}" \n)
+
+(defvar module-name "Foo"
+ "Variable for holding a new module name.")
+
+(define-skeleton raku-module-skeleton
+ "Skeleton for Raku modules."
+ nil
+ "use v6;" \n
+ \n
+ "unit module "
+ (let ((given-name (skeleton-read "Module name: " module-name)))
+ (setq module-name given-name)
+ given-name)
+ ":ver<0.0.1>:auth<" (progn auth-id) ">;" \n
+ \n
+ _ \n
+ \n
+ "=begin pod" \n
+ \n
+ "=head1 NAME" \n
+ \n
+ (progn module-name) " - " (skeleton-read "Short description: ") \n
+ \n
+ "=head1 SYNOPSIS" \n
+ \n
+ "\tuse " (progn module-name) ";\n"
+ \n
+ "=head1 DESCRIPTION" \n
+ \n
+ (progn module-name) " is..." \n
+ \n
+ "=head1 AUTHOR" \n
+ \n
+ (progn auth-id) \n
+ \n
+ "=head1 COPYRIGHT AND LICENSE" \n
+ \n
+ "This library is free software; "
+ "you can redistribute it and/or modify it under the Artistic License 2.0."
+ "\n\n"
+ "=end pod" \n)
+
+;; TODO: Maybe META6.json and .t/.rakutest skeletons?
+
+(provide 'raku-skeletons)
+;;; raku-skeletons.el ends here
- [nongnu] elpa/raku-mode 282dd2c9e1 199/253: detect '.raku' and '.rakumod' extensions, (continued)
- [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, 2022/01/29
- [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 <=
- [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
- [nongnu] elpa/raku-mode 44c6e42d56 044/253: Highlight basic punctuation/match variables, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode eb32e01386 045/253: Correctly highilight version literal ranges, ELPA Syncer, 2022/01/29