;; ruby-mode
(load-library "ruby")
(push '("\\.rb$" . ruby-mode) *auto-mode-alist*)
; インデント量を変える
;(setq *ruby-indent-column* 3)
(load-library "ruby-lister")
; rtags.rbまでのパス
;(setq *ruby-lister-rtags-path* "C:/Program Files/ruby/rtags.rb")
(load-library "ruby-debug")
(load-library "ruby-doc")
(load-library "ruby-misc")
; magic comment挿入
(defun ruby-insert-magiccomment (&optional encoding)
"ruby-mode: マジックコメントの挿入"
(interactive)
(unless encoding
(let ((string (char-encoding-display-name (buffer-fileio-encoding)) ))
(string-match "(\\([^)]+\\))" string)
(setq encoding (match-string 1))))
(if (string= encoding "UTF-8N") (setq encoding "UTF-8"))
(insert (format nil "# -*- coding:~A -*-\n"
encoding)))
(export '(ruby-mode ruby-insert-magiccomment))
(define-key *ruby-mode-map* '(#\C-x #\C-i) 'ruby-insert-magiccomment)
;; php-mode
(load-library "php-mode")
(push '("\\.php.?$" . php-mode) *auto-mode-alist*)
;; xml-mode
(require "xml/xml-mode")
(use-package 'xml)
(require "xml/xhtml")
;; coffee-mode
(require "coffee-mode")
(setq coffee:*command-path* "coffee.bat")
(push '("\\.coffee$" . coffee-mode) *auto-mode-alist*)
; coffee-mode TABとENTERのキーマップ無効化
(undefine-key coffee::*keymap* #\TAB)
(undefine-key coffee::*keymap* #\RET)
;; hexl-mode
(require "hexl/hexl")
;; インクリメンタルサーチの有効化
(require "isearch")
(require "migemo")
(migemo-toggle t)
;; 検索強調の有効化
(require "pickup-pattern")
;; diffへのパス設定
(setq ed::*diff-command-name* (concat (si:system-root) "etc/diff.exe"))
;; ファイラの初期ディレクトリ
(setq *filer-primary-directory* "D:/Programs")
(setq *filer-primary-file-mask* '(
"*.exe" "*.bat"))
; ファイラー用キーバインド
(global-set-key #\C-\\ 'open-filer)
(defun my-filer-shell-execute ()
(ed::filer-shell-execute)
(ed::filer-cancel))
(define-key filer-keymap #\SPC 'my-filer-shell-execute)
;; 右クリックメニューに「現在のウィンドウを閉じる」を追加
(add-hook '*post-startup-hook*
#'(lambda()
(add-menu-item *app-popup-menu* nil "現在のウィンドウを閉じる(&C)"
'delete-window 'close-window-menu-update)))
;; デフォルトの文字コードはUTF-8N
(setq *default-fileio-encoding* *encoding-utf8n*)
;; エンコーディングを指定して開き直す
(defun revert-buffer-with-encoding (encoding)
(interactive "zEncoding: ")
(revert-buffer encoding))
;; 無条件UTF-8変換
(defun revert-buffer-with-UTF8 (&optional encodinglist)
(interactive)
(revert-buffer *encoding-utf8n*)
)
;; 無条件行削除
(defun delete-line (&optional lines)
(interactive "*p")
(kill-region
(progn (goto-bol) (point))
(progn (forward-line lines) (point))))
;; siteinit.lのバイトコンパイルおよびダンプファイルの削除
(defun compile-and-delete-dump-file ()
(interactive)
(and (find-buffer "siteinit.l")
(eval-buffer "siteinit.l"))
(byte-compile-file
(concat (si:system-root) "site-lisp/siteinit.l"))
(delete-file (concat (si:system-root) "xyzzy.wxp")))
;; csvファイルを色づけ
(defun csv-coloring ()
(interactive)
(make-local-variable 'regexp-keyword-list)
(let* ((col '((:color 4 0) (:color 9 0) (:color 10 0)))
(reg "^")
(str (save-excursion
(buffer-substring (progn (goto-char (point-min)) (point))
(progn (goto-eol) (point)))))
(sep (if (string-match (string #\TAB) str) #\TAB #\,))
(sepstr (string sep))
(len (list-length (split-string str sep)))
collst colnum)
(setq colnum (1- (list-length col)))
(dotimes (i len)
(let ((j (1+ i))
(c (nth colnum col)))
(when (= j 10) (return nil))
(when (< (decf colnum) 0)
(setq colnum (1- (list-length col))))
(setq reg (concat reg "\\([^" sepstr "]*\\)" (if (< j len) sepstr "$")))
(setq collst (acons j c collst))))
(setq regexp-keyword-list
(compile-regexp-keyword-list `((,reg t ,collst))))))
;; NetInstaller 有効化
(require "ni/setup")
; 自動設定を利用する
(ni-autoload)
; PROXYを通す場合
;(setq ni::*http-proxy-host* "proxy.xxx.xxx") ; PROXY のホスト
;(setq ni::*http-proxy-port* 8080) ; PROXY のポート
; ============================================================================ ;
;; 各種キーコンフィグ
(load-library "Gates")
(load-library "winkey")
(global-set-key #\S-F12 'toggle-mode-line)
(global-set-key #\F12 'toggle-line-number)
; バイトコンパイルおよびダンプファイルの削除
(global-set-key '(#\C-c #\b) 'compile-and-delete-dump-file)
; 無条件UTF-8変換
(global-set-key '#\C-w 'revert-buffer-with-UTF8)
; エンコーディングを指定して開き直す
(global-set-key '#\M-C-w 'revert-buffer-with-encoding)
; 無条件行削除
(global-set-key '#\C-d 'delete-line)
(global-set-key '(#\C-c #\C-d) 'delete-line)
; 検索強調
(global-set-key #\M-f 're-search-forward-pickup)
(global-set-key #\M-C-f 'pickup-pattern-unset-all)
; ファイラ実行
(global-set-key #\C-\\ 'open-filer)
; インクリメンタルサーチ
(global-set-key #\C-/ 'isearch-forward)
(global-set-key #\C-? 'isearch-backward)
; csv色付け
(global-set-key '(#\C-c #\C-s) 'csv-coloring)
最終更新:2012年12月23日 21:49