aboutsummaryrefslogtreecommitdiffstats
path: root/oni-nxml
diff options
context:
space:
mode:
authorGravatar Tom Willemse2019-08-27 23:34:58 -0700
committerGravatar Tom Willemse2019-08-27 23:36:08 -0700
commitd5cca9d5795824fd2a2b54e6254a0354735ce500 (patch)
tree9fcf621476351094c8bd7d075b3e23b15d6d84a9 /oni-nxml
parent51a84644e6e0d756a8c917a500d95053cbb27d4a (diff)
downloademacs-config-d5cca9d5795824fd2a2b54e6254a0354735ce500.tar.gz
emacs-config-d5cca9d5795824fd2a2b54e6254a0354735ce500.zip
Add snippets to ‘oni-nxml’
Diffstat (limited to 'oni-nxml')
-rw-r--r--oni-nxml/Cask10
-rw-r--r--oni-nxml/oni-nxml.el59
-rw-r--r--oni-nxml/snippets/nxml-mode/pencil-property7
-rw-r--r--oni-nxml/snippets/nxml-mode/pencil-property-value5
-rw-r--r--oni-nxml/snippets/nxml-mode/pencil-shortcut9
5 files changed, 90 insertions, 0 deletions
diff --git a/oni-nxml/Cask b/oni-nxml/Cask
new file mode 100644
index 0000000..f9ee661
--- /dev/null
+++ b/oni-nxml/Cask
@@ -0,0 +1,10 @@
+(source gnu)
+(source melpa)
+
+(package-file "./oni-nxml.el")
+
+(depends-on "oni-yasnippet" :git "../" :files ("oni-yasnippet.el"))
+
+(files
+ "*.el"
+ ("snippets" "./snippets/*"))
diff --git a/oni-nxml/oni-nxml.el b/oni-nxml/oni-nxml.el
new file mode 100644
index 0000000..2ca4977
--- /dev/null
+++ b/oni-nxml/oni-nxml.el
@@ -0,0 +1,59 @@
+;;; oni-nxml.el --- NXML configuration -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2019 Tom Willemse
+
+;; Author: Tom Willemse <tom@ryuslash.org>
+;; Keywords: local
+;; Version: 20190827233218
+;; Package-Requires: (oni-yasnippet)
+
+;; 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:
+
+;; NXML configuration
+
+;;; Code:
+
+(require 'yasnippet)
+
+(defconst oni-nxml-root
+ (file-name-directory
+ (or load-file-name
+ (buffer-file-name)))
+ "The directory where ‘oni-nxml’ was loaded from.")
+
+(defconst oni-nxml-snippets-dir
+ (expand-file-name "snippets" oni-nxml-root)
+ "The directory where ‘oni-nxml’ stores its snippets.")
+
+;;;###autoload
+(defun oni-nxml-snippets-initialize ()
+ "Initialize the snippets for ‘oni-nxml’."
+ (when (boundp 'yas-snippet-dirs)
+ (add-to-list 'yas-snippet-dirs oni-nxml-snippets-dir t))
+ (yas-load-directory oni-nxml-snippets-dir))
+
+;;;###autoload
+(add-to-list 'auto-mode-alist '("\\.targets\\'" . nxml-mode))
+;;;###autoload
+(add-to-list 'auto-mode-alist '("\\.proj\\'" . nxml-mode))
+
+;;;###autoload
+(with-eval-after-load 'nxml-mode
+ (with-eval-after-load 'yasnippet
+ (oni-nxml-snippets-initialize)))
+
+(provide 'oni-nxml)
+;;; oni-nxml.el ends here
diff --git a/oni-nxml/snippets/nxml-mode/pencil-property b/oni-nxml/snippets/nxml-mode/pencil-property
new file mode 100644
index 0000000..7fafcb8
--- /dev/null
+++ b/oni-nxml/snippets/nxml-mode/pencil-property
@@ -0,0 +1,7 @@
+# -*- mode: snippet; require-final-newline: nil -*-
+# name: PencilProperty
+# key: p
+# --
+<Property name="$1"
+ displayName="$2"
+ type="$3">$4</Property> \ No newline at end of file
diff --git a/oni-nxml/snippets/nxml-mode/pencil-property-value b/oni-nxml/snippets/nxml-mode/pencil-property-value
new file mode 100644
index 0000000..5da3d10
--- /dev/null
+++ b/oni-nxml/snippets/nxml-mode/pencil-property-value
@@ -0,0 +1,5 @@
+# -*- mode: snippet; require-final-newline: nil -*-
+# name: PropertyValue
+# key: pv
+# --
+<PropertyValue name="$1">$2</PropertyValue> \ No newline at end of file
diff --git a/oni-nxml/snippets/nxml-mode/pencil-shortcut b/oni-nxml/snippets/nxml-mode/pencil-shortcut
new file mode 100644
index 0000000..e760d27
--- /dev/null
+++ b/oni-nxml/snippets/nxml-mode/pencil-shortcut
@@ -0,0 +1,9 @@
+# -*- mode: snippet; require-final-newline: nil -*-
+# name: Shortcut
+# key: s
+# --
+<Shortcut displayName="$1"
+ icon="$2"
+ to="$3">
+ $0
+</Shortcut> \ No newline at end of file