-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.el
315 lines (272 loc) · 10.2 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
;; Customizations to eMacs.
;; Added by Package.el.
;; This must come before configurations of installed packages.
(package-initialize)
(add-to-list 'load-path "~/.emacs.d/elisp/")
;;;;;;;;;;;;;; Tweaks ;;;;;;;;;;;;;;;;;;;;
(add-to-list 'load-path "~/.emacs.d/tweaks/")
;;--------------------------------------------------
;; Personalization
;;--------------------------------------------------
(setq user-full-name "David Fisher Yun"
user-mail-address "[email protected]"
)
;;--------------------------------------------------
;; Segregate Windows & MacOS Settings
;; Windows:
;; - Use Cygwin as default shell
;;
;;--------------------------------------------------
(load-file (expand-file-name
(cond ((eq system-type 'windows-nt) "windows.el")
((eq system-type 'gnu/linux) "linux.el")
((eq system-type 'darwin) "macos.el")
(t "default-system.el"))
"~/.emacs.d/elisp/tweaks"))
;; MacOS Specific Tweeks
(if (eq system-type 'darwin)
(load "~/.emacs.d/elisp/tweaks/ctrl_meta_change")
)
;;--------------------------------------------------
;; Initial Use-Package Install (if required)
;;--------------------------------------------------
(require 'package)
(package-initialize)
(setq package-enable-at-startup nil)
(setq package-archives
'(("melpa-stable" . "https://stable.melpa.org/packages/")
("melpa" . "http://melpa.org/packages/")
("marmalade" . "http://marmalade-repo.org/packages/")
("org" . "http://orgmode.org/elpa/")
("gnu" . "http://elpa.gnu.org/packages/")))
;; Bootstrap `use-package'
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
;;--------------------------------------------------
;;----------------------------------------------------------
;; HackerNews
;;----------------------------------------------------------
(use-package hackernews
:ensure t
)
;;----------------------------------------------------------
;; Exec-Path-From-Shell
;; Resolves issues where OSX and Emacs Paths work together
;;----------------------------------------------------------
(use-package exec-path-from-shell
:ensure t
:if (memq window-system '(mac ns x))
:config
(setq exec-path-from-shell-variables '("PATH" "GOPATH"))
(exec-path-from-shell-initialize))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Python
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;----------------------------------------------------------
;; Jedi (Python Auto-Complete)
;;----------------------------------------------------------
(use-package jedi
:init
(progn
(setq jedi:complete-on-dot t)
(setq jedi:setup-keys t)
(add-hook 'python-mode-hook 'anaconda-mode)
(add-hook 'python-mode-hook 'anaconda-eldoc-mode)
(add-hook 'python-mode-hook 'jedi:setup))
:ensure t)
;;----------------------------------------------------------
;; Elpy
;;----------------------------------------------------------
(use-package elpy
:ensure t
:pin melpa-stable
:init (add-hook 'python-mode-hook #'elpy-enable)
:config
;; Start Elpy in Python mode
(add-hook 'python-mode-hook 'elpy-mode)
(add-hook 'python-mode-hook 'elpy-use-ipython)
(setq elpy-rpc-backend "jedi")
)
;;---------------------------------------------------------
;; Commpany Mode
;;----------------------------------------------------------
(use-package company
:ensure t
:diminish company-mode
:defer 2
:bind ("C-<tab>" . company-complete)
:config
(global-company-mode t)
)
;;----------------------------------------------------------
;; Org-Mode
;;----------------------------------------------------------
(use-package markdown-mode
:ensure t
:commands (markdown-mode gfm-mode)
:mode (("README\\.md\\'" . gfm-mode)
("\\.md\\'" . markdown-mode)
("\\.markdown\\'" . markdown-mode))
:init (setq markdown-command "multimarkdown"))
(use-package org
:mode (("\\.org$" . org-mode))
:ensure t
:config
(progn
;; config stuff
(define-key global-map "\C-cl" 'org-store-link)
(define-key global-map "\C-ca" 'org-agenda)
(setq org-log-done t)
(setq org-todo-keywords
'((sequence "TODO" "IN-PROGRESS" "WAITING" "DONE")))
(eval-after-load "or"
'(require 'ox-md nil t))
))
;(require 'org)
;;--------------------------------------------------
;; MobileOrg Configuration
;;--------------------------------------------------
(if (eq system-type 'windows-nt)
;; Set to the location of your Org files on your local system
(setq org-directory "D:\\Users\\David\\Dropbox (Personal)\\org")
;; Set to the name of the file where new notes will be stored
(setq org-mobile-inbox-for-pull "D:\\Users\\David\\Dropbox (Personal)\\org\\draftsFromPhone.org")
;; Set to <your Dropbox root directory>/MobileOrg.
(setq org-mobile-directory "~/Dropbox/Apps/MobileOrg")
)
;;--------------------------------------------------
(if (eq system-type 'darwin)
;; Set to the location of your Org files on your local system
(setq org-directory "~/Dropbox/org")
;; Set to the name of the file where new notes will be stored
(setq org-mobile-inbox-for-pull "~/Dropbox/org/draftsFromPhone.org")
;; Set to <your Dropbox root directory>/MobileOrg.
(setq org-mobile-directory "~/Dropbox/Apps/MobileOrg")
)
;;----------------------------------------------------------
;; Emacs Speaks Statistics (ESS)
;;----------------------------------------------------------
(use-package ess-site
:ensure ess
:defer 3
:init (setq ess-use-auto-complete 'script-only)
:init (require 'ess-site)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;; Exec Path From Shell ;;;;;;;;;;;;;;;
;; A GNU Emacs library to ensure environment variables inside Emacs look the same as in the user's shell.
;; Ever find that a command works in your shell, but not in Emacs?
;; This happens a lot on OS X, where an Emacs instance started from the GUI inherits a default set of environment variables.
(when (memq window-system '(mac ns))
(exec-path-from-shell-initialize))
;;;;;;;;; Load Library/Package Specific Behavior;;;;;;;;;;;;
(load "~/.emacs.d/elisp/language_specific_mods/python.el")
;; Python
(if (eq system-type 'darwin)
(setq python-shell-interpreter "/Users/david/anaconda3/bin/python")
)
;; Scala
;; - Note: ENSIME comes from melpa.milkbox.net/packages
(require 'ensime)
(add-hook 'scala-mode-hook 'ensime-scala-mode-hook)
(add-hook 'scala-mode-hook #'yas-minor-mode)
;; Latex
;; Setting environment path to adhere to OSX
(if (eq system-type 'darwin)
(setq exec-path (append exec-path '("/Library/TeX/texbin")))
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;; Environment / Appearance ;;;;;;;;;;;;;;;;;;;;
;; Solarized Theme (FRBNY-MIKE)
(add-to-list 'load-path "~/.emacs.d/elisp/themes/color-theme/")
(add-to-list 'load-path "~/.emacs.d/elisp/themes/solarized-color-theme/")
(require 'color-theme)
(require 'color-theme-solarized)
(color-theme-initialize)
(color-theme-solarized-dark)
;; set transparency
(set-frame-parameter (selected-frame) 'alpha '(93 93))
(add-to-list 'default-frame-alist '(alpha 93 93))
;; Turn on Scroll-bar
(scroll-bar-mode t)
;; Scroll one line at a time
(setq mouse-wheel-scroll-amount '(1 ((shift) . 1)))
;; Turn off Annoying Windows chime
(setq visible-bell 1)
;; Makes *scratch* empty.
(setq initial-scratch-message "")
;; inhibit Splash Screen
(setq inhibit-splash-screen t)
;; Buffer appearance ;;
(transient-mark-mode t)
(show-paren-mode 1)
;; Frame Title
(setq frame-title-format
'(:eval (if (buffer-name)
(abbreviate-file-name (buffer-name))
"%f")))
;; Buffer List in Current Window
(global-set-key "\C-x\C-b" 'buffer-menu)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;; Other Things ;;;;;;;;;;;;;;;;;;;;
;;----------------------------------------------------------
;; Rare but useful instances of things eMacs can do
;;----------------------------------------------------------
;; Byte Compilation in Bulk (of .emacs.d directory)
(defun byte-compile-init-dir ()
"Byte-compile all your dotfiles."
(interactive)
(byte-recompile-directory user-emacs-directory 0))
;; If saving .el file, delete .elc file so that the next
;; byte compilation quasi updates elc file
(defun remove-elc-on-save ()
"If you're saving an elisp file, likely the .elc is no longer valid."
(add-hook 'after-save-hook
(lambda ()
(if (file-exists-p (concat buffer-file-name "c"))
(delete-file (concat buffer-file-name "c"))))
nil
t))
(add-hook 'emacs-lisp-mode-hook 'remove-elc-on-save)
;; Get rid of duplicate lines
(defun uniq-lines (beg end)
"Unique lines in region.
Called from a program, there are two arguments:
BEG and END (region to sort)."
(interactive "r")
(save-excursion
(save-restriction
(narrow-to-region beg end)
(goto-char (point-min))
(while (not (eobp))
(kill-line 1)
(yank)
(let ((next-line (point)))
(while
(re-search-forward
(format "^%s" (regexp-quote (car kill-ring))) nil t)
(replace-match "" nil nil))
(goto-char next-line))))))
(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.
'(org-format-latex-options
(quote
(:foreground default :background default :scale 1.5 :html-foreground "Black" :html-background "Transparent" :html-scale 1.0 :matchers
("begin" "$1" "$" "$$" "\\(" "\\["))))
'(package-selected-packages
(quote
(0blayout jedi-direx rope-read-mode elpy anaconda-mode markdown-mode exec-path-from-shell ein ensime)))
'(show-paren-mode t))
'(python-shell-interpreter "/Users/david/anaconda3/bin/python")
'(show-paren-mode t)
'(text-mode-hook (quote (longlines-mode text-mode-hook-identify)))
(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.
)