From d5cca9d5795824fd2a2b54e6254a0354735ce500 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Tue, 27 Aug 2019 23:34:58 -0700 Subject: Add snippets to ‘oni-nxml’ --- oni-nxml/Cask | 10 ++++ oni-nxml/oni-nxml.el | 59 +++++++++++++++++++++++ oni-nxml/snippets/nxml-mode/pencil-property | 7 +++ oni-nxml/snippets/nxml-mode/pencil-property-value | 5 ++ oni-nxml/snippets/nxml-mode/pencil-shortcut | 9 ++++ 5 files changed, 90 insertions(+) create mode 100644 oni-nxml/Cask create mode 100644 oni-nxml/oni-nxml.el create mode 100644 oni-nxml/snippets/nxml-mode/pencil-property create mode 100644 oni-nxml/snippets/nxml-mode/pencil-property-value create mode 100644 oni-nxml/snippets/nxml-mode/pencil-shortcut (limited to 'oni-nxml') 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 +;; 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 . + +;;; 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 +# -- +$4 \ 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 +# -- +$2 \ 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 +# -- + + $0 + \ No newline at end of file -- cgit v1.2.3-54-g00ecf