; ".emacs" for sheep by S.K. ; Last modified '96/07/21 ; ;(setq display-time-day-and-date t) (display-time) ; ステータスバーに時刻を表示する (setq scroll-step 1) (setq default-tab-width 4) ; タブ幅(タブストップ)を4 に設定 (setq mail-self-blind t) ; メイルを出した場合に、Bcc で控えを自分へ自動送付 (setq dired-listing-switches "-al") (setq next-screen-context-lines 1) ; MULE 特有で、Nemacs にない設定では次のように cond とboundp を用いる ; のが常套手段 (cond ((boundp 'MULE) (scroll-bar-mode -1))) ; スクロールバーを消す (cond ((boundp 'MULE) (line-number-mode 1)) ) ; ステータスバーへ現在行番号表示 (cond ((boundp 'MULE) (setenv "LANG" "c"))) ; 日本語設定でdired 誤動作を抑制 ; lisp ディレクトリの追加 ; 次のように自分の環境でのlisp ファイルディレクトリをデフォルトに追加する (setq load-path (cons (expand-file-name "/usr2/local/elisp") load-path)) (setq load-path (cons (expand-file-name "~/elisp") load-path)) (cond ((boundp 'MULE) (progn (defun previous-line (arg) (interactive "p") (condition-case nil (line-move (- arg)) (beginning-of-buffer)))))) ;バッファの最後でカーソルが新しい行へ行かないようにする (cond ((boundp 'MULE) (setq next-line-add-newlines nil))) ;===== for GLOG ==== GLOG というelisp パッケージのための設定 (autoload 'glog "glog" "View BBS log mode." t) (autoload 'glog-view-file-mode "glog" "view file as BBS log." t) (autoload 'glog-view-buffer-mode "glog" "view buffer as BBS log." t) (autoload 'glog-batch-view "glog" "like viewer." t) (global-set-key "\M-L" 'glog) ;; GLOG起動 (global-set-key "\M-R" 'glog-resume) ;; PAUSE状態からの復帰 ;==== GLOG end ==== ; MULE ウィンドウで動作している場合はカラー表示を行なう (cond ((boundp 'MULE) (cond ((eq window-system 'x) (load "hilit19")) ) ) ) ; 漢字コードの設定 (cond ((boundp 'MULE) (set-display-coding-system *euc-japan*)) ) (cond ((boundp 'MULE) (set-default-file-coding-system *euc-japan*)) ) (cond ((boundp 'MULE) (set-keyboard-coding-system *euc-japan*)) ) ;(if (boundp 'NEMACS) ; (progn ; (define-program-kanji-code nil ".*scan.*" 2) ; (define-program-kanji-code nil ".*inc.*" 2) ; ) ;) ;(setq text-mode-hook ; '(lambda () (auto-fill-mode 1))) (setq mail-mode-hook '(lambda () (setq kanji-fileio-code 2) ; for Nemacs (if (boundp 'MULE) (set-file-coding-system *junet*)))) (cond ((boundp 'NEMACS) (setq default-kanji-fileio-code 3)) ) (cond ((boundp 'NEMACS) (setq kanji-input-code 3)) ) (cond ((boundp 'NEMACS) (setq default-kanji-expected-code 3)) ) (cond ((boundp 'NEMACS) (setq default-kanji-process-code 3)) ) ;; supercite 3.1 ;(cond ((boundp 'MULE) ; ((autoload 'sc-cite-original "supercite" "Supercite 3.1" t) ; (autoload 'sc-submit-bug-report "supercite" "Supercite 3.1" t) ; (add-hook 'mail-citation-hook 'sc-cite-original) ; (add-hook 'mh-yank-hooks 'sc-cite-original) ; (setq sc-electric-references-p nil) ; (setq sc-preferred-header-style 1) ; (setq sc-citation-leader "") ; (setq sc-reference-tag-string ">> ") ; (setq sc-nested-citation-p t)))) ; MH のプログラムとやりとりする場合の文字コードをJIS に指定 (if (boundp 'MULE) (progn (define-program-coding-system nil ".*scan.*" (cons *junet* *junet*)) (define-program-coding-system nil ".*inc.*" (cons *junet* *junet*)) ) ) ; 自動的に作成されるバックアップファイルを、# や ~ をつけずそのままの名前で ; ~/backup というディレクトリの下に作成するようにする (setq backup-by-copying t) (fset 'make-backup-file-name '(lambda (file) (concat (expand-file-name "~/backup/") (file-name-nondirectory file)) )) ;(setq auto-mode-alist ; (cons '("\.h$" . text-mode) auto-mode-alist)) ;(setq auto-mode-alist ; (cons '("\.c$" . text-mode) auto-mode-alist)) ; 次の行との間に1行空行を作成し、その行頭へ移動するマクロ (defun my-insert-line() (interactive) (end-of-line) (open-line 1) (forward-char 1)) ; 簡単なブックマーク機能を実現するタコなマクロ ; lisp 勉強不足でスマートに書けない (^^;) ;== point manager support == 1994/06/06 ;== point manager support Ver2.0 == 1995/10/17 also memories buffer name (defvar ma) (defvar mb) (defvar mc) (defvar md) (defvar me) (defvar mx) (defvar my) (defvar ma_bufname) (defvar mb_bufname) (defvar mc_bufname) (defvar md_bufname) (defvar me_bufname) (defvar mx_bufname) (defvar my_bufname) (defun memory-point-1shot () (interactive) (setq mx (point)) (setq mx_bufname (current-buffer)) (message "point memoried to mx") ) (defun memory-jump-1shot () (interactive) (setq my (point)) (setq my_bufname (current-buffer)) (switch-to-buffer mx_bufname) (goto-char mx) (message "Jump back to mx") ) (defun memory-point (as) (interactive "smemory to(a -- e): ") (cond ((string-equal as "a") (setq ma (point)) ; (setq ma_bufname (buffer-name)) (setq ma_bufname (current-buffer)) ) ((string-equal as "b") (setq mb (point)) (setq mb_bufname (current-buffer)) ) ((string-equal as "c") (setq mc (point)) (setq mc_bufname (current-buffer)) ) ((string-equal as "d") (setq md (point)) (setq md_bufname (current-buffer)) ) ((string-equal as "e") (setq me (point)) (setq me_bufname (current-buffer)) ) ) (message "point memoried to m%s." as) ) (defun memory-jump (where) (interactive "sWhere to jump(a -- e): ") (cond ((string-equal where "a") (progn (switch-to-buffer ma_bufname) (goto-char ma) ) ) ((string-equal where "b") (progn (switch-to-buffer mb_bufname) (goto-char mb) ) ) ((string-equal where "c") (progn (switch-to-buffer mb_bufname) (goto-char mc) ) ) ((string-equal where "d") (progn (switch-to-buffer mb_bufname) (goto-char md) ) ) ((string-equal where "e") (progn (switch-to-buffer mb_bufname) (goto-char me) ) ) ((string-equal where "x") (progn (switch-to-buffer mb_bufname) (goto-char mx) ) ) ((string-equal where "y") (progn (switch-to-buffer mb_bufname) (goto-char my) ) ) ) ) ;(defun jump-point (to) ; (interactive "jump to(ma -- me): ") ; (goto-char to)) ; マイフェスみたいにファンクションキーで指定範囲行のコピー・カット&ペースト ; を実現するための仕組み ;== mifes-like cut and paste support by S.K. == (defvar line-st) (defvar line-ed) (defun line-copy-start () (interactive) (beginning-of-line) (setq line-st (point))) (defun line-cut-end () (interactive) (end-of-line) (setq line-ed (point)) (kill-region line-st line-ed) (delete-char 1)) (defun line-copy-end () (interactive) (end-of-line) (setq line-ed (point)) (copy-region-as-kill line-st line-ed)) (defun my-yank () (interactive) (end-of-line) (open-line 1) (forward-char 1) (yank)) ; list-buffers マクロは、カレントバッファと違うバッファにリストを出すのが ; イヤなので、次のマクロでカレントバッファにリストを出すようにする (defun my-list-buffers () (interactive) (other-window -1) (list-buffers) (other-window 1)) ; カッコの場所にカーソルがある場合に、vi みたいに % キーを押すとカッコの ; 対応をチェックするマクロ ; Here is some Emacs Lisp that will make the % key show the matching ; parenthesis, like in vi. In addition, if the cursor isn't over a ; parenthesis, it simply inserts a % like normal. (global-set-key "%" 'match-paren) (defun match-paren (arg) "Go to the matching parenthesis if on parenthesis otherwise insert %." (interactive "p") ; (cond ((looking-at "\\s\(") (forward-list 1) (backward-char 1)) ; ((looking-at "\\s\)") (forward-char 1) (backward-list 1)) (cond ((looking-at "[([{]") (forward-sexp 1) (backward-char)) ((looking-at "[])}]") (forward-char) (backward-sexp 1)) (t (self-insert-command (or arg 1))))) ;xxx (setq initial-major-mode 'text-mode) <- make default-tab-width reset!! ;xxx (setq default-major-mode 'text-mode) <- make default-tab-width reset!! ;==== Ctrl/Alt キーとキャラクタキー組合せに機能を設定 ==== (global-unset-key "\C-h") ;(global-unset-key "\C-?") (global-set-key "\C-h" 'delete-backward-char) ;(global-set-key "\C-?" 'delete-char) (global-set-key "\C-d" 'dired) (global-set-key "\C-j" 'goto-line) (global-set-key "\M-?" 'help-for-help) (global-set-key "\M-c" 'compile) (global-set-key "\M-j" 'memory-jump) (global-set-key "\M-/" 'memory-jump-1shot) (global-set-key "\M-o" 'my-insert-line) (global-set-key "\M-s" 'tags-search) (define-key c-mode-map "\C-?" 'delete-char) ; C ソースを書く場合の設定 (setq c-auto-newline nil) (setq c-indent-level 4) (setq c-continued-statement-offset 0) ;; (setq-default c-brace-offset 0) ;; (setq-default c-continued-brace-offset -4) (setq c-brace-imaginary-offset 0) ;; (setq-default c-argdecl-indent 4) ;; (setq-default c-label-offset -2) ;; (setq-default fill-column 75) (setq-default c-tab-always-indent nil) (put 'eval-expression 'disabled nil) ; gnus でニュースを読む時の捕捉設定 (autoload 'gnus "gnus" "Read network news." t) (autoload 'gnus-post-news "gnuspost" "Post a new news." t) (setq gnus-nntp-server "news.aix.or.jp") (setq gnus-your-organization "ASCII Internet Service Tokyo, Japan.") (setq gnus-your-domain "aix.or.jp") (setq gnus-use-generic-from t) ;; (load "egg-sun-keymap") ;;(if (equal 'MULE nil); (if (boundp 'NEMACS) (defrule "nn" "ん") ) (if (boundp 'NEMACS) (defrule "dhi" "ディ")) (if (boundp 'NEMACS) (defrule "thi" "ティ")) (if (boundp 'NEMACS) (defrule "dhu" "デュ")) ; next line brings error in sheep's MULE environment ????? ;(if (boundp 'MULE) (its-define-mode "roma-kana" "$"" nil)) ; needed! ;;(if (boundp 'MULE) (its-defrule "nn" "$s" nil nil "roma-kana")) (if (boundp 'MULE) (setq enable-double-n-syntax t)) ; nn で "ん" と認識 (if (boundp 'MULE) (its-defrule "dhi" "ディ" nil nil "roma-kana")) (if (boundp 'MULE) (its-defrule "thi" "ティ" nil nil "roma-kana")) (if (boundp 'MULE) (its-defrule "dhu" "デュ" nil nil "roma-kana")) ; かな変換モードでのキー操作定義 (define-key fence-mode-map "\C-h" 'fence-backward-delete-char) (define-key fence-mode-map "\C-?" 'fence-delete-char) (define-key fence-mode-map "\C-j" 'henkan-fence-region) (define-key fence-mode-map "\C-k" 'fence-katakana) ; キーボードの特殊キーをアプリケーションモードに設定する (send-string-to-terminal "\e=") ; set application keypad mode ;==== カーソルキー, テンキーの機能割り付け ==== ; 特殊キーを押した場合に送られる特殊文字列を認識するための仕組みを定義 (defvar sun-rkeymap (make-keymap)) (fset 'sun-rprefix sun-rkeymap) (define-key global-map "\eO" 'sun-rprefix) (define-key sun-rkeymap "A" 'previous-line) ;up 上矢印キーでカーソルアップ (define-key sun-rkeymap "w" 'other-window) ;HOME キーで別ウィンドジャンプ (define-key sun-rkeymap "B" 'next-line) ;down 下矢印キー (define-key sun-rkeymap "C" 'forward-char) ;right 右矢印キー (define-key sun-rkeymap "D" 'backward-char) ;left 左矢印キー (define-key sun-rkeymap "t" 'beginning-of-line) ;10key left(4) (define-key sun-rkeymap "v" 'end-of-line) ;10key right(6) (define-key sun-rkeymap "r" 'scroll-other-window);10key down(2)別ウィンドscroll (define-key sun-rkeymap "x" 'enlarge-window) ;10key up(8) 現在ウィンド拡大 (define-key sun-rkeymap "U" 'beginning-of-buffer);10key HOME(7) (define-key sun-rkeymap "?" 'end-of-buffer) ;10key EMD(1) ;==== ファンクションキーの機能割り付け ==== ; ファンクションキーを押した場合に送られる特殊文字列を認識するための仕組み定義 (defvar sun-fkeymap (make-keymap)) (fset 'sun-fprefix sun-fkeymap) (define-key global-map "\e[" 'sun-fprefix) ;(define-key sun-fkeymap "[" 'backward-paragraph) ; old \e[ assignment (define-key sun-fkeymap "3~" 'delete-char) ;TeratermPro DEL key (define-key sun-fkeymap "4~" 'other-window) ;TeratermPro HOME key (define-key sun-fkeymap "5~" 'scroll-down) ;Page Up (define-key sun-fkeymap "6~" 'scroll-up) ;Page Down ;(define-key sun-fkeymap "11~" 'change-fileio-code) ; F1 (define-key sun-fkeymap "11~" 'fence-katakana) ; F1 (define-key sun-fkeymap "12~" 'my-list-buffers) ; F2 ;(define-key sun-fkeymap "13~" 'jis-code-input) ; F3 (define-key sun-fkeymap "13~" 'memory-point) ; F3 (define-key sun-fkeymap "14~" 'toroku-region) ; F4 漢字変換 単語辞書登録 ;(define-key sun-fkeymap "15~" 'zenkaku-region) ; F5 (define-key sun-fkeymap "15~" 'memory-point-1shot) ; F5 ;(define-key fence-mode-map "17~" 'fence-katakana); F6 (define-key sun-fkeymap "17~" 'katakana-region); F6 ;(define-key sun-fkeymap "18~" 'line-cut-end) ; F7 ; 諸般の事情で、Ctrl-\ と同じ機能(かな漢字変換モードトグル)をF7 にも割り付け (cond ((boundp 'NEMACS)(define-key sun-fkeymap "18~" "\C-\\")) ); F7 ; etags でタグファイルを作成している場合に、C のソースの関数名のところでF8 ; キーを押すと別ウィンドにその関数のソースを開き、カーソルを関数定義場所へ移動 (define-key sun-fkeymap "19~" 'find-tag-other-window); F8 (define-key sun-fkeymap "20~" 'line-copy-start) ; F9 MIFES のF6 ;(define-key sun-fkeymap "21~" 'henkan-region) ; F10 (define-key sun-fkeymap "21~" 'line-cut-end) ; F10 MIFES のF7 (define-key sun-fkeymap "22~" 'line-copy-end) ; --- (define-key sun-fkeymap "23~" 'line-copy-end) ; F11 MIFES のF8 (define-key sun-fkeymap "24~" 'my-yank) ; F12 MIFES のF9 ; Emacs にはtoggle-read-only という機能があり、これで一時的な編集ロックが ; On/Off できます。うっかり変なキー操作をしても、ロックしていれば大丈夫。 ; 私はこの機能をインサートキーに張り付けています。 (define-key sun-fkeymap "2~" 'toggle-read-only) ; Insert ;(define-key sun-fkeymap "O" 'other-window) ; HOME ; MULE の場合は次のようにファンクションキー設定するのが正しい (if (boundp 'MULE) (global-set-key [home] 'other-window)) ; MIFES と同じ (if (boundp 'MULE) (global-set-key [f1] 'change-fileio-code)) (if (boundp 'MULE) (global-set-key [f2] 'my-list-buffers)) (if (boundp 'MULE) (global-set-key [f3] 'memory-point)) (if (boundp 'MULE) (global-set-key [f4] 'toroku-region)) (if (boundp 'MULE) (global-set-key [f5] 'memory-point-1shot)) (if (boundp 'MULE) (global-set-key [f6] 'katakana-region)) (if (boundp 'MULE) (global-set-key [f7] "\C-\\")) (if (boundp 'MULE) (global-set-key [f8] 'find-tag-other-window)) (if (boundp 'MULE) (global-set-key [f9] 'line-copy-start)) (if (boundp 'MULE) (global-set-key [f10] 'line-cut-end)) (if (boundp 'MULE) (global-set-key [f11] 'line-copy-end)) (if (boundp 'MULE) (global-set-key [f12] 'my-yank)) (if(boundp 'MULE)(define-key henkan-mode-map [f7] 'henkan-bunsetu-nobasi-dai))