-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdotemacs
More file actions
372 lines (314 loc) · 10.9 KB
/
dotemacs
File metadata and controls
372 lines (314 loc) · 10.9 KB
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
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
;; -*- mode: Emacs-Lisp -*-
;; written by k-okada 2006.06.14
;;
;; changed by ueda 2009.04.21
;; (debian-startup 'emacs21)
;;; Global Setting Key
;;;
(global-set-key "\C-h" 'backward-delete-char)
(global-set-key "\M-g" 'goto-line)
(global-set-key "\C-xL" 'goto-line)
(global-set-key "\C-xR" 'revert-buffer)
(global-set-key "\er" 'query-replace)
(global-unset-key "\C-o" )
(setq visible-bell t)
;;; When in Text mode, want to be in Auto-Fill mode.
;;;
(defun my-auto-fill-mode nil (auto-fill-mode 1))
(setq text-mode-hook 'my-auto-fill-mode)
(setq mail-mode-hook 'my-auto-fill-mode)
;;; time
;;;
(load "time" t t)
(display-time)
;;; for mew
;;;
;;; explanation exists in /opt/src/Solaris/mew-1.03/00install.jis
;;;
(when nil ;; obsolate mew setting
(autoload 'mew "mew" nil t)
(autoload 'mew-read "mew" nil t)
(autoload 'mew-send "mew" nil t)
(setq mew-name "User Name")
(setq mew-user "user")
(setq mew-dcc "user@jsk.t.u-tokyo.ac.jp")
(setq mew-mail-domain "jsk.t.u-tokyo.ac.jp")
(setq mew-pop-server "mail.jsk.t.u-tokyo.ac.jp")
(setq mew-pop-auth 'apop)
(setq mew-pop-delete 3)
(setq mew-smtp-server "mail.jsk.t.u-tokyo.ac.jp")
(setq mew-fcc nil)
(setq mew-use-cached-passwd t)
;;
;; Optional setup (Read Mail menu for Emacs 21):
(if (boundp 'read-mail-command)
(setq read-mail-command 'mew))
;; Optional setup (e.g. C-xm for sending a message):
(autoload 'mew-user-agent-compose "mew" nil t)
(if (boundp 'mail-user-agent)
(setq mail-user-agent 'mew-user-agent))
(if (fboundp 'define-mail-user-agent)
(define-mail-user-agent
'mew-user-agent
'mew-user-agent-compose
'mew-draft-send-message
'mew-draft-kill
'mew-send-hook))
(define-key ctl-x-map "r" 'mew)
(define-key ctl-x-map "m" 'mew-send)
) ;; /obsolate mew setting
;; (lookup)
;;
(setq lookup-search-agents '((ndtp "nfs")))
(define-key global-map "\C-co" 'lookup-pattern)
(define-key global-map "\C-cr" 'lookup-region)
(autoload 'lookup "lookup" "Online dictionary." t nil )
;; Japanese
;; uncommented by ueda. beacuse in shell buffer, they invokes mozibake
(set-language-environment 'Japanese)
(prefer-coding-system 'utf-8)
(setq enable-double-n-syntax t)
(setq use-kuten-for-period nil)
(setq use-touten-for-comma nil)
;; sudo apt-get install yc-el migemo
(when (locate-library "yc")
(require 'yc))
(when (locate-library "migemo")
(require 'migemo))
;;; Timestamp
;;;
(defun timestamp-insert ()
(interactive)
(insert (current-time-string))
(backward-char))
(global-set-key "\C-c\C-d" 'timestamp-insert)
(global-font-lock-mode t)
;; M-n and M-p
(global-unset-key "\M-p")
(global-unset-key "\M-n")
(defun scroll-up-in-place (n)
(interactive "p")
(previous-line n)
(scroll-down n))
(defun scroll-down-in-place (n)
(interactive "p")
(next-line n)
(scroll-up n))
(global-set-key "\M-n" 'scroll-down-in-place)
(global-set-key "\M-p" 'scroll-up-in-place)
;; dabbrev
(global-set-key "\C-o" 'dabbrev-expand)
;; add by kojima
(require 'paren)
(show-paren-mode 1)
;; ;; C-qで移動
(defun match-paren (arg)
"Go to the matching parenthesis if on parenthesis."
(interactive "p")
(cond ((looking-at "\\s\(") (forward-list 1) (backward-char 1))
((looking-at "\\s\)") (forward-char 1) (backward-list 1))
)
)
(global-set-key "\C-Q" 'match-paren)
(font-lock-add-keywords 'lisp-mode
(list
(list "\\(\\*\\w\+\\*\\)\\>"
'(1 font-lock-constant-face nil t))
(list "\\(\\+\\w\+\\+\\)\\>"
'(1 font-lock-constant-face nil t))))
(when t
;; does not allow use hard tab.
(setq-default indent-tabs-mode nil)
)
;; ignore start message
(setq inhibit-startup-message t)
(when nil
;; add template.l by kojima
(require 'autoinsert)
(when (featurep 'emacs)
(let (skeldir)
(setq skeldir "~/prog/scripts/emacs-templates")
(setq auto-insert-directory skeldir)
(setq auto-insert-alist
(nconc '(
("\\.l$" . "template.l")
("\\.sh$" . "template.sh")
("Makefile$" . "template.Makefile")
("\\.cpp$" . "template.cpp")
("\\.h$" . "template.h")
) auto-insert-alist))
(add-hook 'find-file-not-found-hooks 'auto-insert)
)
)
)
;; shell mode
(set-terminal-coding-system 'utf-8)
(set-buffer-file-coding-system 'utf-8)
(setq explicit-shell-file-name shell-file-name)
(setq shell-command-option "-c")
(setq system-uses-terminfo nil)
(setq shell-file-name-chars "~/A-Za-z0-9_^$!#%&{}@`'.,:()-")
(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)
(defun lisp-other-window ()
"Run Lisp on other window"
(interactive)
(switch-to-buffer-other-window
(get-buffer-create "*inferior-lisp*"))
(run-lisp inferior-lisp-program))
(set-variable 'inferior-lisp-program "jskrbeusgl")
(global-set-key "\C-cE" 'lisp-other-window)
;; add color space,tab,zenkaku-space
(defface my-face-b-1 '((t (:background "gray"))) nil)
(defface my-face-b-2 '((t (:background "red"))) nil)
(defface my-face-u-1 '((t (:background "red"))) nil)
(defvar my-face-b-1 'my-face-b-1)
(defvar my-face-b-2 'my-face-b-2)
(defvar my-face-u-1 'my-face-u-1)
(defadvice font-lock-mode (before my-font-lock-mode ())
(font-lock-add-keywords
major-mode
'(
("\t" 0 my-face-b-1 append)
(" " 0 my-face-b-2 append)
("[ \t]+$" 0 my-face-u-1 append)
)))
(ad-enable-advice 'font-lock-mode 'before 'my-font-lock-mode)
(ad-activate 'font-lock-mode)
;; to change indent for euslisp's method definition ;; begin
(define-derived-mode euslisp-mode lisp-mode
"EusLisp"
"Major Mode for EusLisp"
)
(defun lisp-indent-function (indent-point state)
"This function is the normal value of the variable `lisp-indent-function'.
It is used when indenting a line within a function call, to see if the
called function says anything special about how to indent the line.
INDENT-POINT is the position where the user typed TAB, or equivalent.
Point is located at the point to indent under (for default indentation);
STATE is the `parse-partial-sexp' state for that position.
If the current line is in a call to a Lisp function
which has a non-nil property `lisp-indent-function',
that specifies how to do the indentation. The property value can be
* `defun', meaning indent `defun'-style;
* an integer N, meaning indent the first N arguments specially
like ordinary function arguments and then indent any further
arguments like a body;
* a function to call just as this function was called.
If that function returns nil, that means it doesn't specify
the indentation.
This function also returns nil meaning don't specify the indentation."
(let ((normal-indent (current-column)))
(goto-char (1+ (elt state 1)))
(parse-partial-sexp (point) calculate-lisp-indent-last-sexp 0 t)
(if (and (elt state 2)
(not (looking-at "\\sw\\|\\s_")))
;; car of form doesn't seem to be a symbol
(progn
(if (not (> (save-excursion (forward-line 1) (point))
calculate-lisp-indent-last-sexp))
(progn (goto-char calculate-lisp-indent-last-sexp)
(beginning-of-line)
(parse-partial-sexp (point)
calculate-lisp-indent-last-sexp 0 t)))
;; Indent under the list or under the first sexp on the same
;; line as calculate-lisp-indent-last-sexp. Note that first
;; thing on that line has to be complete sexp since we are
;; inside the innermost containing sexp.
(backward-prefix-chars)
(current-column))
(let ((function (buffer-substring (point)
(progn (forward-sexp 1) (point))))
method)
(setq method (or (get (intern-soft function) 'lisp-indent-function)
(get (intern-soft function) 'lisp-indent-hook)))
(cond ((or (eq method 'defun)
(and
(eq major-mode 'euslisp-mode)
(string-match ":.*" function))
(and (null method)
(> (length function) 3)
(string-match "\\`def" function)))
(lisp-indent-defform state indent-point))
((integerp method)
(lisp-indent-specform method state
indent-point normal-indent))
(method
(funcall method indent-point state)))))))
;; to change indent for euslisp's method definition ;; end
;;Xwindow setting
(when nil
(set-foreground-color "white")
(set-background-color "black")
(set-scroll-bar-mode 'right)
(set-cursor-color "white")
)
;;
(line-number-mode t)
(column-number-mode t)
(when nil
;; stop auto scroll according to cursol
(setq comint-scroll-show-maximum-output nil)
)
(setq ring-bell-function 'ignore)
(setq auto-mode-alist (cons (cons "\\.launch$" 'xml-mode) auto-mode-alist))
;; sudo apt-get install rosemacs-el
(require 'rosemacs)
(invoke-rosemacs)
(global-set-key "\C-x\C-r" ros-keymap)
;; vrml mode
(add-to-list 'load-path (format "%s/.emacs.d" (getenv "HOME")))
(when (file-exists-p (format "%s/.emacs.d/vrml-mode.el" (getenv "HOME")))
(load "vrml-mode.el")
(autoload 'vrml-mode "vrml" "VRML mode." t)
(setq auto-mode-alist (append '(("\\.wrl\\'" . vrml-mode))
auto-mode-alist)))
;; matlab mode
(when (file-exists-p (format "%s/.emacs.d/matlab/matlab.el.1.10.1" (getenv "HOME")))
(load "matlab/matlab.el.1.10.1" (getenv "HOME"))
(setq auto-mode-alist (append '(("\\.m\\'" . matlab-mode))
auto-mode-alist)))
;; for Arduino
(setq auto-mode-alist (append '(("\\.pde\\'" . c++-mode))
auto-mode-alist))
;; yaml mode
(when (require 'yaml-mode nil t)
(add-to-list 'auto-mode-alist '("¥¥.yml$" . yaml-mode)))
;;emacsのsolarized化 ここから
;(add-to-list 'custom-theme-load-path "~/.emacs.d/themes/emacs-color-theme-solarized")
;(load-theme 'solarized-dark t)
;(require 'color-theme-solarized)
;(add-to-list 'custom-theme-load-path "~/.emacs.d/emacs-color-theme-solarized")
;(load-theme 'solarized-dark t)
(load-file "~/.emacs.d/emacs-color-theme-solarized/color-theme-solarized.el")
(color-theme-solarized-light)
;; color-theme.el
;(when (require 'color-theme) ; (color-theme-initialize)
;; color-theme-solorized.el
;(when (require 'color-theme-solarized)
; (color-theme-solarized-dark)))
; ここまで
;;trrの設定
(add-to-list 'load-path "/usr/share/emacs/site-lisp/trr22")
(autoload 'trr "/usr/share/emacs/site-lisp/trr22/trr" nil t)
;(autoload 'trr "/usr/local/trr/trr" nil t)
(put 'upcase-region 'disabled nil)
;shift +
(setq windmove-wrap-around t)
(windmove-default-keybindings)
;clip board
(if (display-graphic-p)
(progn
(setq x-select-enable-clipboard t)
(global-set-key "\C-y" 'x-clipboard-yank))
(progn
(setq interprogram-paste-function
#'(lambda () (shell-command-to-string "xsel -b -o")))
(setq interprogram-cut-function
#'(lambda (text &optional rest)
(let*
((process-connection-type nil)
(proc (start-process "xsel" "*Messages*" "xsel" "-b" "-i")))
(process-send-string proc text)
(process-send-eof proc))))))
;Ctrl + n とかでページダウンする時とかに1行ずつになる
(setq scroll-step 1)