ブラウザ(主にOpera)や
エディタ(主に秀丸やEmacs)の設定メモ
目次
today: ?
yesterday: ?
total: ?
更新履歴
2011/01/29
- .emacs.elの追加
2011/02/08
- .emacs.el,.lispの更新
- auto-completeに対応
- GNU GLOBALに対応
2011/02/08
- .emacs.el,.lispの更新
- reST (reStructuredText)に対応
- reSTのインストールの作成
Emacs 23
自分用Emacs設定
;====================================================================== ; Load path ;====================================================================== (setq load-path (append '("~/.lisp/") load-path))
;======================================================================= ;フォントや画面設定 ;======================================================================= (add-to-list 'default-frame-alist '(font . "6x13"))
(cond (window-system (set-face-attribute 'default nil :family "droid") (set-frame-font "6x13") (set-fontset-font (frame-parameter nil 'font) 'japanese-jisx0208 '("VL Gothic" . "unicode-bmp")) ))
;;; 画面色の変更 (setq initial-frame-alist (append (list '(foreground-color . "#d7d7d7");RGB(215,215,215); '(background-color . "#000019");RGB(0,0,25) '(border-color . "#000019") '(mouse-color . "#d7d7d7") '(cursor-color . "#d7d7d7") '(width . 180) '(height . 125) '(top . 50) '(left . 300)) initial-frame-alist)) (setq default-frame-alist initial-frame-alist)
;========================================================================== ; LaTeX ;========================================================================== ;;; aucTex (load "auctex.el" nil t t) (load "preview-latex.el" nil t t) ;;; 日本語 TeX 用の設定 (setq TeX-default-mode 'japanese-latex-mode) (setq japanese-TeX-command-default "pTeX") (setq japanese-LaTeX-command-default "pLaTeX") ;;; dviのViewer設定 (setq TeX-output-view-style '(("^dvi$" "." "/usr/bin/xdvi %d"))) ;;; pdfのViewer設定 (setq TeX-output-view-style '(("^pdf$" "." "/usr/bin/acroread %o"))) ;;; jsarticle を標準のクラスにする (デフォルトは jarticle) (setq japanese-LaTeX-default-style "jsarticle") ;;; preview-latex で dvipng を使う (setq preview-image-type 'dvipng)
;======================================================================= ; MaTX ;======================================================================= ;;; matx-mode ;(require 'matx-mode) (autoload 'matx-mode "matx-mode" "Major mode for editing files of MaTX mm files." t) (setq auto-mode-alist (cons' ("\\.mm$" . matx-mode) auto-mode-alist))
;======================================================================= ; Aspell ;======================================================================= ;;; ispellをより高機能なaspellに置き換える (setq-default ispell-program-name "aspell") ;;; 日本語ファイル中のスペルチェックを可能にする (eval-after-load "ispell" '(add-to-list 'ispell-skip-region-alist '("[^\000-\377]+")))
;;; Flyspell ;;; FlySpellの逐次スペルチェックを使用するモードの指定 (defun my-flyspell-mode-enable () (flyspell-mode 1)) (mapc (lambda (hook) (add-hook hook 'my-flyspell-mode-enable)) '( changelog-mode-hook text-mode-hook latex-mode-hook )) ;;; Flyspellの逐次スペルチェックをコメントにのみ使用するモード ;;; (コメントかどうかの判断は各モードによる) ;; (mapc ;; (lambda (hook) ;; (add-hook hook 'flyspell-prog-mode)) ;; '( ;; c-mode-common-hook ;; emacs-lisp-mode-hook ;; ) ;; )
;; ;;; キーバインド設定 ;; (global-set-key "\C-cW" 'sdic-describe-word-at-point)
;========================================================================== ; gnuplot ;========================================================================== ;;; gnuplot-mode (autoload 'gnuplot-mode "gnuplot" "gnuplot major mode" t) (autoload 'gnuplot-make-buffer "gnuplot" "open a buffer in gnuplot mode" t) (setq auto-mode-alist (append '(("\\.gp$" . gnuplot-mode)) auto-mode-alist))
;========================================================================== ; time-stamp ;========================================================================== ;;; 最終更新日の自動挿入 ;;; ファイルの先頭から8行いないにTime-stamp: <>または ;;; Time-stamp: " " と書いてあれば,セーブ時に自動的に日付が挿入される (require 'time-stamp)
;; 日本語で日付をいれたくないのでlocaleをCにする (defun time-stamp-with-locale-c () (let ((system-time-locale "C")) (time-stamp) nil)) (if (not (memq 'time-stamp-with-locale-c write-file-functions)) (add-hook 'write-file-functions'time-stamp-with-locale-c)) (setq time-stamp-format "%04y-%02m-%02d %02H:%02M:%02S %u")
;======================================================================= ; igrep ; http://www.emacswiki.org/emacs/igrep.el ;======================================================================= (autoload 'igrep "igrep" "*Run `grep` PROGRAM to match REGEX in FILES..." t) (autoload 'igrep-find "igrep" "*Run `grep` via `find`..." t) (autoload 'igrep-visited-files "igrep" "*Run `grep` ... on all visited files." t) (autoload 'dired-do-igrep "igrep" "*Run `grep` on the marked (or next prefix ARG) files." t) (autoload 'dired-do-igrep-find "igrep" "*Run `grep` via `find` on the marked (or next prefix ARG) directories." t) (autoload 'Buffer-menu-igrep "igrep" "*Run `grep` on the files visited in buffers marked with '>'." t) (autoload 'igrep-insinuate "igrep" "Define `grep' aliases for the corresponding `igrep' commands." t) ;; To avoid some errors. (setq igrep-program "/bin/grep") (setq igrep-find-program "/usr/bin/find")
(put 'upcase-region 'disabled nil) (put 'downcase-region 'disabled nil) (autoload 'actionscript-mode "actionscript-mode" "actionscript" t)
;======================================================================= ; プログラミング関係 ;======================================================================= ;;; Cの字下げ (add-hook 'c-mode-common-hook '(lambda () (c-set-style "GNU") (setq c-basic-offset 4)))
;;; cc-modeの設定.好みでセミコロンを外してください. (add-hook 'c-mode-hook '(lambda () (setq c-basic-offset 2) (setq tab-width 2) ; (setq c-auto-newline t) ))
;;; Compile used make command (global-set-key "\C-c\C-c" 'compile) (setq compilation-window-height 15) ;;; Comment or uncomment of region (global-set-key "\C-c;" 'comment-or-uncomment-region) ;;; Delete key (global-set-key [delete] 'delete-char) ;; ;;; Home key ;; (global-set-key [home] 'beginning-of-buffer) ;; ;;; End key ;; (global-set-key [end] 'end-of-buffer)
;======================================================================= ; GNU GLOBAL ; http://www.gnu.org/software/global/global.html ;----------------------------------------------------------------------- ; gtags.el ;----------------------------------------------------------------------- ; $ cd [ソースコードのあるトップディレクトリ] ; $ gtags -v ; GPATH, GRTAGS, GSYMS, GTAGSを確認 ;======================================================================= (require 'gtags) (setq gtags-mode-hook '(lambda () (local-set-key "\C-t" 'gtags-find-tag) ;; 関数の定義元へ移動 (local-set-key "\M-r" 'gtags-find-rtag) ;; 関数の参照元の一覧を表示 (local-set-key "\M-s" 'gtags-find-symbol) ;; 変数の定義元と参照元の一覧を表 (local-set-key "\M-t" 'gtags-pop-stack) ;; 前のバッファへ戻る ))
;;; c-modeで自動的にgtags-modeに切り替える (add-hook 'c-mode-common-hook '(lambda () (gtags-mode 1) (gtags-make-complete-list) ))
;======================================================================= ; rst-mode ; rst -> reST (reStructuredText) ; http://docutils.sourceforge.net//usr/lib/pymodules/python2.6/docutils/writers/html4css1/ ;----------------------------------------------------------------------- ; rst.el --- Mode for viewing and editing reStructuredText ; http://docutils.sourceforge.net/tools/editors/emacs/rst.el ;----------------------------------------------------------------------- ; C-c 1 (rst-compile): reStで形成されたhtmlを作る ; C-= (rst-adjust): 押すたびに状況によって見出しが == とか ~~ に切り替わる ; "*"とか"-"の後にスペース入れる ; C-c C-t (rst-toc): 見出し一覧 ; C-c 5: Operaで表示 (slides.js) ;======================================================================= (require 'rst) (setq auto-mode-alist (append '( ("\\.txt$" . rst-mode) ("\\.rst$" . rst-mode) ) auto-mode-alist)) (add-hook 'rst-mode-hook (lambda () (setq rst-slides-program "open -a Opera") ))
;======================================================================= ; 自動補完 ; http://cx4a.org/software/auto-complete/index.ja.html ;----------------------------------------------------------------------- ; ac-dict/ ; auto-complete-config.el ; auto-complete.el ; fuzzy.el ; popup.el ;======================================================================= (require 'auto-complete-config) (add-to-list 'ac-dictionary-directories "~/.lisp/ac-dict") (ac-config-default)
;======================================================================= ; ショートカットの拡張 ;======================================================================= ;; UNDO (global-set-key "\C-z" 'undo)
;; C-a, C-eの改良 ;; http://www.emacswiki.org/cgi-bin/wiki/download/sequential-command.el ;; sequential-command.el (require 'sequential-command)
(define-sequential-command seq-home back-to-indentation beginning-of-line beginning-of-buffer seq-return) (global-set-key "\C-a" 'seq-home)
(define-sequential-command seq-end end-of-line end-of-buffer seq-return) (global-set-key "\C-e" 'seq-end)
;; Emacsと別アプリとの切り貼り連携をホームポジションで (define-key global-map (kbd "C-S-w") 'clipboard-kill-ring-save) (define-key global-map (kbd "C-S-y") 'x-clipboard-yank)
;; C-hをBackspaceに変更 (global-set-key (kbd "C-h") 'delete-backward-char)
;========================================================================== ; Other setting ;========================================================================== ;;; 起動時の画面はいらない (setq inhibit-startup-message t)
;;; 時刻を表示する (display-time)
;;; 行番号を表示する (line-number-mode t)
;;; 行番号の表示 (column-number-mode t)
;;; スクロールバーを右側に表示する (set-scroll-bar-mode 'right)
;;; 対応する括弧をハイライトする。 (show-paren-mode 1)
;;; 再帰的にディレクトリのコピーや削除を行う (setq dired-recursive-copies 'always) (setq dired-recursive-deletes 'always)
;;; ウィンドウ移動 ;;(setq windmove-wrap-around t) (define-key global-map [(C shift n)] 'windmove-down) (define-key global-map [(C shift p)] 'windmove-up) (define-key global-map [(C shift b)] 'windmove-left) (define-key global-map [(C shift f)] 'windmove-right)
;;; コメントアウトと解除 (define-key global-map "\C-c;" 'comment-region) (define-key global-map "\C-c:" 'uncomment-region)
;;; ツールバーの消去 (tool-bar-mode -1)
;;; 行末のスペースを強調表示 (when (boundp 'show-trailing-whitespace) (setq-default show-trailing-whitespace t)) (face-spec-set 'trailing-whitespace '((( (class color) (background light) ) ( :foreground "red" :background "unspecified" :strike-through nil :underline t)) (t (:foreground "red" :background "unspecified" :strike-through nil :underline t))))
;;; pop up window ;;; http://d.hatena.ne.jp/m2ym/20110120/1295524932 (require 'popwin) (setq display-buffer-function 'popwin:display-buffer)
;;; yes or no -> y or n (fset 'yes-or-no-p 'y-or-n-p) ;;; [EOF]
.emacs.el
.lisp
reST (reStructuredText)のインストール
$ easy_install docutils
- emacsにrst-modeの導入
- rst.elをダウンロードし,修正
- 前
'((html . ("rst2html.py" ".html" nil))
- 後
'((html . ("rst2html" ".html" nil))
バイトコンパイルも忘れずに
- .emacs.elに以下を追加
;======================================================================= ; rst-mode ; rst -> reST (reStructuredText) ;----------------------------------------------------------------------- ; rst.el --- Mode for viewing and editing reStructuredText ; http://docutils.sourceforge.net/tools/editors/emacs/rst.el ;----------------------------------------------------------------------- ; C-c 1 (rst-compile): reStで形成されたhtmlを作る ; C-= (rst-adjust): 押すたびに状況によって見出しが == とか ~~ に切り替わる ; "*"とか"-"の後にスペース入れる ; C-c C-t (rst-toc): 見出し一覧 ; C-c 5: Operaで表示 (slides.js) ;======================================================================= (require 'rst) (setq auto-mode-alist (append '( ("\\.txt$" . rst-mode) ("\\.rst$" . rst-mode) ) auto-mode-alist)) (add-hook 'rst-mode-hook (lambda () (setq rst-slides-program "open -a Opera") ))
- HTMLファイルの作成方法
$ rst2html hoge.txt hoge.html
- 行間を広くする方法
- ファイルを開く
/usr/share/pyshared/docutils/writers/html4css1/html4css1.css
- 最終行に追加する
/* Modified by kato */ body { line-height: 1.5; }
- 作成したHTMLファイル