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’ --- .gitlab-ci.yml | 11 +++++ GNUmakefile | 16 +++++- oni-nxml.el | 34 ------------- 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 ++++ 8 files changed, 116 insertions(+), 35 deletions(-) delete mode 100644 oni-nxml.el 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 diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 721e20a..359339f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -56,6 +56,16 @@ package-oni-html: paths: - oni-html/dist/ +package-oni-nxml: + stage: pre-package-multifile + before_script: + - rm -rf oni-elisp/dist + script: + - cask --path oni-nxml package + artifacts: + paths: + - oni-nxml/dist/ + test-oni-alert: stage: test script: make test-oni-alert @@ -105,6 +115,7 @@ package: - package-oni-elisp - package-oni-haml - package-oni-html + - package-oni-nxml before_script: - rm -rf bin/ - mkdir bin/ diff --git a/GNUmakefile b/GNUmakefile index 82bb3f6..e58648c 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -3,7 +3,7 @@ FILES := $(wildcard *.el) PACKAGE_TARGETS := $(addprefix package-,$(FILES)) package: $(PACKAGE_TARGETS) package-oni-conf package-oni-css package-oni-elisp \ - package-oni-haml package-oni-html + package-oni-haml package-oni-html package-oni-nxml package-%: % emacs --batch \ @@ -41,6 +41,12 @@ package-oni-html: --funcall package-initialize \ --eval "(package-upload-file (car (sort (file-expand-wildcards \"oni-html/dist/*.tar\") #'string>)))" +package-oni-nxml: + emacs --batch \ + --load oni-package.el \ + --funcall package-initialize \ + --eval "(package-upload-file (car (sort (file-expand-wildcards \"oni-nxml/dist/*.tar\") #'string>)))" + install-%: emacs --batch \ --load oni-package.el \ @@ -89,6 +95,14 @@ install-oni-html: $(foreach DEP,$(DEPS),--eval "(package-install-file \"$(DEP).el\")") \ --eval "(package-install-file (car (sort (file-expand-wildcards \"oni-html/dist/*.tar\") #'string>)))" +install-oni-nxml: + emacs --batch \ + --load oni-package.el \ + --fluncall package-initialize \ + --eval '(package-refresh-contents)' \ + $(foreach DEP,$(DEPS),--eval "(package-install-file \"$(DEP).el\")") \ + --eval "(package-install-file (car (sort (file-expand-wildcards \"oni-nxml/dist/*.tar\") #'string>)))" + test-%: install-% emacs --batch \ --load oni-package.el \ diff --git a/oni-nxml.el b/oni-nxml.el deleted file mode 100644 index 5f8611f..0000000 --- a/oni-nxml.el +++ /dev/null @@ -1,34 +0,0 @@ -;;; oni-nxml.el --- NXML configuration -*- lexical-binding: t; -*- - -;; Copyright (C) 2019 Tom Willemse - -;; Author: Tom Willemse -;; Keywords: local -;; Version: 20190306231832 - -;; 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: - -;;;###autoload -(add-to-list 'auto-mode-alist '("\\.targets\\'" . nxml-mode)) -;;;###autoload -(add-to-list 'auto-mode-alist '("\\.proj\\'" . nxml-mode)) - -(provide 'oni-nxml) -;;; oni-nxml.el ends here 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.3-2-g0d8e