.emacs
意味もなくさらしてみる
;;===================================== ;;Language ;;===================================== ;(require 'un-define) (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) (prefer-coding-system 'utf-8) (setq default-coding-systems 'utf-8) ;;clipbord (set-clipboard-coding-system 'utf-8) (setq x-select-enable-clipboard t) ;;==================================== ;;Path ;;==================================== ; ~/.elisp を load-path の先頭に加える (setq load-path (append (list (expand-file-name "~/.elisp/") ) load-path)) ;;===================================== ;;KeyBinds ;;===================================== ;C-h を BackSpaceに (keyboard-translate ?\C-h ?\C-?) (global-set-key "\C-h" nil) (mouse-wheel-mode) (global-font-lock-mode t) ;;; M-g で指定行へジャンプ (global-set-key "\M-g" 'goto-line) (global-set-key "\C-]" 'dabbrev-expand) (global-set-key "\M- " 'dabbrev-expand) ;自動でインデント (global-set-key "\C-m" 'newline-and-indent) (global-set-key "\C-j" 'newline) ;;注意書きが出る奴w (put 'set-goal-column 'disabled nil) (put 'upcase-region 'disabled nil) (put 'downcase-region 'disabled nil) ;;============================= ;;iswitch ;;============================= (iswitchb-mode 1) (add-hook 'iswitchb-define-mode-map-hook 'iswitchb-my-keys) (defun iswitchb-my-keys () "Add my keybindings for iswitchb." (define-key iswitchb-mode-map [right] 'iswitchb-next-match) (define-key iswitchb-mode-map [left] 'iswitchb-prev-match) (define-key iswitchb-mode-map "\C-f" 'iswitchb-next-match) (define-key iswitchb-mode-map " " 'iswitchb-next-match) (define-key iswitchb-mode-map "\C-b" 'iswitchb-prev-match) ) (global-set-key "\C-x b" 'iswitch-buffer) ;;==================================== ;;Looks ;;==================================== ;23のx上でのフォント (if (and (eq window-system 'x) (>= emacs-major-version 23)) (progn (add-to-list 'default-frame-alist '(font . "Bitstream Vera Sans Mono-13")) (set-default-font "Bitstream Vera Sans Mono-13") (set-fontset-font "fontset-default" 'japanese-jisx0208 '("M+2VM+IPAG circle" . "unicode-bmp")))) ;; カーソルの点滅をやめる (blink-cursor-mode 0) ;; メニューバーを消す (menu-bar-mode 1) ;;ツールバーは消す (tool-bar-mode nil) ;; リージョン指定時の選択範囲をグラフィカルに表示 (setq transient-mark-mode t) ; その際の色を変更 ;(set-face-background 'region "gray") ;(set-face-foreground 'region "black") ;; 直前/直後の括弧に対応する括弧を光らせます。 (show-paren-mode) ;Emacs起動時に出る*GNU Emacs*バッファを表示せんようにする. (setq inhibit-startup-screen t) ;;================================ ;;Shell ;;=============================== ;補完を随時表示 (icomplete-mode 1) ;;; shell-mode でエスケープを綺麗に表示 (autoload 'ansi-color-for-comint-mode-on "ansi-color" "Set `ansi-color-for-comint-mode' to t." t) (add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on) ;引数補完 (add-hook 'shell-mode-hook 'pcomplete-shell-setup) ; shell-modeで上下でヒストリ補完 (add-hook 'shell-mode-hook (function (lambda () (define-key shell-mode-map [up] 'comint-previous-input) (define-key shell-mode-map [down] 'comint-next-input)))) ;;=================================== ;;補完 ;;================================== ;;=================== ;;anything.el ;;================== (require 'anything-config) (define-key anything-map "\C-p" 'anything-previous-line) (define-key anything-map "\C-n" 'anything-next-line) (define-key anything-map "\C-v" 'anything-next-page) (define-key anything-map "\M-v" 'anything-previous-page) (anything-iswitchb-setup) (global-set-key "\C-\\" 'anything) (global-set-key [?\C-\;] 'anything) (define-key anything-map (kbd "C-M-n") 'anything-next-source) (define-key anything-map (kbd "C-M-p") 'anything-previous-source) (defvar anything-source-file-cache '((name . "File Cache") (candidates . file-cache-files) (type . file))) ;;=================== ;;w3m ;;=================== (require 'w3m-load) ;;==================== ;;その他 ;;=================== (defconst *dmacro-key* "\C-t" "繰返し指定キー") (global-set-key *dmacro-key* 'dmacro-exec) (autoload 'dmacro-exec "dmacro" nil t) ;redo (require 'redo) ;ミニバッファでC-wで単語削除 (define-key minibuffer-local-completion-map "\C-w" 'backward-kill-word) ;;elscreen (load "elscreen" "ElScreen" t) ;;============================= ;;============================ ;;Programming ;;============================ ;;============================= ;;=============== ;;C/C++ ;;============== ;;================ ;;Scheme ;;================ (setq scheme-program-name "gosh") (require 'cmuscheme) (defun scheme-other-window () "Run scheme on other window" (interactive) (switch-to-buffer-other-window (get-buffer-create "*scheme*")) (run-scheme scheme-program-name)) (define-key global-map "\C-cS" 'scheme-other-window) ;scheme-complete ;(require 'scheme-complete) ;(autoload 'scheme-smart-complete "scheme-complete" nil t) ;(eval-after-load 'scheme ; '(progn (define-key scheme-mode-map "\e\t" 'scheme-smart-complete))) ;;Alternately, you may want to just bind TAB to the ;;`scheme-complete-or-indent' function, which indents at the start ;;of a line and otherwise performs the smart completion: ; ;(eval-after-load 'scheme ; '(progn (define-key scheme-mode-map "\t" 'scheme-complete-or-indent))) ;(require 'scheme-complete) ;Gauche-Flymake (require 'flymake) (defvar flymake-glint-err-line-patterns '(("^\\(.+\\):\\([0-9]+\\): \\(.+\\)$" 1 2 nil 3))) (defconst flymake-allowed-gauche-file-name-masks '(("\\.scm$" flymake-gauche-init))) (defun flymake-gauche-init () (let* ((temp-file (flymake-init-create-temp-buffer-copy 'flymake-create-temp-inplace)) (local-file (file-relative-name temp-file (file-name-directory buffer-file-name)))) (list "glint" (list local-file)))) (defun flymake-gauche-load () (interactive) (defadvice flymake-post-syntax-check (before flymake-force-check-was-interrupted) (setq flymake-check-was-interrupted t)) (ad-activate 'flymake-post-syntax-check) (setq flymake-allowed-file-name-masks (append flymake-allowed-file-name-masks flymake-allowed-gauche-file-name-masks)) (setq flymake-err-line-patterns flymake-glint-err-line-patterns) (flymake-mode t)) ; http://www.credmp.org/index.php/2007/07/20/on-the-fly-syntax-checking-java-in-emacs/ (defun credmp/flymake-display-err-minibuf () "Displays the error/warning for the current line in the minibuffer" (interactive) (let* ((line-no (flymake-current-line-no)) (line-err-info-list (nth 0 (flymake-find-err-info flymake-err-info line-no))) (count (length line-err-info-list)) ) (while (> count 0) (when line-err-info-list (let* ((file (flymake-ler-file (nth (1- count) line-err-info-list))) (full-file (flymake-ler-full-file (nth (1- count) line-err-info-list))) (text (flymake-ler-text (nth (1- count) line-err-info-list))) (line (flymake-ler-line (nth (1- count) line-err-info-list)))) (message "[%s] %s" line text) ) ) (setq count (1- count))))) (add-hook 'scheme-mode-hook '(lambda () (flymake-gauche-load) (define-key scheme-mode-map "\C-cd" 'credmp/flymake-display-err-minibuf))) ;;============================== ;;Color-Theme ;;============================== ;;color-theme (setq load-path (append (list (expand-file-name "~/.elisp/color-theme/") ) load-path)) (require 'color-theme) (color-theme-initialize) (color-theme-jonadabian-slate) ;;fly-makeは便利だが色がいかんな (custom-set-faces '(flymake-errline ((((class color)) (:background "Gray30")))) '(flymake-warnline ((((class color)) (:background "Gray20")))))