-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.el
122 lines (109 loc) · 4.24 KB
/
init.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
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
118
119
120
121
122
;; Added by Package.el. This must come before configurations of
;; installed packages. Don't delete this line. If you don't want it,
;; just comment it out by adding a semicolon to the start of the line.
;; You may delete these explanatory comments.
(package-initialize)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(current-language-environment "UTF-8")
'(custom-enabled-themes '(zerodark))
'(inhibit-startup-screen t)
'(package-archive-priorities '(("melpa-stable" . 1) ("gnu" . 2)))
'(package-archives
'(("melpa-stable" . "http://stable.melpa.org/packages/")
("melpa" . "http://melpa.org/packages/")
("gnu" . "http://elpa.gnu.org/packages/")))
'(package-enable-at-startup t)
'(package-selected-packages
'(
auctex
ess
forge
magit
markdown-mode
pandoc-mode
use-package
zerodark-theme
)
)
'(show-paren-mode t)
'(tool-bar-style 'image))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
;; auto-install selected packages
(unless package-archive-contents
(package-refresh-contents)
)
(package-install-selected-packages)
;; TeX mode
;(add-hook 'text-mode-hook 'turn-on-auto-fill)
(add-hook 'LaTeX-mode-hook 'flyspell-mode)
(add-hook 'LaTeX-mode-hook 'LaTeX-math-mode)
;; Use 'check-parens' in markdown-mode (2015-09-20)
;; improved 2021-04-26
(use-package markdown-mode
:config (add-hook 'markdown-mode-hook
(lambda ()
(when buffer-file-name
(add-hook 'after-save-hook
'check-parens
nil t))))
)
;; Use markdown-mode for README.md (GitHub Flavored Markdown) (2015-09-20 - fixed 2016-01-23)
;; (add-to-list 'load-path "~/.emacs.d/markdown-mode")
(autoload 'gfm-mode "markdown-mode" "Major mode for editing Markdown files" t)
(setq auto-mode-alist (cons '("\\.md$" . gfm-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.Rmd$" . gfm-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.markdown$" . gfm-mode) auto-mode-alist))
;; Use pandoc-mode for markdown files (2016-08-03)
;; improved 2021-04-26
(use-package pandoc-mode
:ensure t
:config (add-hook 'markdown-mode-hook 'pandoc-mode)
)
;; Magit status (2015-09-22)
;; improved 2021-04-26
(use-package magit
:config (global-set-key (kbd "C-x g") 'magit-status)
)
;; forge (2021-07-13)
(use-package forge
:after magit)
;; ;; gitflow ( 2018-07-28)
;; ;; improved 2021-04-26
;; (use-package magit-gitflow
;; :config (add-hook 'magit-mode-hook 'turn-on-magit-gitflow)
;; )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; C-9 will make emacs frame transparent with this code
(defun djcb-opacity-modify (&optional dec)
"modify the transparency of the emacs frame; if DEC is t,
decrease the transparency, otherwise increase it in 10%-steps"
(let* ((alpha-or-nil (frame-parameter nil 'alpha)) ; nil before setting
(oldalpha (if alpha-or-nil alpha-or-nil 100))
(newalpha (if dec (- oldalpha 10) (+ oldalpha 10))))
(when (and (>= newalpha frame-alpha-lower-limit) (<= newalpha 100))
(modify-frame-parameters nil (list (cons 'alpha newalpha))))))
;; C-8 will increase opacity (== decrease transparency)
;; C-9 will decrease opacity (== increase transparency
;; C-0 will returns the state to normal
(global-set-key (kbd "C-8") '(lambda()(interactive)(djcb-opacity-modify)))
(global-set-key (kbd "C-9") '(lambda()(interactive)(djcb-opacity-modify t)))
(global-set-key (kbd "C-0") '(lambda()(interactive)
(modify-frame-parameters nil `((alpha . 100)))))
;; (setq compilation-window-height 8)
;; (setq compilation-finish-function
;; (lambda (buf str)
;; (if (string-match "exited abnormally" str)
;; ;;there were errors
;; (message "compilation errors, press C-x ` to visit")
;; ;;no errors, make the compilation window go away in 0.5 seconds
;; (run-at-time 0.5 nil 'delete-windows-on buf)
;; (message "NO COMPILATION ERRORS!"))))