-
Notifications
You must be signed in to change notification settings - Fork 1
/
magma-snippets.el
48 lines (33 loc) · 1.4 KB
/
magma-snippets.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
;;; magma-snippets.el --- -*- lexical-binding: t; -*-
;; Copyright (C) 2014 Thibaut VERRON
;; Author: Thibaut VERRON <[email protected]>
;; Keywords:
;; 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 <http://www.gnu.org/licenses/>.
;;; Commentary:
;; Yasnippet snippets for magma-mode
;;; Code:
(defun magma-should-expand-snippet ()
(and
(looking-at "$")
(save-excursion
(not (and (backward-word 2)
(looking-at "end"))))))
(defvar magma-snippets-dir (f-join magma-path "snippets")
"Directory containing magma-mode snippets")
(defun magma-snippets-initialize ()
(when (boundp 'yas-snippet-dirs)
(add-to-list 'yas-snippet-dirs magma-snippets-dir t))
(yas-load-directory magma-snippets-dir))
(eval-after-load "yasnippet"
(magma-snippets-initialize))
(provide 'magma-snippets)
;;; magma-snippets.el ends here