-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy path_episteme
executable file
·117 lines (89 loc) · 2.85 KB
/
_episteme
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#!/usr/bin/env bash
RED='\033[0;31m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# use $EMACS or emacs if not set
EMACS="${EMACS:-$(which emacs)}"
# check if user $OSTYPE doesn't start with "darwin"
# if so resolve $EMACS with readlink
if [[ "$OSTYPE" != "darwin"* ]]; then
echo "Resolving emacs..."
EMACS="$(readlink -f $(which $EMACS))"
fi
echo "Found emacs: $EMACS"
themes="default one one-light vibrant acario-dark acario-light city-lights challenger-deep dark+ dracula ephemeral fairy-floss flatwhite gruvbox gruvbox-light henna horizon Iosvkem laserwave material manegarm miramare molokai monokai-classic monokai-pro moonlight nord nord-light nova oceanic-next old-hope opera opera-light outrun-electric palenight plain peacock rouge snazzy solarized-dark solarized-light sourcerer spacegrey tomorrow-day tomorrow-night wilmersdorf zenburn mono-dark mono-light tron"
help="episteme [EPISTEME-OPTS] [EMACS-OPTS]
EPISTEME-OPTS:
-h list usage
-config Episteme config directory (default: $HOME/.config/episteme)
-themes print theme names & exit
-theme NAME use theme called NAME
EMACS-OPTS:
Standard Emacs options"
if [[ " $@[@] " =~ "-h" ]]; then
echo "$help"
exit 0
fi
if [[ " $@[@] " =~ "-themes" ]]; then
echo "Available themes:"
for t in $themes; do
let "i=$RANDOM % 256"
echo -en "\e[38;5;''${i}m$t \e[0m";
done
exit 0
fi
export HOME="${USERPROFILE:-$HOME}"
export HOME="${HOME//\\//}"
themeFlag=""
export theme="laserwave"
configFlag=""
export config="$HOME/.config/episteme/"
useSSH=0
for arg do
shift
if [ ! -z "$themeFlag" ]; then
if [[ ! " $themes[@] " =~ " $arg " ]]; then
printf "''${RED}✗''${YELLOW} '$arg' is not a valid theme.''${NC}\n"
for t in $themes; do
let "i=$RANDOM % 256"
echo -en "\e[38;5;''${i}m$t \e[0m";
done
exit 1
fi
export theme="$arg"
themeFlag=""
continue
fi
if [ ! -z "$configFlag" ]; then
export config="$arg"
configFlag=""
continue
fi
if [ "$arg" = "-theme" ]; then
themeFlag="1"
continue
fi
if [ "$arg" = "-config" ]; then
configFlag="1"
continue
fi
if [ "$arg" = "-ssh" ]; then
useSSH=1
echo "Using SSH for git."
continue
fi
set -- "$@" "$arg"
done
export useSSH
export config=${config//\\//}
echo "Config directory: $config"
"$EMACS" -q \
--debug-init \
--eval "(setq byte-compile-warnings '(cl-functions))" \
--eval "(require 'org)" \
--chdir "$config/support/" \
--eval "(org-babel-tangle-file \"$config/support/support.org\" \"$config/support/support.el\")" \
--eval "(setq user-emacs-directory \"$config\")" \
--eval "(setq user-init-file \"$config/support/support.el\")" \
--load $config/support/support.el \
$@