-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.el
129 lines (104 loc) · 4.21 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
(setq inhibit-splash-screen t)
(setq load-prefer-newer t)
(require 'cl-lib)
(let ((default-directory (expand-file-name (concat user-emacs-directory "elisp"))))
(when (file-accessible-directory-p default-directory)
(add-to-list 'load-path default-directory)
(let ((elisp-dirs
(mapcar #'car
(cl-remove-if (lambda (dir) (or (not (eq (cadr dir) t))
(string-prefix-p "." (car dir))))
(directory-files-and-attributes default-directory)))))
(if elisp-dirs
(normal-top-level-add-to-load-path elisp-dirs)))))
(setq default-directory "~/")
(if (fboundp 'tool-bar-mode)
(tool-bar-mode 0))
(if (not window-system)
(menu-bar-mode 0))
(column-number-mode 1)
(line-number-mode 0)
;; カーソル行を強調表示
(global-hl-line-mode (if window-system 1 0))
;;; ホイールマウス
(unless (fboundp 'track-mouse)
(defun track-mouse (e)))
;(xterm-mouse-mode 1)
(require 'mouse)
(require 'mwheel)
(mouse-wheel-mode 1)
(setq mouse-wheel-follow-mouse t)
;;http://stackoverflow.com/questions/445873/emacs-mouse-scrolling
(setq mouse-wheel-scroll-amount '(1 ((shift) . 1) ((control) . nil)))
(setq mouse-wheel-progressive-speed nil)
;; ファイル補完時に大小文字を区別しない
(setq completion-ignore-case t)
;; タブをスペースで扱う
(setq-default indent-tabs-mode nil)
(setq-default c-basic-offset 4)
;; ベルを無効にする
(setq ring-bell-function 'ignore)
;;(setq visible-bell t)
;; 最近使ったファイルメニューを追加
(setq recentf-max-menu-items 10)
(setq recentf-max-saved-items 20)
(recentf-mode 1)
;; yes or noをy or n
(fset 'yes-or-no-p 'y-or-n-p)
;; 対応する括弧を強調表示
(show-paren-mode 1)
(setq show-paren-style 'mixed)
(setq inhibit-compacting-font-caches t)
(defmacro my/build-fontset (ascii size cjk target)
(when window-system
(let ((sz (number-to-string size)))
`(let ((_fontset (create-fontset-from-ascii-font ,(concat ascii "-" sz ":weight=normal:slant=normal") nil
,(replace-regexp-in-string "\\s-" "_"
(concat (downcase ascii) sz))))
(cjk ,(append `(font-spec :family ,cjk)
(if (eq system-type 'windows-nt)
'(:registry "unicode-bmp" :lang 'ja)))))
(dolist (target ,target)
(set-fontset-font _fontset target cjk nil 'append))
(set-face-font 'default _fontset)
(add-to-list 'default-frame-alist (cons 'font _fontset))))))
;(set-language-environment "japanese")
(prefer-coding-system 'utf-8-unix)
(setq-default buffer-file-coding-system 'utf-8-unix)
(cond
((eq system-type 'windows-nt)
(set-file-name-coding-system 'japanese-cp932)
(load (expand-file-name "~/.emacs.d/init-w32")))
((eq system-type 'darwin)
(require 'ucs-normalize)
(set-file-name-coding-system 'utf-8-hfs)
(setq locale-coding-system 'utf-8-hfs)
(load (expand-file-name "~/.emacs.d/init-mac")))
(t
(set-file-name-coding-system 'utf-8)
(define-key local-function-key-map "\033[37;6~" (kbd "C-%"))
(if (eq window-system 'x)
(load (expand-file-name "~/.emacs.d/init-x")))))
(define-key key-translation-map (kbd "C-h") (kbd "DEL"))
;(keyboard-translate ?\C-h ?\C-?)
;(global-set-key "\C-h" nil)
;;(global-set-key "\C-h" 'delete-backward-char)
;(global-set-key "\C-xh" 'help-command)
(global-unset-key "\C-xm")
;;; vcを停止する
(setq vc-handled-backends nil)
;;; すべてのバッファを閉じるメニューアイテムを追加
(defun close-all-buffers ()
(interactive)
(mapc 'kill-buffer (cl-remove-if (lambda (buf) (string-prefix-p "*" (buffer-name buf))) (buffer-list))))
(define-key-after menu-bar-file-menu [kill-all-buffer] '("Close all" . close-all-buffers) 'kill-buffer)
(setq custom-file (expand-file-name "~/.emacs.d/custom.el"))
(load (file-name-sans-extension custom-file) t)
(load (expand-file-name "~/.emacs.d/init-main"))
(put 'narrow-to-region 'disabled nil)
(put 'upcase-region 'disabled nil)
(put 'downcase-region 'disabled nil)
;;; Local Variables:
;;; coding: utf-8-unix
;;; mode: emacs-lisp
;;; End: