xyzzyの設定
xyzzyインストールする度にいろいろ探すのが面倒なのでメモ。
xyzzy本体は作者の方のページからダウンロードする
その他、いろいろ使ってるのをダウンロードしたりnetinsatllerでインストールしたりする
2009/10/27追記。scheme-modeはscheme-mode.20090118.zipを使用するようにすること。
2009/10/23追記。足りてなかった。
~/.xyzzyの内容。古かったり間違ってたりするんで、後で見直す予定。
;; モードラインフォーマット[IME状態をプラス+α] ;; -%*- buffer-name (mode:minor-mode) [encoding:eol-code] [IME] line:vertical-line file-name (setq mode-line-format "--%*-- %b (%M) [%k:%l] [%i] %P %f") ;; タイトルラインフォーマット[好みの問題] ;; buffer-name *(mode:minor-mode) [encodeing:eol-code] - xyzzy version@user (setq title-bar-format "%b %#*(%M) [%k:%l] - %p %v%#h") ;; 改行コードは LF をデフォルトにしておく (change-eol-code 0) (require "isearch") ;; C-x u (undo) (global-set-key '(#\C-x #\u) 'undo) ;; C-o , C-\ (IME起動) (global-set-key #\C-o 'toggle-ime) (global-set-key #\C-\\ 'toggle-ime) (global-set-key #\RET 'newline) ;;(global-set-key #\RET 'newline-and-indent) ;; *scratch* を終了時に保存 ;;(add-hook '*kill-xyzzy-hook* ;; #'(lambda () ;; (set-buffer (find-buffer "*scratch*")) ;; (write-file "~/scratch"))) ;; ;; *scratch* を起動時にロード ;;(add-hook '*post-startup-hook* ;; #'(lambda () ;; (set-buffer (find-buffer "*scratch*")) ;; (insert-file "~/scratch"))) ;; M-% (置換) (global-set-key #\M-% 'replace-string) ;;swith to new window after rename (global-set-key '(#\C-x #\C-w) 'emacs-write-file) ;; rectangle (global-set-key '(#\C-x #\r #\d) 'delete-rectangle) (global-set-key '(#\C-x #\r #\k) 'kill-rectangle) (global-set-key '(#\C-x #\r #\o) 'open-rectangle) (global-set-key '(#\C-x #\r #\t) 'string-rectangle) (global-set-key '(#\C-x #\r #\y) 'yank-rectangle) (global-set-key '(#\C-x #\r #\w) 'copy-rectangle) ;; C-x h (全選択) (global-set-key '(#\C-x #\h) 'selection-whole-buffer) ;; タブを使う場合 ;; (setq indent-tabs-mode t) ;; 半角スペースを使う場合 (setq indent-tabs-mode nil) ;; text mode (add-hook '*text-mode-hook* #'(lambda () (auto-fill-mode t) (set-local-window-flags (selected-buffer) *window-flag-cursor-line* t) )) ;; indent禁止 (setq *initial-buffer-mode* 'fundamental-mode) (setq *auto-mode-alist* nil) (in-package "editor") (add-hook '*fundamental-mode-hook* #'(lambda () (define-key *fundamental-mode-map* #\RET 'newline))) ;; sql-mode (pushnew '("\\.sql$" . sql-mode) *auto-mode-alist* :test 'equal) (add-hook '*sql-mode-hook* #'(lambda () (set-syntax-start-c++-comment *sql-mode-syntax-table* #\-) (set-syntax-end-c++-comment *sql-mode-syntax-table* #\LFD) (define-key *sql-mode-map* #\RET 'newline))) ;; html-mode (pushnew '("\\.jsp?$" . html-mode) *auto-mode-alist* :test 'equal) (pushnew '("\\.html?$" . html-mode) *auto-mode-alist* :test 'equal) ;; basic-mode (pushnew '("\\.vb$" . basic-mode) *auto-mode-alist* :test 'equal) ;; lisp-mode (add-hook '*lisp-mode-hook* #'(lambda () (define-key *lisp-mode-map* #\RET 'newline) (define-key *lisp-interaction-mode-map* #\RET 'newline))) (in-package "user") ;; php-mode (load-library "php-mode") (pushnew '("\\.php.$" . php-mode) *auto-mode-alist*) (load-library "php-misc") ;; perl-mode (pushnew '("\\.pl$" . perl-mode) *auto-mode-alist* :test 'equal) ;; jscript-mode (load-library "jscript-mode") (push '("\\.js$" . jscript-mode) *auto-mode-alist*) ;; lisp-mode (pushnew '("\\.el$" . lisp-mode) *auto-mode-alist* :test 'equal) ;; java-mdoe (pushnew '("\\.java$" . java-mode) *auto-mode-alist* :test 'equal) ;; xml-mode (require "xml/xml-mode") (use-package 'xml) (pushnew '("\\.xml$" . xml-mode) *auto-mode-alist* :test 'equal) ;;(require "xml/xhtml") ;;(require "xml/svg") ;;(require "xml/xslt") ;;(require "xml/xsl-fo") ;;(require "xml/mathml") ;;(require "xml/xlink") ;;(require "xml/relaxng") ;;(require "xml/smartdoc") ;;(require "xml/xyzref") ;;(require "xml/xi") ;;(requite "xml/xtemplate") (defun mouse-right-press () (interactive) (mouse-left-press) (paste-from-clipboard)) (global-set-key #\LBtnUp 'copy-selection-to-clipboard) (global-set-key #\RBtnUp 'mouse-right-press) (global-set-key #\MBtnUp 'mouse-menu-popup) ; ------------------------------------- ; Shell Mode ; local echo を止めるには Enter でなく Ctrl-Enter にすること。 ; ------------------------------------- (setq *eshell* "bash -i") ; ------------------------------------- ;; find-file でファイルを開いたとき、ファイルの文字コードが意図したものと違った場合に、 ;; 正しいコードに変更するには、 ;; C-u M-x revert-buffer ;; して、 文字コード ( sjis, euc-jp, jis ... ) を指定する。 ;; または、 ;; ESC ESC (revert-buffer *encoding-euc-jp*) ;; とかする。 ;; その他文字コードの指定は、*encoding-sjis*, *encoding-jis* とか。 ;; 詳しくは、encoding.l を参照するといいかも。 ;; バッファの文字コードを変換 --- C-x C-k f (change-fileio-encoding) ;; バッファの改行コードを変換 --- C-x C-k n (change-eol-code) ; ------------------------------------- ; ------------------------------------- ; 指定ディレクトリのファイルのエンコーディングを全て変換 ; ------------------------------------- (defun convert-encoding-directory (from to encoding) (setq from (namestring from)) (setq to (namestring to)) (or (and (path-equal from to) (not (yes-or-no-p "入力と出力が同じっぽいっすけどいいっすか?"))) (let (buffer) (unwind-protect (progn (do-events) (setq buffer (create-new-buffer "*foo*")) (set-buffer buffer) (set-buffer-fileio-encoding encoding) (mapc #'(lambda (f) (message "~a..." f) (erase-buffer buffer) (insert-file-contents (merge-pathnames f from)) (write-region (point-min) (point-max) (merge-pathnames f to))) (directory from :file-only t))) (and buffer (delete-buffer buffer))))) (message "done")) (defun sjis2utf (from to) (interactive "Dsjis2utf: \nDto: ") (convert-encoding-directory from to *encoding-utf8*)) (defun utf2sjis (from to) (interactive "Dutf2sjis: \nDto: ") (convert-encoding-directory from to *encoding-sjis*)) ; ------------------------------------- ;;指定ディレクトリ内のファイル文字/改行コードを一気に変換 ;; Dir: 変換するファイルのあるディレクトリ ;; Wild: *.txt とかする ;; Encoding: tab 押して適当に探す ;; with-subdir=t, without-subdir=nil: サブディレクトリを対象にするかしないか ; ------------------------------------- (defun my-conv-fileio-and-eol-code-dir (dir wild encoding eol-code recursive) (interactive "DDir: \nsWild: \nZEncoding: \nnEOL-Code(LF=0, CRLF=1, CR=2): \nSwith-subdir=t, without-subdir=nil: ") (let ((files (directory dir :wild wild :absolute t :file-only t :recursive recursive))) (set-buffer (create-new-buffer "*WORK*")) (set-default-directory dir) (dolist (file files) (erase-buffer (selected-buffer)) (ed::insert-file-contents file t) (set-buffer-file-name file) (set-buffer-fileio-encoding encoding) (change-eol-code eol-code) (set-buffer-modified-p t) (save-buffer)) (delete-buffer (selected-buffer)) )) ; ------------------------------------- ; buf2html ; ------------------------------------- (require "buf2html") (buf2html-set-app-menu) (buf2html-set-app-popup-menu) ;; (setq *buf2html-encoding* *encoding-euc-jp*) ;; (setq *buf2html-eol-code* *eol-lf*) (setq *buf2html-auto-mode-parameter-string* "Mode: html+") (setq *buf2html-date-format* "%a, %d %b %Y %H:%M:%S %Z") (setq *buf2html-time-stamp-start* "Time-stamp: <") (setq *buf2html-time-stamp-end* ">") (setq *buf2html-css-list* '("xyzzy.css" "foo.css")) (setq *buf2html-region-css-class-list* '("bgcolor" "border")) (setq *buf2html-ignore-paren-highlight* t) (setq *buf2html-anchor-url* t) (setq *buf2html-lower-case* t) (setq *buf2html-internal-css-alist* '(("A.buf2html" . ("text-decoration: none" "background: #ffe0e0")) ("A.buf2html:active" . ("background: #ffaaaa")) ("A.buf2html:hover" . ("background: #ffaaaa")))) (setq *buf2html-mode-function* 'ed::html-mode) ; ------------------------------------- ; colorprint ; ------------------------------------- (setf *temp-html-file-path* "c:/colorprint.html") (require "colorprint") ; ------------------------------------- ; paren ; ------------------------------------- (require "paren") (setq-default *paren-highlight-only-paren* t) ;;(setq-default *paren-paren-attribute* '(:underline t :bold t)) (setq-default *paren-paren-attribute* '(:bold t)) ; Fundamental モード対応 (add-hook '*fundamental-mode-hook* #'(lambda() (set-syntax-match (syntax-table) #\( #\)) (set-syntax-match (syntax-table) #\{ #\}) (set-syntax-match (syntax-table) #\[ #\]) )) (turn-on-global-paren) ; ------------------------------------- ; ruby ; ------------------------------------- (load-library "ruby-mode") (push '("\\.rb$" . ruby-mode) *auto-mode-alist*) ; インデント量を変える。nilの時はタブを挿入 (setq *ruby-indent-column* 2) ; ------------------------------------- ; scheme ; ------------------------------------- (load-library "scheme-mode") (push '(".scm$" . scheme-mode) *auto-mode-alist*) ;; 2009/10/27 2009/01/19版を使用するように変更。 ;;; 2009/10/23変更。 ;; Gauche - directly ;(setf *scheme-process-open-hook* ; #'(lambda (buffer) ; (if (buffer-process) ; (buffer-process) ; (progn ; (set-buffer buffer) ; (make-process ; (format ; nil "~A" ; (map-slash-to-backslash ; (merge-pathnames "C:/Gauche/bin/gosh.exe -i" (si:system-root))))))))) ;; 評価結果のバッファ名("*scheme run*") 10行(10) 縦分割(t) ;(setf *scheme-run-pop-to-args* '("*scheme run*" 10 t)) ; Gauche MinGW 版向け (setf *scheme-run-command* (format nil "\"~A\" -i" (map-slash-to-backslash "C:/Gauche/bin/gosh.exe"))) ; インデントをタブにしたい場合 ;(add-hook ; '*scheme-mode-hook* ; #'(lambda () ; (ed::set-buffer-local 'indent-tabs-mode nil))) ; 評価結果を別窓にしたい場合 (setf *scheme-run-pop-to-args* '("*scheme run*" 40 t))