forked from chrisbarrett/.emacs.d
-
Notifications
You must be signed in to change notification settings - Fork 0
/
paths.el
executable file
·84 lines (59 loc) · 2.24 KB
/
paths.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
;;; paths.el --- Path variables and path management. -*- lexical-binding: t; -*-
;;; Commentary:
;;; Code:
(eval-when-compile
(require 'use-package))
(require 'straight)
(require 'f)
(require 'subr-x)
(require 'seq)
(autoload 'hostname (concat user-emacs-directory "lisp/hostname"))
(defconst paths-assets-directory
(concat user-emacs-directory "assets"))
(defconst paths-cache-directory
(concat user-emacs-directory "var"))
(defconst paths-etc-directory
(concat user-emacs-directory "etc"))
(defconst paths-lisp-directory
(concat user-emacs-directory "lisp"))
(defconst paths-elpa-directory
(concat user-emacs-directory "elpa"))
(defconst paths-config-directory
(concat user-emacs-directory "config"))
(defconst paths-hacks-directory
(concat user-emacs-directory "hacks"))
(defconst paths-themes-directory
(concat user-emacs-directory "themes"))
(defconst paths-site-lisp-directory
(seq-find #'file-directory-p
'("/run/current-system/sw/share/emacs/site-lisp"
"~/.nix-profile/share/emacs/site-lisp")))
(defconst paths-hostfile
(format "~/Sync/personal-config/hostfile-%s.el" (hostname)))
(defconst paths-project-directories
(seq-filter #'file-directory-p '("~/Documents"
"~/Projects"
"~/workspace"
"~/.local/src")))
(defun paths-initialise (&optional interactive-p)
"Add select subdirs of `user-emacs-directory' to the `load-path'.
If argument INTERACTIVE-P is set, log additional information."
(interactive "p")
(let* ((before load-path)
(main-dirs
(list paths-lisp-directory
paths-config-directory
paths-themes-directory
paths-hacks-directory
paths-site-lisp-directory))
(subdirs
(f-directories paths-lisp-directory))
(updated-load-path
(seq-filter #'file-directory-p (seq-uniq (append main-dirs subdirs load-path)))))
(setq load-path updated-load-path)
(when interactive-p
(if-let* ((added (seq-difference load-path before)))
(message "Load path updated. Added: %S" added)
(message "No change to load-path")))))
(provide 'paths)
;;; paths.el ends here