-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall_emacs.py
executable file
·51 lines (43 loc) · 1.62 KB
/
install_emacs.py
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
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
from install_lib import *
def install_emacs():
environ = get_environ()
replace_file_content(
os.path.join(environ["HOME"], ".emacs_var"),
""";; -*- mode:emacs-lisp -*-
(load-file (expand-file-name "~/init_bin/konix_import_env.el"))
(defvar python-bin (getenv "PYTHON_BIN"))
(konix/load-env-file)
(defvar perso-dir (getenv "KONIX_PERSO_DIR"))
(defvar perso-dirs (getenv "KONIX_PERSO_DIRS"))
(defvar config-dir (getenv "KONIX_CONFIG_DIR") "where I put my config files")
(defvar elfiles (expand-file-name "elfiles" (getenv "KONIX_DEVEL_DIR")) "where I put my emacs files")
(defvar emacs-config-dir (expand-file-name "config" elfiles) "where I put my emacs custom config files")
(defvar devel-dir (getenv "KONIX_DEVEL_DIR") "Where I pu my devel files (the installation path)")
(setq custom-file (getenv "KONIX_EMACS_CUSTOM_FILE"))
""")
if not os.path.exists(environ["KONIX_EMACS_CUSTOM_FILE"]):
shutil.copyfile("./config/emacs-custom.el",
environ["KONIX_EMACS_CUSTOM_FILE"])
replace_file_content(
os.path.join(environ["HOME"], ".emacs"), """
(setq debug-on-quit t)
(setq emacs_com_file (getenv "EMACS_START_COM"))
(load-file "%(HOME)s/.emacs_var")
(load-file "%(KONIX_CONFIG_DIR)s/emacs.el")
;; On finit par loader les customs
(if custom-file
(load custom-file)
(display-warning 'No-custom "No custom file found")
)
(when emacs_com_file
(with-temp-buffer
(insert "ended\n")
(write-file emacs_com_file)
)
)
""" % environ)
print("Successfully installed emacs config")
if __name__ == "__main__":
install_emacs()