root/dotfiles/emacs/mrkn/.emacs @ 29345

Revision 29345, 10.5 kB (checked in by mrkn, 4 years ago)

fullscreen

  • Property svn:keywords set to
    Id
    Revision
Line 
1;;; $Id$
2(if (featurep 'meadow) (cd (expand-file-name "~")))
3
4;;; Load path
5(setq load-path
6      (append (list (expand-file-name "~/elisp/")
7                    )
8              load-path))
9
10;;; personal information
11(setq user-full-name "Kenta Murata")
12(setq user-mail-address "mrkn@mrkn.jp")
13
14;;; Language evnrionment
15(if (featurep 'mule)
16    (progn
17      (if (featurep 'meadow)
18          (require 'un-define))
19      (set-language-environment "Japanese")
20      (cond
21       ;; CarbonEmacs
22       ((featurep 'mac-carbon)
23        (set-default-coding-systems 'utf-8-unix)
24        (set-buffer-file-coding-system 'utf-8-unix)
25        (set-clipboard-coding-system 'sjis-mac)
26        (utf-translate-cjk-mode 1)
27        (set-file-name-coding-system 'utf-8m)
28        (if window-system
29            (set-keyboard-coding-system 'sjis-mac)
30          (progn
31            (set-keyboard-coding-system 'utf-8)
32            (set-terminal-coding-system 'utf-8)))
33        )
34       ;; Etc.
35       (t
36        (prefer-coding-system 'utf-8-unix)
37        ))
38      ))
39
40;;; Locale
41(let (p)
42  (setq p process-environment)
43  (setq process-environment '("LANG=ja_JP.UTF_8" "LC_ALL=C"))
44  (while p
45    (unless (or (string-match "^LANG=" (car p))
46                (string-match "^LC_.+=" (car p)))
47      (setq process-environment (cons (car p) process-environment)))
48    (setq p (cdr p)))
49  process-environment)
50
51;; for Japanese info files
52(auto-compression-mode t)
53
54;; System info files
55(setq Info-additional-directory-list
56      '("/usr/share/info"
57        "/opt/local/share/info"))
58
59;; japanese grep
60(if (file-exists-p "/usr/bin/lgrep")
61    (setq grep-command "lgrep -n"))
62
63;;; Input Method
64(if (featurep 'mac-carbon)
65    (if window-system
66        (set-input-method "MacOSX"))
67  (set-input-method "japanese-skk"))
68(toggle-input-method nil)
69
70;;; UIM
71;;; 起動コマンド:
72;;;   env GTK_IM_MODULE=xim XMODIFIERS="@im=none" emacs
73;;;
74;;; .Xresources:
75;;;   Emacs*xnlLanguage: C
76;;;   Emacs*useXIM: false
77;; (if (not (or (featurep 'meadow) (featurep 'dos-w32)))
78;;     (progn
79;;       (require 'uim-leim)
80;;       (set-input-method "japanese-skk-uim")
81;;       (toggle-input-method nil)
82;;       (global-set-key "\C-x\C-j" 'toggle-input-method)))
83
84;; global font-lock mode
85(require 'font-lock)
86(if (not (featurep 'xemacs))
87    (global-font-lock-mode t))
88
89;;; disable tool-bar mode
90(when window-system
91  (tool-bar-mode nil))
92
93;;; set scroll-bar on right
94(if window-system
95    (set-scroll-bar-mode 'right))
96
97;;; enable line- and column-number-mode
98(line-number-mode t)
99(column-number-mode t)
100
101;;; display time
102;;(setq display-time-day-and-date t
103;;      display-time-24hr-format t)
104(setq display-time-interval 1
105      display-time-format "%Y-%m-%d %H:%M:%S")
106(display-time)
107
108;;; enable show-paren-mode in expression style
109(show-paren-mode t)
110(setq show-paren-style 'expression)
111
112;;; enable transient-mark-mode
113(transient-mark-mode t)
114
115;;; enable partial-completion-mode
116(partial-completion-mode t)
117
118;;; enable mouse-wheel-mode
119(mouse-wheel-mode t)
120
121;; backup by copying
122(setq backup-by-copying t)
123
124;;; global key bindings
125(setq mac-option-modifier 'meta)
126(global-set-key "\C-h" 'backward-delete-char)
127(global-set-key "\M-?" 'help-for-help)
128(global-set-key "\M-g" 'goto-line)
129(global-set-key [f1] 'help-for-help)
130(global-set-key "\C-cs" 'svn-status)
131(global-set-key [M-kanji] 'ignore)
132
133;;; universal diff
134(setq diff-switches "-uN")
135
136;;; aspell
137(setq ispell-program-name "aspell")
138
139;; TRAMP
140(require 'tramp-util)
141(setq tramp-default-method
142      (if (featurep 'meadow) "plink" "ssh"))
143(setq tramp-completion-without-shell-p t)
144(add-to-list 'backup-directory-alist
145             (cons tramp-file-name-regexp nil))
146(if (featurep 'meadow)
147    (setq tramp-encoding-shell "tcsh"
148          tramp-encoding-command-switch "-c"
149          tramp-ls-command "ls"
150          ls-lisp-use-insert-directory-program t))
151
152;;; fakecygpty
153(if (featurep 'meadow)
154    (setq mw32-process-wrapper-alist
155          '(("/\\(bash\\|tcsh\\|svn\\|ssh\\|scp\\|gpg[esvk]?\\)\\.exe" .
156             (nil . ("fakecygpty.exe" . set-process-connection-type-pty))))
157          ))
158
159;;; shell setting using bash
160(if (featurep 'meadow)
161    (progn
162      (setq explicit-shell-file-name "bash.exe")
163      (setq shell-file-name "c:/cygwin/bin/bash.exe")
164      )
165  (progn
166    (setq explicit-shell-file-name "bash")
167    (setq shell-file-name "/bin/bash")
168    (setq shell-prompt-pattern "^[^$]*\$ *")
169    (add-hook 'shell-mode-hook
170              '(lambda ()
171                 (setq comint-process-echoes t)))
172    ))
173(setq shell-command-switch "-c")
174(setq explicit-bash-args '("--login"))
175(autoload 'ansi-color-for-comint-mode-on "ansi-color"
176  "Set `ansi-color-for-comint-mode' to t." t)
177(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)
178
179;;; Cygwin
180
181
182;;; flymake
183(require 'flymake)
184(defun flymake-display-err-for-current-line-minibuffer ()
185  "Display a errors/warnings for current line if it has errors and/or warnings."
186  (interactive)
187  (let* ((line-no             (flymake-current-line-no))
188         (line-err-info-list  (nth 0 (flymake-find-err-info flymake-err-info line-no)))
189         (count               (length line-err-info-list)))
190    (while (> count 0)
191      (when line-err-info-list
192        (let* ((file       (flymake-ler-file (nth (1- count) line-err-info-list)))
193               (full-file  (flymake-ler-full-file (nth (1- count) line-err-info-list)))
194               (text (flymake-ler-text (nth (1- count) line-err-info-list)))
195               (line       (flymake-ler-line (nth (1- count) line-err-info-list))))
196          (message "[%s] %s" line text)
197          ))
198      (setq count (1- count))
199      )))
200(global-set-key [f3] 'flymake-display-err-for-current-line-minibuffer)
201(global-set-key [f4] 'flymake-goto-next-error)
202(add-hook 'find-file-hook 'flymake-find-file-hook)
203(set-face-background 'flymake-errline "#303")
204(set-face-background 'flymake-warnline "dark slate blue")
205(defun flymake-get-make-cmdline (source base-dir)
206  (list "make"
207        (list "check-syntax" "-s" "-C"
208              base-dir
209              (concat "CHK_SOURCES=" source)
210              "SYNTAX_CHECK_MODE=1")))
211(push '("\\.h\\'" flymake-simple-make-init)
212      flymake-allowed-file-name-masks)
213(push '("\\.hpp\\'" flymake-simple-make-init)
214      flymake-allowed-file-name-masks)
215(push '("\\.hh\\'" flymake-simple-make-init)
216      flymake-allowed-file-name-masks)
217
218;; ESS/R
219(setq auto-mode-alist
220     (cons (cons "\\.r$" 'R-mode) auto-mode-alist))
221(autoload 'R-mode "ess-site" "Emacs Speaks Statistics mode" t)
222(setq-default inferior-R-program-name "/Library/Frameworks/R.framework/Resources/bin/R")
223(setq ess-pre-run-hook
224 '((lambda () (setq S-directory default-directory)
225     (setq default-process-coding-system '(utf-8-unix . utf-8-unix))
226  )))
227(autoload 'R "ess-site" nil 'interactive)
228
229;;; cc-mode settings
230(if (file-exists-p "~/.emacs.d/ccmode.el")
231    (load-file "~/.emacs.d/ccmode.el"))
232(require 'ruby-style)
233
234;;; for autoloading inf-ruby when run-ruby is refered
235(autoload 'run-ruby "inf-ruby"
236  "Run an inferior Ruby process" t)
237(autoload 'run-ruby-keys "inf-ruby"
238  "Set local key defs for inf-ruby in ruby-mode" t)
239(add-hook 'ruby-mode-hook
240          '(lambda ()
241             (inf-ruby-keys)))
242(if (featurep 'meadow)
243    (add-hook 'inferior-ruby-mode-hook
244              '(lambda ()
245                 (setq comint-process-echoes t))))
246
247;;; for InstantRails
248(if (featurep 'meadow)
249    (defun instant-rails (&optional buffer)
250      ""
251      (interactive
252       (list
253        (and current-prefix-arg
254             (read-buffer "Shell buffer: "
255                          (generate-new-buffer-name "*instant-rails*")))))
256      (setq buffer (get-buffer-create (or buffer "*instant-rails*")))
257      ;; Pop to buffer, so that the buffer's window will be correctly set
258      ;; when we call comint (so that comint sets the COLUMN env var properly).
259      (pop-to-buffer buffer)
260      (unless (comint-check-proc buffer)
261        (let* ((startfile "c:/InstantRails/use_ruby.cmd"))
262          (apply 'make-comint-in-buffer "instant-rails" buffer "cmd.exe"
263                 startfile '("\Q"))
264          (shell-mode)
265          (setq default-directory "c:/InstantRails/rails_apps")))
266      buffer))
267
268;;; JavaScript
269(autoload 'javascript-mode "javascript" nil t)
270(add-to-list 'auto-mode-alist
271             (cons "\\.\\(js\\|as\\|json\\|jsn\\)$"
272                   'javascript-mode))
273(setq js-indent-level 2)
274
275;;; Erlang
276
277
278;;; GNU Global
279(if (file-exists-p "~/.emacs.d/global.el")
280    (load-file "~/.emacs.d/global.el"))
281
282;;; muse
283
284;;; AUCTeX
285(if (file-exists-p "~/.emacs.d/auctex.el")
286    (load-file "~/.emacs.d/auctex.el"))
287
288;;; git-status
289(if (file-exists-p "~/.emacs.d/git.el")
290    (load-file "~/.emacs.d/git.el"))
291
292;;; eijiro
293(if (featurep 'meadow)
294    (load "~/.emacs.d/eijiro.el"))
295
296;;; Font settings
297(if window-system
298    (load "~/.emacs.d/fonts.el"))
299
300;;; gnuserv
301(when window-system
302  (if (and (not (featurep 'dos-w32)) (not (featurep 'mac-carbon)))
303      (progn
304       (require 'gnuserv-compat)
305       (gnuserv-start)
306       )))
307
308;;; applying default fontset
309(when window-system
310  (let ((setter (lambda (key value alist-sym)
311                  (if (symbolp alist-sym)
312                      (if (assoc key (symbol-value alist-sym))
313                          (setcdr (assoc key (symbol-value alist-sym)) value)
314                        (set alist-sym (append (list (cons key value))
315                                               (symbol-value alist-sym))))
316                    (error "alist-sym must be a symbol")))))
317    (cond
318     ((featurep 'dos-w32)
319      (progn
320        (funcall setter 'font
321                 (if (featurep 'meadow)
322                     "MeiryoKe_Console 12"
323                   "fontset-mp2vm")
324                 'default-frame-alist)
325        (funcall setter 'height 40 'default-frame-alist)
326        (set-face-attribute 'default nil :height 120)))
327     ((featurep 'carbon-emacs-package)
328      ;;(add-to-list 'default-frame-alist '(font . "fontset-default"))
329      ;;(funcall setter 'width 96 'default-frame-alist)
330      ;;(funcall setter 'height 32 'default-frame-alist)
331      ;;(funcall setter 'alpha '(90 80) 'default-frame-alist)
332      (set-frame-parameter nil 'alpha 90)
333      )
334     (t
335      (progn
336        (funcall setter 'font "fontset-m+2vm+ipag circle_12"
337                 'default-frame-alist)
338        )))))
339
340;;; fullscreen
341(defun fullscreen ()
342  (interactive)
343  (set-frame-parameter nil 'fullscreen
344                       (if (frame-parameter nil 'fullscreen) nil 'fullboth)))
345(global-set-key [f5] 'fullscreen)
346
347;;; color-theme
348(require 'color-theme)
349(color-theme-initialize)
350(color-theme-dark-laptop)
351
352;;; Local Variables:
353;;; mode: emacs-lisp
354;;; indent-tabs-mode: nil
355;;; End:
356;;; end of file
Note: See TracBrowser for help on using the browser.