;;; -*- Emacs-Lisp -*- ;;; -*- coding: iso-2022-jp -*- ;;; ;;; Emacs/Mule の設定ファイル ;;; ;;; written by Masahito Ohtsuka ;;; Lastupdate: Thu Jan 13 22:57:53 2000. ;;; デバッグ (setq debag-on-error t) ;;; メールアドレス (setq user-mail-address "negi@KU3G.org") ;;; linux-version という変数に version 名を入れる (let ((buffer (get-buffer-create " *temp*"))) (set-buffer buffer) (progn (call-process "uname" nil t nil "-r") (setq linux-version (buffer-substring (point-min) (- (point-max) 1))) (kill-buffer buffer))) ;;; よく使うので明示的にロードしておく (require 'cl) ;(load-library "cl-macs") ;;; .save.. ってなファイルを作らない (setq auto-save-list-file-name nil) (setq auto-save-list-file-prefix nil) ;;; FLIM / SEMI / MULE のバージョンが漢字表示になる (setq rail-emulate-genjis t) (require 'rail) ;;; MIME 関係 (load "mime-setup") (setq mime-setup-use-signature nil) ; signature は Gnus のものを使う ;;; load-path の追加 (add-path "~/lib/elisp/20") ;;; info-path の追加 (setq Info-default-directory-list (append '("/home/negi/lib/info/" "/usr/info" "/usr/lib/emacs") Info-default-directory-list)) ;;; emacsclient を使う ;(require 'gnuserv) ;(gnuserv-start) ;;; BBDB (require 'bbdb) (require 'gnus-bbdb) (bbdb-initialize 'message) ;(bbdb-initialize 'sc) ;; 'gnus / 'Gnus ははずしてください。 (add-hook 'gnus-startup-hook 'gnus-bbdb-insinuate) (setq gnus-bbdb/decode-field-body-function (function (lambda (field-body field-name) (eword-decode-string field-body)))) (setq bbdb-north-american-phone-numbers-p nil bbdb-use-pop-up t bbdb-pop-up-target-lines 3 bbdb/mail-auto-create-p nil bbdb/news-auto-create-p nil bbdb-always-add-addresses 'never bbdb-canonicalize-redundant-nets-p nil bbdb-pop-up-elided-display '(creation-date timestamp) bbdb-user-mail-names "negi" ) (or window-system (setq bbdb-use-pop-up nil)) ;; 標準以外に収集するヘッダー・フィールド ; (setq bbdb-auto-notes-alist ; '( ; ("X-ML-Name" (".*" ML 0)) ; ("User-Agent" ("[a-zA-Z-]+" Agent 0)) ; ("X-Newsreader" ("[a-zA-Z-]+" Agent 0)) ; ("X-Mailer" ("[a-zA-Z-]+" Agent 0)) ; ("Organization" (".*" company "\\&")) ; )) ;; 登録済の人の、標準以外に収集するヘッダー・フィールドは自動的に ;; 収集するようになります。 ;(add-hook 'bbdb-notice-hook 'bbdb-auto-notes-hook) ;; Gnus のサマリー・バッファーで、登録してある人の From の前に “+” ;; が表示されるようになります。 (setq gnus-summary-line-format "%U%R%z%I%(%[%4L:%ub %-20,20n%]%) %s\n") ;;; 引用パッケージ mu-cite の設定 (autoload 'mu-cite-original "mu-cite" nil t) (add-hook 'mail-citation-hook (function mu-cite-original)) (setq message-cite-function (function mu-cite-original)) (add-hook 'mu-cite-load-hook (function (lambda () (require 'mu-bbdb) ))) (setq cited-prefix-regexp "^[^ \t>]*[>]*[ \t##]*[:||]?[ \t##]?") ;; message の Alt + RET は SuperCite 専用のようなので胡麻化す (defun sc-cite-regexp () cited-prefix-regexp) (setq mu-cite-top-format '(">>>>> " id " において\n" ">>>>> “" prefix-register-verbose "”= " full-name " 様曰く\n")) ;;; latex-math-symbol (autoload 'latex-math-decode-buffer "latex-math-symbol" nil t) (add-hook 'mime-viewer/plain-text-preview-hook 'latex-math-decode-buffer) ;;; インデントを綺麗に (autoload 'gin-mode "gin-mode" "Guess INdent mode" t) (setq gin-left-hang-indent-re "\\s *\\([-*]\\|(\\([a-zA-Z0-9]\\|\\cj\\))\\|(\\([a-zA-Z0-9]|\\cj\\))\\.?:]?\\)\\s +" ) (setq gin-retain-indent-re "\\([-.a-zA-Z0-9]\\|\\cj\\)*>+[ \t]*\\|[ \t]+" ) (add-hook 'message-mode-hook '(lambda () (set-buffer-file-coding-system 'junet-unix) (gin-mode 1) )) ;;; hilit19 ;(if window-system ; (progn ; (setq hilit-mode-enable-list ; '(yatex-mode yahtml-mode) ; hilit-background-mode 'dark) ; 暗い画面の設定 ; hilit-inhibit-hooks nil ; hilit-inhibit-rebinding nil) ; (set-face-foreground 'highlight "black") ; (set-face-foreground 'secondary-selection "black") ; (require 'hilit19) ; (hilit-translate msg-quote 'green) ; (hilit-translate msg-from 'magenta) ; )) ;;; フレームその他 (if window-system (progn (set-face-foreground 'region "white") (set-face-background 'region "dim gray") (set-face-foreground 'modeline "yellow") (set-face-background 'modeline "blue") (setq default-frame-alist (append '((width . 80) (height . 30) (font . "fontset-16")) default-frame-alist)) )) ;;; 漢字コード (set-language-environment "Japanese") (set-default-coding-systems 'japanese-iso-8bit-with-esc) ;(set-default-coding-systems 'euc-japan) (set-keyboard-coding-system 'euc-japan-1990-unix) (set-terminal-coding-system 'euc-japan-1990-unix) (setq default-buffer-file-coding-system 'euc-japan-1990-unix) ; (setq process-coding-system-alist ; (append ; '(("look" . euc-japan) ; ("nkf" . junet) ; ("kingtr" . sjis) ; ("*.tex$" . euc-japan)) ; process-coding-system-alist)) ;(modify-coding-system-alist 'file "\\.txt\\'" 'sjis-dos) ;;; 圧縮ファイルを読む (auto-compression-mode 1) ;;; Abbrev (setq-default abbrev-mode t) (read-abbrev-file "~/.abbrev_defs") (setq save-abbrebs t) ;; タイトルバーの設定 (setq frame-title-format "Emacs:%b") ;; バックアップは作らない ;(setq make-backup-files nil) ;; コンパイル画面はあんまりとらない ;(setq compilation-window-height 5) ;; カーソル位置に貼り付け (setq mouse-yank-at-point t) ;; 行数と桁を表示( Emacs-19.30 以降は多分必要ない) (line-number-mode 1) ;; C-k で, 改行も同時に削除 (setq kill-whole-line t) ;; メジャーモード ;(setq default-major-mode 'text-mode) ;; 引用マークは > (setq mail-yank-prefix ">") ;; プリンタの設定 (setq lpr-command "lpr" lpr-page-header-program "pr" lpr-page-header-switches '("-f" "-o 6" "-w 80" "-l 70") ps-lpr-command "lpr" ps-lpr-switches '("-Pps") ps-paper-type 'ps-a4 ps-print-header nil) ;; リージョンを色付きで ;(setq transient-mark-mode t) ;; 常にフォントロックモード (if window-system (global-font-lock-mode t)) ;; ビジブルベル ;(setq visible-bell t) ;;; ガーベージコレクションを減らす ;(setq gc-cons-threshold 1000000) ;;; dired-x を使う (require 'dired-x) ;;; 以前セーブしたファイルのカーソル位置を記録 (require 'saveplace) (setq-default save-place t) ;;; 横スクロールさせる ;(hscroll-global-mode) ;;; 対応する括弧を目立たせる (require 'paren) ;;; ジャンプスクロールの幅 ;(setq scroll-step 4) ;;; スクロールバーは右側に (set-scroll-bar-mode 'right) ;;; キーバインドの設定 (global-set-key "\C-x?" 'help-for-help) (global-set-key "\C-h" 'backward-delete-char) (global-set-key "\C-\\" 'advertised-undo) (global-set-key "\M-g" 'goto-line) (global-set-key "\C-m" 'newline-and-indent) ;(global-set-key "\C-x\C-c" 'server-edit) (global-set-key "\M- " 'expand-abbrev) ;(global-set-key [f10] 'save-buffers-kill-emacs) (global-set-key [S-right] 'forward-word) (global-set-key [S-left] 'backward-word) (global-set-key [delete] 'delete-char) (global-set-key [S-mouse-2] 'browse-url-at-mouse) (global-set-key [kanji] 'canna-henkan-region) ;(global-set-key [f11] ; (lambda () (interactive) (insert (current-time-string)))) (global-set-key [f11] 'call-last-kbd-macro) (global-set-key [f12] 'next-error) ;(define-key fence-mode-map "\C-h" 'fence-backward-delete-char) ;(define-key henkan-mode-map "\C-h" 'henkan-quit) (or window-system (progn (global-set-key [kp-7] 'beginning-of-buffer) (global-set-key [kp-1] 'end-of-buffer))) (global-set-key "\C-cg" 'gnus) ;;; windows.el (require 'windows) ;(win:startup-with-window) (if window-system (setq win:use-frame nil)) ; フレームは使わない ;(define-key ctl-x-map "C" 'see-you-again) ;(setq win:mouse-position (-5 -5)) ;(autoload 'win-switch-to-window "windows" "Switch window." t) ;(define-key global-map "\C-c\C-w1" 'win-switch-to-window) ;(define-key global-map "\C-c1" 'win-switch-to-window) ;(define-key ctl-x-map "C" 'see-you-again) ;;; Canna ;(setq canna-with-fences ; (not (setq canna-underline t))) ;(load-library "canna") ;(canna) ;;; egg ;(setq enable-double-n-syntax t) ;(set-egg-fence-mode-format "" "" 'underline) ;; SKK (setq skk-byte-compile-init-file nil) (setq skk-background-mode 'dark) (global-set-key "\C-x\C-j" 'skk-mode) (global-set-key [Kanji] 'skk-mode) (global-set-key "\C-xj" 'skk-auto-fill-mode) (global-set-key "\C-xt" 'king::translation-region) (autoload 'skk-mode "skk" nil t) (autoload 'skk-tutorial "skk-tut" nil t) (autoload 'skk-check-jisyo "skk-tools" nil t) (autoload 'skk-merge "skk-tools" nil t) (autoload 'skk-diff "skk-tools" nil t) (autoload 'skk-isearch-mode-setup "skk-isearch" nil t) (autoload 'skk-isearch-mode-cleanup "skk-isearch" nil t) (add-hook 'isearch-mode-hook (function (lambda () (and (boundp 'skk-mode) skk-mode (skk-isearch-mode-setup))))) (add-hook 'isearch-mode-end-hook (function (lambda () (and (boundp 'skk-mode) skk-mode (skk-isearch-mode-cleanup))))) (add-hook 'minibuffer-setup-hook (function (lambda () (if (and (boundp 'skk-henkan-okuri-strictly) skk-henkan-okuri-strictly (not (eq last-command 'skk-purge-jisyo)) ) (progn (setq skk-henkan-okuri-strictly nil) (put 'skk-henkan-okuri-strictly 'temporary-nil t) ))))) (add-hook 'minibuffer-exit-hook (function (lambda () (if (get 'skk-henkan-okuri-strictly 'temporary-nil) (progn (put 'skk-henkan-okuri-strictly 'temporary-nil nil) (setq skk-henkan-okuri-strictly t) ))))) ;(setq skk-large-jisyo "/usr/local/share/skk/SKK-JISYO.L") ;(skk-mode 1) ;;; モードリスト (setq auto-mode-alist (append '(("\\.tex$" . yatex-mode) ("\\.C$" . c++-mode) ("\\.cc$" . c++-mode) ("\\.c$" . c-mode) ("\\.cgi$" . perl-mode) ("\\.h$" . c-mode) ("\\.m$" . objc-mode) ("\\.java$" . java-mode) ("\\.html$" . sgml-mode) ("\\.htm$" . sgml-mode) ("\\.shtml$" . sgml-mode) ("\\.spec$" . sh-mode) ("/home/negi/memo/" . text-mode)) auto-mode-alist )) ;;; c-mode (autoload 'c++-mode "cc-mode" "C++ Editing Mode" t) (autoload 'c-mode "cc-mode" "C Editing Mode" t) (autoload 'objc-mode "cc-mode" "Objective-C Editing Mode" t) (autoload 'java-mode "cc-mode" "Java Editing Mode" t) (setq c-tab-always-indent t) (setq c-default-style "bsd") (setq c-block-comments-indent-p 3) (add-hook 'c-mode-hook '(lambda () (auto-fill-mode 1) (local-set-key "\C-c\C-c" 'compile) (local-set-key "\C-c\C-d" 'gdb) )) ;;; Text-mode (add-hook 'text-mode-hook '(lambda () (auto-fill-mode 1) (make-local-variable 'fill-column) (make-local-variable 'tab-stop-list) (setq fill-column 64 tab-stop-list '(4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80)) (add-hook 'local-write-file-hooks '(lambda () (if (string-match "\\.txt?$" (buffer-name)) (set-buffer-file-coding-system 'sjis-dos)) ;; *.txt は DOS 型式で保存 (trim-eob) (trim-buffer))))) ;;; YaTeX/YaHTML (put 'yatex-mode 'font-lock-defaults 'tex-mode) (autoload 'yatex-mode "yatex" "Yet Another TeX mode" t) (modify-coding-system-alist 'process ".*tex$" 'euc-japan) (setq YaTeX-kanji-code 3 ; EUC japan YaTeX-create-file-prefix-g t YaTeX-template-file "~/lib/template/template.tex" tex-command "platex" dvi2-command "xdvi -s 4 -paper a4" dviprint-command-format "dvips %f %t %s | lpr" dviprint-from-format "-p %b" dviprint-to-format "-l %e") ;;; trr (autoload 'trr "trr" nil t) ;(setq TRR:correct-color-name "cyan") ;(setq TRR:graph-color-name "yellow") ;;; seimei (autoload 'seimei "seimei" nil t) ;;; FVWM-mode (autoload 'fvwm-mode "fvwm-mode" nil t) (add-hook 'fvwm-mode-hook (lambda () (local-set-key "\t" 'indent-relative))) ;;; browse-url (autoload 'browse-url-interactive-arg "browse-url") (autoload 'browse-url-browser-function "browse-url" "Ask a WWW browser to show a URL." t) (autoload 'browse-url-at-point "browse-url" "Ask a WWW browser to load the URL at or before point." t) (autoload 'browse-url-at-mouse "browse-url" "Ask a WWW browser to load a URL clicked with the mouse." t) (autoload 'browse-url-of-buffer "browse-url" "Ask a WWW browser to display BUFFER." t) (autoload 'browse-url-of-file "browse-url" "Ask a WWW browser to display FILE." t) (autoload 'browse-url-of-dired-file "browse-url" "In Dired, ask a WWW browser to display the file named on this line." t) (setq browse-url-browser-function 'browse-url-netscape) ; (setq browse-url-browser-function 'browse-url-w3) (setq browse-url-new-window-p t) ;;; GNUPLOT-mode (autoload 'gnu-plot-mode "gnuplot" nil t) ;;; sdic (autoload 'sdic "sdic" "英単語の意味を調べる" t nil) (global-set-key "\C-xw" 'sdic) (setq sdic-face-color "khaki") ;;; irchat (require 'cfirchat) (setq cfirchat-bell-keyword '("ねぎ" "ネギ" "おおつか" "大塚" "NegI" "NegI")) (autoload 'irchat "irchat" "GNUemacs IRC client." t) (setq irchat-pj-use-smiley nil) (add-hook 'irchat-Command-mode-hook '(lambda () (font-lock-mode 0))) (setq cfirchat-keywords-default '( ;; mymsg ((aquamarine) (cfirchat-mymsg-regexp)) ;; system ((pink italic) ("^[0-9][0-9]:[0-9][0-9] \\([^><(= \t\n].*\\)$" 1)) ;; system-mode ((pink bold) ("^[0-9][0-9]:[0-9][0-9] New mode for [%#]\\S + set by \\S +: \\(.*\\)$" 1) ("^[0-9][0-9]:[0-9][0-9] New topic on [%#]\\S + set by \\S +: \\(.*\\)$" 1) ("^[0-9][0-9]:[0-9][0-9] Topic for [%#]\\S +\\( ([0-9]+ users)\\)?: \\(.*\\)$" 2)) ;; server message ((white italic) ("^[0-9][0-9]:[0-9][0-9] \\(\\*\\*\\* .*\\)$" 1)) ;; priv ((yellow) ("^[0-9][0-9]:[0-9][0-9] \\(=[^= \t\n]+=\\)" 1)) ;; URL ((HotPink bold underline) (cfirchat-url-regexp)) ;; time ((SlateBlue1) ("^\\([0-9][0-9]:[0-9][0-9]\\) " 1)) ;; NegI ((red bold invert underline) ("ねぎ") ("ネギ") ("大塚") ("おおつか") ("<[^>< \t\n]+>.*\\(negi[0-9A-Za-z-_]*\\)" 1)) ;; nick ((pink) ("^[0-9][0-9]:[0-9][0-9] \\(<[^>< \t\n]+>\\) " 1) ("^[0-9][0-9]:[0-9][0-9] \\(([^)( \t\n]+)\\) " 1)) )) ;;; TiMidyty (autoload 'timidity "timidity" "TiMidity Interface" t) (setq timidity-prog-path "/usr/local/bin/timidity") ;; 書き込む時のフック (add-hook 'write-file-hooks (lambda () ;; (trim-eob) ;; (trim-buffer) (lastupdate-file))) ;;; 色々関数 (defun trim-region (start end) "リージョン中の行末の無駄な空白を消去" (interactive "r") (save-excursion (save-restriction (narrow-to-region start end) (goto-char start) (replace-regexp "[ \t]+$" "") ))) (defun trim-eob nil "バッファの最後に溜った空行を消去" (interactive) (save-excursion (progn (goto-char (point-max)) (delete-blank-lines) nil))) (defun trim-buffer nil "バッファ中の行末の無駄な空白を消去" (interactive) (save-excursion (mark-whole-buffer) (trim-region (region-beginning) (region-end)) )) (defun lastupdate-file nil "Lastupdate: という文字列を見付けると新しい日付を挿入する" (interactive) (let ((tostr (concat "Lastupdate: " (current-time-string) "."))) (save-excursion (goto-char (point-min)) (while (re-search-forward "\\Lastupdate\\([A-Za-z0-9: ]*\\)?\\." nil t) (replace-match tostr nil t))) )) ;;; スクリプトの場合,実行属性を付ける (defun add-executable-attribute () (save-restriction (widen) (and (string= "#!" (buffer-substring 1 (min 3 (point-max)))) (let* ((name (buffer-file-name)) (mode (file-modes name))) (if (not (string-match "/\\.[^/]+$" name)) (progn (set-file-modes name (logior mode (logand (/ mode 4) 73))) (message (concat "Wrote " name " (+x)")))) )))) (mapcar '(lambda (mode-list) (add-hook mode-list '(lambda () (make-local-hook 'after-save-hook) (add-hook 'after-save-hook 'add-executable-attribute nil t)))) '(sh-mode-hook perl-mode-hook awk-mode-hook)) ;;; x-face (autoload 'x-face-encode "x-face" "Generate X-Face string(s) from xbm file." t) (autoload 'x-face-insert "x-face" "Insert X-Face fields." t) (autoload 'x-face-save "x-face" "Save X-Face fields to files." t) (autoload 'x-face-view "x-face" "View X-Face fields." t) (autoload 'x-face-ascii-view "x-face" "View X-Face fields as ascii pictures." t) ;;; x-face-mule (require 'x-face-mule) (setq x-face-mule-highlight-x-face-position 'from x-face-mule-force-save-cache-file t x-face-default-xbm-file "negi.xbm" x-face-mule-use-cache-file nil) ;;; find-func - 関数のソースを表示 ;; C-xF で起動 (find-function-setup-keys) ;;; eqn2eps TeX の数式から EPS ファイルを生成 (autoload 'eqn2eps "eqn2eps" "equation to eps" t) (autoload 'eqn2eps-region "eqn2eps" "equation to eps" t) ;(setq eqn2eps-mag "2000") ;;; auto-insert (require 'autoinsert) (add-hook 'find-file-hooks 'auto-insert) (setq auto-insert-directory "~/lib/template/") (setq auto-insert-alist (append '(("\\.spec" . "template.spec") ("\\.html" . "template.html")) auto-insert-alist)) ;; mpg123 (add-hook 'mpg123-load-hook (load "id3")) (autoload 'mpg123 "mpg123" nil t) (setq mpg123-startup-volume 80) ;; super-smart-find (require 'super-smart-find) (define-key global-map "\C-x\C-f" 'super-smart-find-file) (define-key global-map "\C-x4f" 'super-smart-find-file-other-window) (define-key global-map "\C-xi" 'super-smart-find-insert-file) (define-key global-map "\C-x\C-w" 'super-smart-find-write-file) (define-key global-map "\C-x5f" 'super-smart-find-file-other-frame) (define-key global-map "\C-x4l" 'super-smart-find-load-file) (add-hook 'mime-edit-load-hook (lambda () (define-key mime-edit-mode-map "\C-c\C-x\C-i" 'super-smart-find-mime-edit-insert-file) (put-alist 'file '("Insert File" super-smart-find-mime-edit-insert-file) mime-edit-menu-list) ) t) (setq smart-find-file-path '( "~" "~/memo" "~/src" "~/work" "~/work/rpm/SPECS" )) ;; use UTF-8 ;(require 'un-sample) (require 'un-tools) ;; namazu (autoload 'namazu "namazu" nil t) (setq namazu-default-dir "/home/negi/lib/namazu/memo") ;; PSGML (autoload 'sgml-mode "psgml" "Major mode to edit SGML files" t) (require 'html-helper-mode) (add-hook 'sgml-mode-hook '(lambda () (make-local-variable 'fill-column) (setq fill-column 76))) ;; DOCTYPE 宣言の設定 (setq sgml-custom-dtd '(("HTML" "") ("HTML 3.2" "") ("HTML 4" "") )) (setq sgml-catalog-files '("CATALOG" "/home/negi/lib/sgml/CATALOG") ;; sgml-ecat-files '("ECAT" "/home/negi/lib/sgml/ECAT") sgml-display-char-list-filename "/home/negi/lib/sgml/iso88591.map" sgml-indent-data t sgml-indent-step 1) ; (setq sgml-set-face t) ; (setq sgml-markup-faces ; '((start-tag . font-lock-type-face) ; (end-tag . font-lock-type-face) ; (comment . font-lock-comment-face) ; (ignored . font-lock-comment-face) ; (pi . font-lock-keyword-face) ; (sgml . font-lock-keyword-face) ; (doctype . font-lock-constant-face) ; (entity . font-lock-string-face) ; (shortref . bold)))