-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathemacs-mac.el
74 lines (64 loc) · 2.01 KB
/
emacs-mac.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
;; install wanted packages.
;; TODO: why error has occurred...
;; (let ((wanted '(exec-path-from-shell)))
;; (dolist (package wanted)
;; (unless (require package nil t)
;; (package-install package))))
;; (unless (locate-library "exec-path-from-shell")
;; (package-install 'exec-path-from-shell))
;;; korean key input.
(setq default-input-method "korean-hangul")
(define-key global-map (kbd "S-SPC") 'toggle-input-method)
;;; HOME, END.
(define-key global-map (kbd "<home>") 'beginning-of-line)
(define-key global-map (kbd "<end>") 'end-of-line)
;;; use Option key for Meta on terminal
(unless window-system
(setq mac-option-modifier 'meta))
;;; .
(when window-system
;; (set-frame-font "monaco-15")
(add-to-list 'default-frame-alist
;; '(font . "DejaVu Sans Mono-15")))
'(font . "monaco-15")))
;; get env from .bash_profile
;; https://github.com/purcell/exec-path-from-shell
;; (when (locate-library "exec-path-from-shell")
(when (load "~/.emacs_robin/exec-path-from-shell.el")
(exec-path-from-shell-initialize)
(exec-path-from-shell-copy-env "GOPATH"))
;; for LANG setting
(set-locale-environment "ko_KR.UTF-8")
;;; mdfind is spotlight command
(setq locate-command "mdfind")
;;;; shell on macosx
;; https://www.emacswiki.org/emacs/MacOSTweaks#toc22
(defun mac-launch-terminal ()
(interactive)
(let ((dir ""))
(cond
((and (local-variable-p 'dired-directory) dired-directory)
(setq dir dired-directory))
((stringp (buffer-file-name))
(setq dir (file-name-directory (buffer-file-name))))
((stringp default-directory)
(setq dir default-directory))
)
(do-applescript
(format "
tell application \"Terminal\"
activate
try
do script with command \"cd %s\"
on error
beep
end try
end tell" dir))
))
;; launch finder
(defun mac-launch-finder ()
(interactive)
(start-process "finder" nil "open" "."))
;;;; shortcut
(global-set-key [(f5)] 'mac-launch-terminal)
(global-set-key [(M-f5)] 'mac-launch-finder)