Actually load the snippets for ‘oni-css’
This commit is contained in:
parent
6902ce5a33
commit
36c65fbe45
1 changed files with 23 additions and 1 deletions
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
;; Author: Tom Willemse <tom@ryuslash.org>
|
;; Author: Tom Willemse <tom@ryuslash.org>
|
||||||
;; Keywords: local
|
;; Keywords: local
|
||||||
;; Version: 20190822234329
|
;; Version: 20190823234829
|
||||||
;; Package-Requires: (oni-company oni-fci hydra rainbow-mode)
|
;; Package-Requires: (oni-company oni-fci hydra rainbow-mode)
|
||||||
|
|
||||||
;; This program is free software; you can redistribute it and/or modify
|
;; This program is free software; you can redistribute it and/or modify
|
||||||
|
@ -29,11 +29,22 @@
|
||||||
(require 'align)
|
(require 'align)
|
||||||
(require 'css-mode)
|
(require 'css-mode)
|
||||||
(require 'hydra)
|
(require 'hydra)
|
||||||
|
(require 'yasnippet)
|
||||||
|
|
||||||
(eval-when-compile
|
(eval-when-compile
|
||||||
(require 'compile)
|
(require 'compile)
|
||||||
(require 'grep))
|
(require 'grep))
|
||||||
|
|
||||||
|
(defconst oni-css-root
|
||||||
|
(file-name-directory
|
||||||
|
(or load-file-name
|
||||||
|
(buffer-file-name)))
|
||||||
|
"The directory where ‘oni-css’ was loaded from.")
|
||||||
|
|
||||||
|
(defconst oni-css-snippets-dir
|
||||||
|
(expand-file-name "snippets" oni-css-root)
|
||||||
|
"The directory where ‘oni-conf’ stores its snippets.")
|
||||||
|
|
||||||
(defun oni-css-property-important-p ()
|
(defun oni-css-property-important-p ()
|
||||||
"Return whether or not the current property is important."
|
"Return whether or not the current property is important."
|
||||||
(save-excursion
|
(save-excursion
|
||||||
|
@ -49,6 +60,12 @@
|
||||||
(when (re-search-backward ";" (line-beginning-position) :noerror)
|
(when (re-search-backward ";" (line-beginning-position) :noerror)
|
||||||
(insert " !important")))))
|
(insert " !important")))))
|
||||||
|
|
||||||
|
(defun oni-css-snippets-initialize ()
|
||||||
|
"Initialize the snippets for ‘oni-css’."
|
||||||
|
(when (boundp 'yas-snippet-dirs)
|
||||||
|
(add-to-list 'yas-snippet-dirs oni-css-snippets-dir t))
|
||||||
|
(yas-load-directory oni-css-snippets-dir))
|
||||||
|
|
||||||
(defun oni-css-remove-important ()
|
(defun oni-css-remove-important ()
|
||||||
"Remove the important flag from the property on the current line."
|
"Remove the important flag from the property on the current line."
|
||||||
(interactive)
|
(interactive)
|
||||||
|
@ -141,6 +158,11 @@
|
||||||
(with-eval-after-load 'grep
|
(with-eval-after-load 'grep
|
||||||
(add-to-list 'grep-files-aliases '("css" . "*.css *.less *.sass *.scss")))
|
(add-to-list 'grep-files-aliases '("css" . "*.css *.less *.sass *.scss")))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(with-eval-after-load 'css-mode
|
||||||
|
(with-eval-after-load 'yasnippet
|
||||||
|
(oni-css-snippets-initialize)))
|
||||||
|
|
||||||
;;;###autoload(with-eval-after-load 'css-mode (require 'oni-css))
|
;;;###autoload(with-eval-after-load 'css-mode (require 'oni-css))
|
||||||
|
|
||||||
(provide 'oni-css)
|
(provide 'oni-css)
|
||||||
|
|
Loading…
Reference in a new issue