;; .emacs
;; WEB+DB40
;; WEB+DB40
;;;; -*- mode: lisp-interaction; syntax: elisp; coding: utf-8-unix -*-
;; ~/elisp をライブラリパスに追加
(setq load-path
;; ~/elisp をライブラリパスに追加
(setq load-path
(append
(list
(expand-file-name "~/elisp/")
)
load-path))
;; locale (UTF-8)
(set-language-environment "Japanese")
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-buffer-file-coding-system 'utf-8)
(setq default-buffer-file-coding-system 'utf-8)
(set-language-environment "Japanese")
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-buffer-file-coding-system 'utf-8)
(setq default-buffer-file-coding-system 'utf-8)
;; フォントロックモード (強調表示等) を有効にする
(global-font-lock-mode t)
(global-font-lock-mode t)
;; 一時マークモードの自動有効化
(setq-default transient-mark-mode t)
(setq-default transient-mark-mode t)
;; C-x C-u が何もしないように変更する (undo の typo 時誤動作防止)
(global-unset-key "\C-x\C-u")
(global-unset-key "\C-x\C-u")
;; 括弧の対応をハイライト.
(show-paren-mode 1)
(show-paren-mode 1)
;; バッファ末尾に余計な改行コードを防ぐための設定
(setq next-line-add-newlines nil)
(setq next-line-add-newlines nil)
;; default to better frame titles
(setq frame-title-format
(setq frame-title-format
(concat "%b - emacs@" system-name))
;; C-x l で goto-line を実行
(define-key ctl-x-map "l" 'goto-line)
(define-key ctl-x-map "l" 'goto-line)
;; 時間を表示
(display-time)
(display-time)
;; 列数表示
(column-number-mode 1)
(column-number-mode 1)
;; メニューバーを消す
(menu-bar-mode -1)
(menu-bar-mode -1)
;; C-h でカーソルの左にある文字を消す
(define-key global-map "\C-h" 'delete-backward-char)
(define-key global-map "\C-h" 'delete-backward-char)
;; C-h に割り当てられている関数 help-command を C-x C-h に割り当てる
(define-key global-map "\C-x\C-h" 'help-command)
(define-key global-map "\C-x\C-h" 'help-command)
;; C-o に動的略語展開機能を割り当てる
(define-key global-map "\C-o" 'dabbrev-expand)
;; 大文字小文字を区別
(setq dabbrev-case-fold-search nil)
(define-key global-map "\C-o" 'dabbrev-expand)
;; 大文字小文字を区別
(setq dabbrev-case-fold-search nil)
;; 日本語・英語混じり文での区切判定
;; http://www.alles.or.jp/~torutk/oojava/meadow/Meadow210Install.html
(defadvice dabbrev-expand
;; http://www.alles.or.jp/~torutk/oojava/meadow/Meadow210Install.html
(defadvice dabbrev-expand
(around modify-regexp-for-japanese activate compile)
"Modify `dabbrev-abbrev-char-regexp' dynamically for Japanese words."
(if (bobp)
ad-do-it
(let ((dabbrev-abbrev-char-regexp
(let ((c (char-category-set (char-before))))
(cond
((aref c ?a) "[-_A-Za-z0-9]") ; ASCII
((aref c ?j) ; Japanese
(cond
((aref c ?K) "\\cK") ; katakana
((aref c ?A) "\\cA") ; 2byte alphanumeric
((aref c ?H) "\\cH") ; hiragana
((aref c ?C) "\\cC") ; kanji
(t "\\cj")))
((aref c ?k) "\\ck") ; hankaku-kana
((aref c ?r) "\\cr") ; Japanese roman ?
(t dabbrev-abbrev-char-regexp)))))
ad-do-it)))
;; BS で選択範囲を消す
(delete-selection-mode 1)
(delete-selection-mode 1)
;; The local variables list in .emacs と言われるのを抑止
(add-to-list 'ignored-local-variables 'syntax)
(add-to-list 'ignored-local-variables 'syntax)
;; ruby-mode の設定
(autoload 'ruby-mode "ruby-mode"
"Mode for editing ruby source files" t)
(setq auto-mode-alist
(append '(("\\.rb$" . ruby-mode)) auto-mode-alist))
(setq interpreter-mode-alist (append '(("ruby" . ruby-mode))
interpreter-mode-alist))
(autoload 'run-ruby "inf-ruby"
"Run an inferior [[Ruby]] process")
(autoload 'inf-ruby-keys "inf-ruby"
"Set local key defs for inf-ruby in ruby-mode")
(add-hook 'ruby-mode-hook
'(lambda ()
(inf-ruby-keys)))
;; cperl-mode の設定
(autoload 'perl-mode "cperl-mode" "alternate mode for editing Perl programs" t)
(setq cperl-auto-newline t)
(setq cperl-indent-parens-as-block t)
(setq cperl-close-paren-offset -4)
(setq cperl-indent-level 4)
(setq cperl-label-offset -4)
(setq cperl-continued-statement-offset 4)
(setq cperl-highlight-variables-indiscriminately t)
(add-hook 'cperl-mode-hook
(autoload 'perl-mode "cperl-mode" "alternate mode for editing Perl programs" t)
(setq cperl-auto-newline t)
(setq cperl-indent-parens-as-block t)
(setq cperl-close-paren-offset -4)
(setq cperl-indent-level 4)
(setq cperl-label-offset -4)
(setq cperl-continued-statement-offset 4)
(setq cperl-highlight-variables-indiscriminately t)
(add-hook 'cperl-mode-hook
(lambda ()
(set-face-italic-p 'cperl-hash-face nil)))
(add-hook 'cperl-mode-hook
'(lambda ()
(define-key cperl-mode-map "\C-cc" 'cperl-check-syntax)
(setq indent-tabs-mode nil)))
;; リセットされた場合に UTF-8 に戻す
;; http://0xcc.net/blog/archives/000041.html
(set-default-coding-systems 'utf-8)
;; http://0xcc.net/blog/archives/000041.html
(set-default-coding-systems 'utf-8)