Add snippets to ‘oni-elisp’
This commit is contained in:
parent
26dbc5eac3
commit
75fe1b4c4f
6 changed files with 107 additions and 6 deletions
|
@ -26,6 +26,16 @@ package-oni-css:
|
||||||
paths:
|
paths:
|
||||||
- oni-css/dist/
|
- oni-css/dist/
|
||||||
|
|
||||||
|
package-oni-elisp:
|
||||||
|
stage: pre-package-multifile
|
||||||
|
before_script:
|
||||||
|
- rm -rf oni-elisp/dist
|
||||||
|
script:
|
||||||
|
- cask --path oni-elisp package
|
||||||
|
artifacts:
|
||||||
|
patchs:
|
||||||
|
- oni-elisp/dist/
|
||||||
|
|
||||||
test-oni-alert:
|
test-oni-alert:
|
||||||
stage: test
|
stage: test
|
||||||
script: make test-oni-alert
|
script: make test-oni-alert
|
||||||
|
@ -48,6 +58,13 @@ test-oni-css:
|
||||||
needs: [package-oni-css]
|
needs: [package-oni-css]
|
||||||
script: make test-oni-css
|
script: make test-oni-css
|
||||||
|
|
||||||
|
test-oni-elisp:
|
||||||
|
stage: test
|
||||||
|
dependencies:
|
||||||
|
- package-oni-elisp
|
||||||
|
needs: [package-oni-elisp]
|
||||||
|
script: make test-oni-elisp
|
||||||
|
|
||||||
test-oni-grep:
|
test-oni-grep:
|
||||||
stage: test
|
stage: test
|
||||||
script: make test-oni-grep
|
script: make test-oni-grep
|
||||||
|
@ -65,6 +82,7 @@ package:
|
||||||
dependencies:
|
dependencies:
|
||||||
- package-oni-conf
|
- package-oni-conf
|
||||||
- package-oni-css
|
- package-oni-css
|
||||||
|
- package-oni-elisp
|
||||||
before_script:
|
before_script:
|
||||||
- rm -rf bin/
|
- rm -rf bin/
|
||||||
- mkdir bin/
|
- mkdir bin/
|
||||||
|
|
24
GNUmakefile
24
GNUmakefile
|
@ -2,7 +2,7 @@ FILES := $(wildcard *.el)
|
||||||
|
|
||||||
PACKAGE_TARGETS := $(addprefix package-,$(FILES))
|
PACKAGE_TARGETS := $(addprefix package-,$(FILES))
|
||||||
|
|
||||||
package: $(PACKAGE_TARGETS) package-oni-conf package-oni-css
|
package: $(PACKAGE_TARGETS) package-oni-conf package-oni-css package-oni-elisp
|
||||||
|
|
||||||
package-%: %
|
package-%: %
|
||||||
emacs --batch \
|
emacs --batch \
|
||||||
|
@ -22,13 +22,19 @@ package-oni-css:
|
||||||
--funcall package-initialize \
|
--funcall package-initialize \
|
||||||
--eval "(package-upload-file (car (sort (file-expand-wildcards \"oni-css/dist/*.tar\") #'string>)))"
|
--eval "(package-upload-file (car (sort (file-expand-wildcards \"oni-css/dist/*.tar\") #'string>)))"
|
||||||
|
|
||||||
|
package-oni-elisp:
|
||||||
|
emacs --batch \
|
||||||
|
--load oni-package.el \
|
||||||
|
--funcall package-initialize \
|
||||||
|
--eval "(package-upload-file (car (sort (file-expand-wildcards \"oni-elisp/dist/*tar\") #'string>)))"
|
||||||
|
|
||||||
install-%:
|
install-%:
|
||||||
emacs --batch \
|
emacs --batch \
|
||||||
--load oni-package.el \
|
--load oni-package.el \
|
||||||
--funcall package-initialize \
|
--funcall package-initialize \
|
||||||
--eval '(package-refresh-contents)' \
|
--eval '(package-refresh-contents)' \
|
||||||
$(foreach DEP,$(DEPS),--eval "(package-install-file \"$(DEP).el\")") \
|
$(foreach DEP,$(DEPS),--eval "(package-install-file \"$(DEP).el\")") \
|
||||||
--eval "(package-install-file \"$*.el\")" \
|
--eval "(package-install-file \"$*.el\")"
|
||||||
|
|
||||||
install-oni-conf:
|
install-oni-conf:
|
||||||
emacs --batch \
|
emacs --batch \
|
||||||
|
@ -36,7 +42,7 @@ install-oni-conf:
|
||||||
--funcall package-initialize \
|
--funcall package-initialize \
|
||||||
--eval '(package-refresh-contents)' \
|
--eval '(package-refresh-contents)' \
|
||||||
$(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-conf/dist/*.tar\") #'string>)))" \
|
--eval "(package-install-file (car (sort (file-expand-wildcards \"oni-conf/dist/*.tar\") #'string>)))"
|
||||||
|
|
||||||
install-oni-css:
|
install-oni-css:
|
||||||
emacs --batch \
|
emacs --batch \
|
||||||
|
@ -44,7 +50,15 @@ install-oni-css:
|
||||||
--funcall package-initialize \
|
--funcall package-initialize \
|
||||||
--eval '(package-refresh-contents)' \
|
--eval '(package-refresh-contents)' \
|
||||||
$(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-css/dist/*.tar\") #'string>)))" \
|
--eval "(package-install-file (car (sort (file-expand-wildcards \"oni-css/dist/*.tar\") #'string>)))"
|
||||||
|
|
||||||
|
install-oni-elisp:
|
||||||
|
emacs --batch \
|
||||||
|
--load oni-package.el \
|
||||||
|
--funcall 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-elisp/dist/*.tar\") #'string>)))"
|
||||||
|
|
||||||
test-%: install-%
|
test-%: install-%
|
||||||
emacs --batch \
|
emacs --batch \
|
||||||
|
@ -59,6 +73,8 @@ test-oni-bookmark: DEPS := oni-data-dir
|
||||||
test-oni-conf: DEPS := oni-yasnippet
|
test-oni-conf: DEPS := oni-yasnippet
|
||||||
test-oni-css: DEPS := oni-company oni-fci
|
test-oni-css: DEPS := oni-company oni-fci
|
||||||
test-oni-php: DEPS := oni-flycheck oni-company oni-fci
|
test-oni-php: DEPS := oni-flycheck oni-company oni-fci
|
||||||
|
test-oni-elisp: DEPS := oni-company oni-flycheck oni-paredit oni-fci \
|
||||||
|
oni-yasnippet
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -fv $(FILES)
|
rm -fv $(FILES)
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
|
|
||||||
;; Author: Tom Willemse <tom@ryuslash.org>
|
;; Author: Tom Willemse <tom@ryuslash.org>
|
||||||
;; Keywords: local
|
;; Keywords: local
|
||||||
;; Version: 20190710075641
|
;; Version: 20190825132536
|
||||||
;; Package-Requires: (oni-company oni-flycheck oni-paredit oni-fci rainbow-delimiters nameless erefactor)
|
;; Package-Requires: (oni-company oni-flycheck oni-paredit oni-fci oni-yasnippet rainbow-delimiters nameless erefactor)
|
||||||
|
|
||||||
;; 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
|
||||||
|
@ -26,11 +26,29 @@
|
||||||
|
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
|
(require 'yasnippet)
|
||||||
|
|
||||||
(let ((byte-compile-not-obsolete-funcs '(preceding-sexp)))
|
(let ((byte-compile-not-obsolete-funcs '(preceding-sexp)))
|
||||||
(require 'erefactor))
|
(require 'erefactor))
|
||||||
|
|
||||||
(require 'ielm)
|
(require 'ielm)
|
||||||
|
|
||||||
|
(defconst oni-elisp-root
|
||||||
|
(file-name-directory
|
||||||
|
(or load-file-name
|
||||||
|
(buffer-file-name)))
|
||||||
|
"The directory where ‘oni-elisp’ was loaded from.")
|
||||||
|
|
||||||
|
(defconst oni-elisp-snippets-dir
|
||||||
|
(expand-file-name "snippets" oni-elisp-root)
|
||||||
|
"The directory where ‘oni-elisp’ stores its snippets.")
|
||||||
|
|
||||||
|
(defun oni-elisp-snippets-initialize ()
|
||||||
|
"Initialize the snippets for ‘oni-elisp’."
|
||||||
|
(when (boundp 'yas-snippet-dirs)
|
||||||
|
(add-to-list 'yas-snippet-dirs oni-elisp-snippets-dir t))
|
||||||
|
(yas-load-directory oni-elisp-snippets-dir))
|
||||||
|
|
||||||
(add-hook 'emacs-lisp-mode-hook 'company-mode)
|
(add-hook 'emacs-lisp-mode-hook 'company-mode)
|
||||||
(add-hook 'emacs-lisp-mode-hook 'electric-quote-local-mode)
|
(add-hook 'emacs-lisp-mode-hook 'electric-quote-local-mode)
|
||||||
(add-hook 'emacs-lisp-mode-hook 'erefactor-lazy-highlight-turn-on)
|
(add-hook 'emacs-lisp-mode-hook 'erefactor-lazy-highlight-turn-on)
|
||||||
|
@ -50,6 +68,11 @@
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(add-to-list 'auto-mode-alist '("/Cask\\'" . emacs-lisp-mode))
|
(add-to-list 'auto-mode-alist '("/Cask\\'" . emacs-lisp-mode))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(with-eval-after-load 'elisp-mode
|
||||||
|
(with-eval-after-load 'yasnippet
|
||||||
|
(oni-elisp-snippets-initialize)))
|
||||||
|
|
||||||
;;;###autoload(with-eval-after-load 'elisp-mode (require 'oni-elisp))
|
;;;###autoload(with-eval-after-load 'elisp-mode (require 'oni-elisp))
|
||||||
;;;###autoload(with-eval-after-load 'ielm (require 'oni-elisp))
|
;;;###autoload(with-eval-after-load 'ielm (require 'oni-elisp))
|
||||||
|
|
5
oni-elisp/snippets/emacs-lisp-mode/depends-on
Normal file
5
oni-elisp/snippets/emacs-lisp-mode/depends-on
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# -*- mode: snippet; require-final-newline: nil -*-
|
||||||
|
# name: depends-on
|
||||||
|
# key: do
|
||||||
|
# --
|
||||||
|
(depends-on "$1")$0
|
5
oni-elisp/snippets/emacs-lisp-mode/face
Normal file
5
oni-elisp/snippets/emacs-lisp-mode/face
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# -*- mode: snippet; require-final-newline: nil -*-
|
||||||
|
# name: face
|
||||||
|
# key: face
|
||||||
|
# --
|
||||||
|
`($1 ((t (${2::foreground} $0))))
|
34
test/oni-elisp-test.el
Normal file
34
test/oni-elisp-test.el
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
;;; oni-elisp-test.el --- Tests for oni-elisp -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
|
;; Copyright (C) 2019 Tom Willemse
|
||||||
|
|
||||||
|
;; Author: Tom Willemse <tom@ryuslash.org>
|
||||||
|
;; Keywords: local
|
||||||
|
|
||||||
|
;; 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:
|
||||||
|
|
||||||
|
;;
|
||||||
|
|
||||||
|
;;; Code:
|
||||||
|
|
||||||
|
(ert-deftest oni-elisp-test-autoloads ()
|
||||||
|
"Test that ‘oni-elisp’ gets loaded automatically."
|
||||||
|
(should (not (featurep 'oni-elisp)))
|
||||||
|
(require 'elisp-mode)
|
||||||
|
(should (featurep 'oni-elisp)))
|
||||||
|
|
||||||
|
(provide 'oni-elisp-test)
|
||||||
|
;;; oni-elisp-test.el ends here
|
Loading…
Reference in a new issue