forked from haskell/haskell-mode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhaskell-yas.el
76 lines (54 loc) · 2.29 KB
/
haskell-yas.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
;;; haskell-yas.el --- Customization support for Luke Hoersten's yasnippets
;; Copyright (C) 2013 John Wiegley, Luke Hoersten
;; Author: John Wiegley <johnw@newartisans.com>
;; Luke Hoersten <Luke@Hoersten.org>
;; Keywords: faces files Haskell
;; This file is not part of GNU Emacs.
;; This file 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, or (at your option)
;; any later version.
;; This file 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:
;; Provides customization variables for Luke Hoersten's yasnippet collection
;; to depend on.
;;; Code:
(eval-when-compile
(require 'yasnippet nil t))
(defgroup haskell-yas nil
"Customizations for Luke Hoersten's yasnippet collection for haskell-mode."
:group 'haskell
:prefix "haskell-yas-")
(defcustom haskell-yas-ghc-language-pragmas
(split-string (shell-command-to-string "ghc --supported-extensions"))
"List of language pragmas supported by the installed version of GHC."
:group 'haskell-yas
:type '(repeat string))
(defcustom haskell-yas-completing-function 'ido-completing-read
"Function to use for completing among alternatives."
:group 'haskell-yas
:type 'function)
;;;###autoload
(defun haskell-yas-complete (&rest args)
(apply haskell-yas-completing-function args))
(defconst haskell-snippets-dir
(expand-file-name "snippets" (file-name-directory load-file-name)))
(defvar yas-snippet-dirs)
(declare-function yas-load-directory "ext:yasnippet"
(top-level-dir &optional use-jit interactive))
;;;###autoload
(defun haskell-snippets-initialize ()
"Register haskell snippets with yasnippet."
(add-to-list 'yas-snippet-dirs haskell-snippets-dir t)
(yas-load-directory haskell-snippets-dir))
;;;###autoload
(eval-after-load 'yasnippet
'(haskell-snippets-initialize))
;; Provide ourselves:
(provide 'haskell-yas)
;;; haskell-yas.el ends here