1
0
Fork 0

Add snippets to ‘oni-nxml’

This commit is contained in:
Tom Willemse 2019-08-27 23:34:58 -07:00
parent 51a84644e6
commit d5cca9d579
7 changed files with 83 additions and 2 deletions

View file

@ -56,6 +56,16 @@ package-oni-html:
paths: paths:
- oni-html/dist/ - 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: test-oni-alert:
stage: test stage: test
script: make test-oni-alert script: make test-oni-alert
@ -105,6 +115,7 @@ package:
- package-oni-elisp - package-oni-elisp
- package-oni-haml - package-oni-haml
- package-oni-html - package-oni-html
- package-oni-nxml
before_script: before_script:
- rm -rf bin/ - rm -rf bin/
- mkdir bin/ - mkdir bin/

View file

@ -3,7 +3,7 @@ FILES := $(wildcard *.el)
PACKAGE_TARGETS := $(addprefix package-,$(FILES)) PACKAGE_TARGETS := $(addprefix package-,$(FILES))
package: $(PACKAGE_TARGETS) package-oni-conf package-oni-css package-oni-elisp \ 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-%: % package-%: %
emacs --batch \ emacs --batch \
@ -41,6 +41,12 @@ package-oni-html:
--funcall package-initialize \ --funcall package-initialize \
--eval "(package-upload-file (car (sort (file-expand-wildcards \"oni-html/dist/*.tar\") #'string>)))" --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-%: install-%:
emacs --batch \ emacs --batch \
--load oni-package.el \ --load oni-package.el \
@ -89,6 +95,14 @@ install-oni-html:
$(foreach DEP,$(DEPS),--eval "(package-install-file \"$(DEP).el\")") \ $(foreach DEP,$(DEPS),--eval "(package-install-file \"$(DEP).el\")") \
--eval "(package-install-file (car (sort (file-expand-wildcards \"oni-html/dist/*.tar\") #'string>)))" --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-% test-%: install-%
emacs --batch \ emacs --batch \
--load oni-package.el \ --load oni-package.el \

10
oni-nxml/Cask Normal file
View file

@ -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/*"))

View file

@ -4,7 +4,8 @@
;; Author: Tom Willemse <tom@ryuslash.org> ;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local ;; Keywords: local
;; Version: 20190306231832 ;; Version: 20190827233218
;; Package-Requires: (oni-yasnippet)
;; This program is free software; you can redistribute it and/or modify ;; 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 ;; it under the terms of the GNU General Public License as published by
@ -25,10 +26,34 @@
;;; Code: ;;; 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 ;;;###autoload
(add-to-list 'auto-mode-alist '("\\.targets\\'" . nxml-mode)) (add-to-list 'auto-mode-alist '("\\.targets\\'" . nxml-mode))
;;;###autoload ;;;###autoload
(add-to-list 'auto-mode-alist '("\\.proj\\'" . nxml-mode)) (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) (provide 'oni-nxml)
;;; oni-nxml.el ends here ;;; oni-nxml.el ends here

View file

@ -0,0 +1,7 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: PencilProperty
# key: p
# --
<Property name="$1"
displayName="$2"
type="$3">$4</Property>

View file

@ -0,0 +1,5 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: PropertyValue
# key: pv
# --
<PropertyValue name="$1">$2</PropertyValue>

View file

@ -0,0 +1,9 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: Shortcut
# key: s
# --
<Shortcut displayName="$1"
icon="$2"
to="$3">
$0
</Shortcut>