-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathportacle.el
79 lines (66 loc) · 2.42 KB
/
portacle.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
(provide 'portacle)
(require 'cl-lib)
;;; Configure OS and Path handling
(cl-defmacro os-case (&body cases)
`(cond ,@(cl-loop for case in cases collect
(if (eql (car case) t)
`(t ,@(cdr case))
`((eql system-type ',(car case)) ,@(cdr case))))))
(setq portacle-root (replace-regexp-in-string "\\\\" "/" (or (getenv "ROOT") (expand-file-name "~/"))))
(setq portacle-os (os-case (gnu/linux "lin") (darwin "mac") (windows-nt "win")))
(defun portacle-path (path)
(concat portacle-root path))
(defun portacle-os-path (path)
(portacle-path (concat portacle-os "/" path)))
(defun portacle-bin-path (bin)
(portacle-os-path (os-case (windows-nt (concat "bin/" bin ".exe"))
(t (concat "bin/" bin)))))
(defun portacle-app-path (app path)
(portacle-os-path (concat app "/" path)))
(defun add-to-path (&rest things)
(cond ((eql system-type 'windows-nt)
(setenv "PATH" (concat (mapconcat (lambda (a) (replace-regexp-in-string "/" "\\\\" a)) things ";")
";" (getenv "PATH"))))
(t
(setenv "PATH" (concat (mapconcat 'identity things ":")
":" (getenv "PATH")))))
(setq exec-path (append exec-path things)))
;;; Toolkit functions
(defun portacle-fwrite (contents file &optional append)
(write-region contents nil file append))
(defun portacle-fread (file)
(with-temp-buffer
(insert-file-contents file)
(buffer-string)))
;;; Load contribs
(require 'portacle-package)
(require 'portacle-keys)
(require 'portacle-general)
(require 'portacle-config)
(require 'portacle-project)
(require 'portacle-update)
(require 'portacle-neotree)
(require 'portacle-slime)
(require 'portacle-sly)
(require 'portacle-elisp)
(require 'portacle-paredit)
(require 'portacle-company)
(require 'portacle-magit)
(require 'portacle-spell)
(require 'portacle-paste)
(require 'portacle-server)
(require 'portacle-window)
(require 'portacle-cursors)
(require 'portacle-ag)
(require 'portacle-help)
(when (window-system)
(portacle--setup-frame))
(portacle--create-help-buffer)
(load user-init-file t)
(defun portacle--startup ()
"Start Portacle's IDE iff there is a window system."
(when (window-system)
(funcall portacle-ide 'sbcl)
(portacle-scratch-help)))
;; Activate Slime after init
(add-hook 'emacs-startup-hook #'portacle--startup)