-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathidee.el
90 lines (63 loc) · 3.68 KB
/
idee.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
;;; idee.el --- A unified way to perform IDEE/like tasks across mutiple languages and frameworks.
;; Copyright (C) 2018 Ioannis Canellos
;; Licensed under the Apache License, Version 2.0 (the "License");
;; you may not use this file except in compliance with the License.
;; You may obtain a copy of the License at
;; http://www.apache.org/licenses/LICENSE-2.0
;;Unless required by applicable law or agreed to in writing, software
;;distributed under the License is distributed on an "AS IS" BASIS,
;;WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
;;See the License for the specific language governing permissions and
;;limitations under the License.
;; Author: Ioannis Canellos
;; Version: 0.0.1
;; Package-Requires: ((emacs "25.1") (projectile "2.0.0") (helm-projectile "0.14.0") (swiper "0.13.0") (helm-ag "0.58") (treemacs "2.6") (yasnippet "0.13.0") (hydra "0.15.0") (magit "2.90.1") (company "0.9.10" ) (lsp-mode "6.2") (lsp-ui "6.0") (dap-mode "0.3"))
;;; Commentary:
;;; Code:
(require 'idee-utils)
(require 'idee-vars)
(defcustom idee/repo-url "[email protected]:iocanel/idee.git" "The repository url of the ide project." :group 'ide :type 'string)
(defvar idee/initialized nil)
(defun idee/resources-install ()
"Initialize ide resources."
(interactive)
(idee/git-checkout idee/repo-url idee/resources-dir '("headers" "templates" "snippets")))
;;;###autoload
(defun idee/init ()
"Initialize idee."
(interactive)
(idee/only-once idee/initialized
(idee/when-idle
;; Initialize Project
(add-hook 'projectile-after-switch-project-hook 'idee/project-initialize)
;; Intialize templates
(add-hook 'projectile-after-switch-project-hook 'idee/template-load-from-project)
(add-to-list 'warning-suppress-types '(yasnippet backquote-change))
(when (not (file-exists-p idee/resources-dir)) (mkdir idee/resources-dir t))
;; Copy and compile templates if not there
(when (not (file-exists-p idee/emacs-templates-dir))
(copy-directory (idee/template-source-dir) idee/emacs-templates-dir)
(yas-compile-directory idee/emacs-templates-dir))
(yas-load-directory idee/emacs-templates-dir)
;; Copy and compile snippets if not there
(when (not (file-exists-p idee/emacs-snippets-dir))
(copy-directory (idee/snippet-source-dir) idee/emacs-snippets-dir)
(yas-compile-directory idee/emacs-snippets-dir))
(yas-load-directory idee/emacs-snippets-dir)
(when (not (file-exists-p idee/emacs-headers-dir)) (copy-directory (idee/header-source-dir) idee/emacs-headers-dir))
(add-to-list 'yas-snippet-dirs idee/emacs-templates-dir)
(add-to-list 'yas-snippet-dirs idee/emacs-snippets-dir)
;; Intialize visitors
(add-to-list 'projectile-after-switch-project-hook 'idee/apply-visitor)
;; Initialize Headers
(advice-add 'projectile-switch-project :after 'idee/header-detect)
;; Initialize vterm
(setq idee/function-alist (delq (assoc 'idee/shell-command-execute-in-project-function idee/function-alist) idee/function-alist))
(setq idee/function-alist (delq (assoc 'idee/shell-visible-window-function idee/function-alist) idee/function-alist))
(setq idee/function-alist (delq (assoc 'idee/shell-open-in-project-function idee/function-alist) idee/function-alist))
;; Register vterm functions
(add-to-list 'idee/function-alist '(idee/shell-command-execute-in-project-function . idee/vterm-command-execute-in-project))
(add-to-list 'idee/function-alist '(idee/shell-visible-window-function . idee/vterm-visible-window))
(add-to-list 'idee/function-alist '(idee/shell-open-in-project-function . idee/vterm-open-in-project)))))
(provide 'idee)
;;; idee.el ends here