;; mode: emacs-lisp
;; .emacs file for Linux
;;
;;; 自動改行の設定
;(setq text-mode-hook ' turn-on-auto-fill)
;
; (add-hook 'text-mode-hook
; '(lambda ()
; (progn (set-fill-column nil)
; (turn-on-auto-fill))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; version 2
;(setq fill-column 500)
;(setq latex-mode-hook 'turn-on-auto-fill)
;(setq default-major-mode 'text-mode)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;(add-hook 'LaTeX-mode-hook
; (lambda ()
; (message "Setting up my LaTeX hooks")
; (auto-fill-mode t)
; (setq tab-width 4)
; ; (setq fill-column 1000)
; ;;local-set-key [return] 'newline-and-indent)
; ;;(local-set-key [tab] 'indent-or-complete)
; ))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(setq yatex-mode-hook '(lambda ()
(auto-fill-mode 1)
(setq fill-column nil)))
;;---------------------------------------------------------------
;; Mew
;; loading Mew
(setq load-path (cons "/usr/local/share/emacs/site-lisp/mew/" load-path))
(autoload 'mew "mew" nil t)
(autoload 'mew-send "mew" nil t)
(setq mew-icon-directory "/usr/share/pixmaps/mew/")
;(setq mew-icon-directory "icon directory")
(if (boundp 'read-mail-command)
(setq read-mail-command 'mew))
;; Viewing URL from Mew by Mozzila
(setq browse-url-browser-function 'browse-url-netscape)
(autoload 'browse-url-at-mouse "browse-url"
"Ask a WWW browser to load a URL clicked with the mouse." t)
(add-hook 'mew-message-mode-hook
(function
(lambda()
(local-set-key [mouse-2] 'browse-url-at-mouse))))
(setq browse-url-netscape-program "mozilla-firefox")
(setq mew-mode-hook '(lambda ()
(auto-fill-mode 1)
(setq fill-column 60)))
;; always send ccs to
(setq mew-bcc "MY_MAIL_ADDRESS")
;; making 'send' directory in ~/Mail and keep copies of outgoing mails in it.
;(setq mew-fcc "+send")
;;;--------------------------------------------------------------
;; 起動設定
(setq inhibit-startup-message nil) ;; オープニングメッセージを省略するか
(setq initial-scratch-message nil) ;; 起動直後の*scratch* buffer に入る文字列
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; 便利な設定 (自動置換関係)
;; 余分な空白を削除する
;; -> http://www3.big.or.jp/~sian/linux/tips/
(defun trim-buffer ()
"Delete excess white space."
(interactive)
(save-excursion
;; 行末の空白を削除する
(goto-char (point-min))
(while (re-search-forward "[ \t]+$" nil t)
(replace-match "" nil nil))
;; ファイルの終わりにある空白行を削除する
(goto-char (point-max))
(delete-blank-lines)
;; ;; タブに変換できる空白は変換する
;; (mark-whole-buffer)
;; (tabify (region-beginning) (region-end))
))
(add-hook 'write-file-hooks 'trim-buffer)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;--Replace yes/no+enter prompts with y/n prompts
(fset 'yes-or-no-p 'y-or-n-p)
;-----------------------------------------------------
;; enable scroll with mouse
;;http://emacs-21.ki.nu/dot.emacs/mouse.html
; normal scroll 5 line
; mouse2 + shift key: 1 line
; mouse2 + C half: page
(global-set-key [mouse-4] '(lambda () (interactive) (scroll-down 5)))
(global-set-key [mouse-5] '(lambda () (interactive) (scroll-up 5)))
; Shift
(global-set-key [S-mouse-4] '(lambda () (interactive) (scroll-down 1)))
(global-set-key [S-mouse-5] '(lambda () (interactive) (scroll-up 1)))
; Control
(global-set-key [C-mouse-5] '(lambda () (interactive) (scroll-up (/ (window-height) 2))))
(global-set-key [C-mouse-4] '(lambda () (interactive) (scroll-down (/ (window-height) 2))))
;;---------------------------------------------------------------
;;; font-lock
;; +++ font-lock +++ ;;
;;; comment in general:
;;; Difinitions for font-lock and syntax high-lighting colours should
;;; be placed at the begining of .emacs file. If these are placed
;;; at the end of the file, syntax-highliting does not work.
;;; I have not find out the cause.
;; Speeding up loading files which use font-lock mode ;;;;;
;;; If using emacs 21 the following will speed up loading files
;;; which used font-lock mode.
;;; The following line added by me 01/01/2004.
;;; originally from: http://homepage1.nifty.com/blankspace/emacs/color.html
(setq font-lock-support-mode 'jit-lock-mode)
;;; The highlighting colours will be used in all modes with the following.
(global-font-lock-mode t)
;;; font-lock for specific mode ;;;
;;; The following line is disabled since I set font-lock for all modes.
;(add-hook 'latex-mode-hook 'turn-on-font-lock)
;(add-hook 'Emacs-lisp 'turn-on-font-lock)
;; +++ End of font-lock matters+++ ;;
;;-------------------------------------------------------------------
;; +++ font-lock +++ ;;
;;; quote--- source: http://www-2.cs.cmu.edu/cgi-bin/info2www?(emacs)Font%2520Lock
;;; Font Lock highlighting patterns already exist for many modes, but you
;;; may want to fontify additional patterns. You can use the function
;;;`font-lock-add-keywords', to add your own highlighting patterns for a
;;; particular mode. For example, to highlight `FIXME:' words in C
;;; comments, use this:
;;;
;;; (font-lock-add-keywords
;;; 'latex-mode
;;; '(("\\<\\(FIXME\\):" 1 font-lock-warning-face t)))
;;;
;;; To remove keywords from the font-lock highlighting patterns, use the
;;; function `font-lock-remove-keywords'. --- end of quote.
;;----------------------------------------------------------------------
;; +++ Syntax-highlighting for LaTeX mode +++ ;;
;;; The followings are my own colour for syntax-highlighting.
;;; The lines added by me 03/01/04
(add-hook 'font-lock-mode-hook '(lambda ()
;; comment
(set-face-foreground 'font-lock-comment-face "maroon3") ;firebrick1, orange red,indian red,maroon1,violetred3, maroon2, lightsalmon2; other candiates: darkred, firebrik1-4,violetred,
(set-face-background 'font-lock-comment-face nil)
(set-face-bold-p 'font-lock-comment-face nil)
(set-face-italic-p 'font-lock-comment-face nil)
(set-face-underline-p 'font-lock-comment-face nil)
;;string
(set-face-foreground 'font-lock-string-face "medium sea green") ; cyan3, dark cyan green
(set-face-background 'font-lock-string-face nil)
(set-face-bold-p 'font-lock-string-face nil)
(set-face-italic-p 'font-lock-string-face nil)
(set-face-underline-p 'font-lock-string-face nil)
;; keyword
(set-face-foreground 'font-lock-keyword-face "lemonchiffon4")
; other candidates: lemonchiffon4, spring green,green yellow, forest green, lawn green, light cyan, green4, darkgreen, cyan, turquoise, chartreuse,
(set-face-background 'font-lock-keyword-face nil)
(set-face-bold-p 'font-lock-keyword-face nil)
(set-face-italic-p 'font-lock-keyword-face nil)
(set-face-underline-p 'font-lock-keyword-face nil)
;; builtin -> \XX for LaTeX
(set-face-foreground 'font-lock-builtin-face "deepskyblue");; mediumspringgreen, magenta4
; other candiates: mediumseagreen, aquamarine, olivedrab, deeppink, magenta, darkorange
(set-face-background 'font-lock-builtin-face nil)
(set-face-bold-p 'font-lock-builtin-face nil)
(set-face-italic-p 'font-lock-builtin-face nil)
(set-face-underline-p 'font-lock-builtin-face nil)
;; function-name
(set-face-foreground 'font-lock-function-name-face "sandybrown")
; other candidates: blueviolet,
(set-face-background 'font-lock-function-name-face nil)
(set-face-bold-p 'font-lock-function-name-face nil)
(set-face-italic-p 'font-lock-function-name-face nil)
(set-face-underline-p 'font-lock-function-name-face nil)
;; variable-name
(set-face-foreground 'font-lock-variable-name-face "deepskyblue") ;green,BlueViolet
(set-face-background 'font-lock-variable-name-face nil)
(set-face-bold-p 'font-lock-variable-name-face nil)
(set-face-italic-p 'font-lock-variable-name-face nil)
(set-face-underline-p 'font-lock-variable-name-face nil)
;;type
(set-face-foreground 'font-lock-type-face "lemonchiffon4") ; mediumspringgreen
(set-face-background 'font-lock-type-face nil)
(set-face-bold-p 'font-lock-type-face nil)
(set-face-italic-p 'font-lock-type-face nil)
(set-face-underline-p 'font-lock-type-face nil)
;; constant
(set-face-foreground 'font-lock-constant-face "indianred") ;; indianRed
(set-face-background 'font-lock-constant-face nil)
(set-face-bold-p 'font-lock-constant-face t)
(set-face-italic-p 'font-lock-constant-face nil)
(set-face-underline-p 'font-lock-constant-face nil)
;; warning
(set-face-foreground 'font-lock-warning-face "Red3")
(set-face-background 'font-lock-warning-face nil)
(set-face-bold-p 'font-lock-warning-face nil)
(set-face-italic-p 'font-lock-warning-face nil)
(set-face-underline-p 'font-lock-warning-face nil)
))
(provide 'faces-font-lock)
;; without star up message
;(setq inhibit-starup-message t) doesn't work.
(set-language-environment "Japanese")
(set-language-environment-coding-systems "Japanese")
;; canna Japanese setting
;;(global-set-key "\C-\\" 'canna-toggle-japanese-mode)
;(setq default-buffer-file-coding-system 'euc-jp)
;(setq default-process-coding-system '(euc-jp . euc-jp))
;(setq default-terminal-coding-system 'euc-jp)
;(set-terminal-coding-system 'euc-jp)
;(its-define-mode "roma-kana" "日本語" nil)
;; assign meta to muhenkan key
;;(w32-set-modifier-key 29 'nil)
;;(w32-set-modifier-key 29 'meta)
;;; TeX src-special
;;(require 'xdvi-search)
;;(server-start)
;;(custom-set-variables
;;'(sever-switch-hook (quote (raise-frame))))
;;(custom-set-faces)
;;;----------------------------------------------------------------------------
;;; Yatex
;; Yatex will be autolatically loaded when opening *.tex file.
(setq auto-mode-alist
(cons (cons "\\.tex$" 'yatex-mode) auto-mode-alist))
(autoload 'yatex-mode "yatex" "Yet Another LaTeX mode" t)
;; Kanji code (Linux) 1. JIS shift 2. JIS 3.EUC
(setq YaTeX-kanji-code 3)
;; type-setter
(setq tex-command "latex")
;; viewer
;(setq dvi2-command "xdvi -s 4")
;(setq dvi2-command "gs")
(setq dvi2-command "kdvi")
;; Additional syntax hilighting for YaTeX
(setq my-YaTeX-font-lock-keywords
'(("\\(\\\\\\(left\\|right\\)\\([][().|]\\|\\\\[{}]\\)\\)"
(0 font-lock-warning-face))
("\\(|\\|&\\|\\\\[{}]\\|\\\\\\\\\\)" (0 font-lock-warning-face))
("\\\\[a-zA-Z]*" (0 font-lock-builtin-face))
))
(add-hook 'yatex-mode-hook
'(lambda ()
(setq
YaTeX-font-lock-keywords
(append YaTeX-font-lock-keywords my-YaTeX-font-lock-keywords))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; for gb4e ;;
(setq yatex-mode-load-hook
'(lambda() (YaTeX-define-begend-key "x" "exe")))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;-----------------------------------------------------------------------------
;; Yahtml
;; Yahtml will be autolatically loaded when opening *.html file.
(setq auto-mode-alist
(cons (cons "\\.html$" 'yahtml-mode) auto-mode-alist))
(autoload 'yahtml-mode "yahtml" "Yet Another html-mode" t)
;;(setq yahtml-kanji-code 3)
;; set browser
(setq yahtml-www-browser "mozzila")
;(setq yahtml-lint-program "weblint")
;;font size
;(set-default-font
;"-b&h-lucidatypewriter-medium-r-normal-*-*-110-*-*-m-*-iso8859-1")
;"-b&h-lucidatypewriter-medium-r-normal-*-*-100-*-*-m-*-iso8859-1")
;"-adobe-courier-bold-r-*-*-17-*-100-100-*-*-*-*")
;"-adobe-courier-medium-r-*-*-17-*-100-100-*-*-*-*")
;"-adobe-courier-medium-r-normal-*-*100-*-*-*-*-iso8859-1")
;"-adobe-courier-medium-r-normal--16-*-*-*-m-*-iso8859-1")
;"-misc-fixed-medium-r-semicondensed--13-*-*-*-c-60-iso8859-1")
;"-misc-fixed-*-*-*-*-*-*-*-*-*-*-*-*")
;"-misc-fixed-medium-r-normal-*-14-100-100-100-c-70-iso8859-1")
;"-misc-fixed-bold-r-normal-*-14-100-100-100-c-70-iso8859-1")
;;; The lines below doesn't work
;"-*-Lucidatypewriter-Medium-R-*-*-*-120-75-75-*-*-iso8859-")
;"-adobe-times-medium-r-normal-11-80-100-100-p-*-iso8859-1")
;"-b&h-lucida-bold-r-normal-sans-12-120-*-*-p-*-iso8859-9")
;"-b&h-lucida-medium-r-*-*-12-*-*-*-*-*-*-9")
;"-microsoft-verdana-*-r-*-*-*-110-*-*-p-*-*-*")
;"-xos4-terminus-medium-r-normal-*-*-140-*-*-*-*-*-*")
;;; waiting to try
;; Display
(setq default-frame-alist
'(
;-------------------------------------------------------------
; display setting is for courier 16pt and 14 inch display
; (top . 24) (left . 1)
(top . 5) (left . 25) ; note that this setting override settings in .Xresources.
(height . 46) (width . 100) ;height 43 width 105
;-------------------------------------------------------------
; display setting for courier 18pt on 14 inches display
;(top . 23) (left . 45)
;(height . 34) (width . 92)
;-------------------------------------------------------------
(cursor-color . "yellow") ;darkslategrey
(mouse-color . "yellow")
(background-color . "darkslategrey") ;;moccasin, lemon chiffon, NavajoWhite3
(foreground-color . "grey85")
(scroll-bar-width . 12)
))
;;---------------------------------------------------
;; remove tool-bar ツールバーを表示しない
(tool-bar-mode 0)
;; Show line number on mode-line.
(line-number-mode t)
;; show column number on mode-line.
(column-number-mode t)
(set-face-foreground 'modeline "grey60") ;slate grey, lightskyblue4, dark goldenrod, oritinally: snow
(set-face-background 'modeline "darkslategrey") ;originally: black
;; Show current bus on title bar
(defvar dired-mode-p nil)
(add-hook 'dired-mode-hook
(lambda ()
(make-local-variabe 'dired-mode-p)
(setq dired-mode-p t)))
(setq frame-title-format-orig frame-title-format)
(setq frame-title-format
'((buffer-file-name "%f"
(dired-mode-p default-directory
mode-line-buffer-identification))))
;; Move around windows with [S-[up, down, left, right]]
(windmove-default-keybindings)
;; Hilight marked region
(setq transient-mark-mode t)
(set-face-foreground 'region "white") ;originally: white
(set-face-background 'region "cornflower blue") ;dim gray,cyan, blue, navy, cornflower blue
;; font-lock
(setq global-font-lock-mode t)
;; Speeding up loading files with use font-lock mode (only effective for emacs21)
(setq font-lock-support-mode 'jit-lock-mode)
;; highlight
(show-paren-mode t)
;; diary and calendar
(display-time)
(setq european-calendar-style t)
;(calendar)
(setq mark-diary-entries-in-calendar t)
(setq view-calendar-holidays-initially t)
;(diary)
;; flash screen instead of beep
;;(setq visible-bell t)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;; ---- language-env DON'T MODIFY THIS LINE! ;;;;;;;;;;;;;;;
;; 日本語表示の設定
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(if (not (boundp 'MULE))
(if (featurep 'xemacs)
; xemacs21 の場合
(progn
(set-language-environment "Japanese")
(set-default-buffer-file-coding-system 'euc-jp-unix)
(set-keyboard-coding-system 'euc-jp-unix)
(if (not window-system) (set-terminal-coding-system 'euc-jp-unix))
)
; emacs20 の場合
(progn
(set-language-environment "Japanese")
(set-default-coding-systems 'euc-japan-unix)
(set-keyboard-coding-system 'euc-japan-unix)
(if (not window-system) (set-terminal-coding-system 'euc-japan-unix))
)
)
)
; 日本語 info が文字化けしないように
(auto-compression-mode t)
; xemacs の shell-mode で 日本語 EUC が使えるようにする
(if (featurep 'xemacs)
(add-hook 'shell-mode-hook (function
(lambda () (set-buffer-process-coding-system 'euc-japan 'euc-japan))))
)
; 日本語 grep
(if (file-exists-p "/usr/bin/jgrep")
(setq grep-command "jgrep -n -e ")
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 漢字変換 (canna) の設定
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(set-input-method 'japanese-egg-canna)
(global-set-key "\C-o" 'toggle-input-method)
(toggle-input-method nil)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Xでのカラー表示
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'font-lock)
(if (not (featurep 'xemacs))
(global-font-lock-mode t)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; C プログラムの書式
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;(defun my-c-mode-common-hook ()
; (c-set-style "linux") (setq indent-tabs-mode t) ;linux 式がいいとき
; /usr/src/linux/Documentation/CodingStyle 参照
; (c-set-style "k&r") ;k&r式がいいときはこれを有効にする
; (c-set-style "gnu") ;デフォルトの設定
; )
;(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; いろいろ
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Deleteキーでカーソル位置の文字が消えるようにする
(global-set-key [delete] 'delete-char)
;; C-h キーでカーソルの左の文字が消えるようにする。
;; ただし、もともと C-h はヘルプなので、
;; これを有効にすると、ヘルプを使うときには
;; M-x help や F1 を使う必要があります。
;(global-set-key "\C-h" 'backward-delete-char)
; ---- language-env end DON'T MODIFY THIS LINE!
; ---- language-env DON'T MODIFY THIS LINE!
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;