携帯版
5090 (isweb) + 79520 (Vector) + Counter by XREA.COM


メニュー
アンテナ
Autch.net > 小ネタ > .emacs Last-Modified: 2008-09-10 16:40:04 (JST)

.emacs

あうっちが使っている .emacs をここにバックアップ(ぉ Debian sid の Emacs 21.4.1 に対応しています。 Meadow 3.0 対応の部分も混ざっていますが場合分けしてませんので適当に。

; ---- language-env DON'T MODIFY THIS LINE!
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 日本語表示の設定
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(if (featurep 'mule)
    (progn
      (set-language-environment "Japanese")
      (prefer-coding-system 'euc-jp-unix)
      (set-keyboard-coding-system 'euc-jp-unix)
      (if (not window-system) (set-terminal-coding-system 'euc-jp-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/lgrep")
    (setq grep-command "lgrep -n ")
)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 漢字変換 (Anthy) の設定
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(set-input-method "japanese-anthy")
(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!

(add-to-list 'load-path "~/.emacs.d")

;; face2html
(autoload 'face2html "face2html" nil t)
(setq face2html-css1 t)

;; 初期フレームの設定
(if window-system 
(setq default-frame-alist
      (append (list '(foreground-color . "black")
		    '(background-color . "LemonChiffon")
		    '(background-color . "gray")
		    '(border-color . "black")
		    '(mouse-color . "black")
		    '(cursor-color . "black")
		    '(width . 80)
		    '(height . 40)
		    '(top . 40)
		    '(left . 200)
               )
	      default-frame-alist))
)

;; C のスタイル
(defun my-c-mode-hook ()
  (c-set-style "stroustrup")
  (setq indent-tabs-mode nil)
  (setq tab-width 2)
  (setq c-basic-offset tab-width)
)
(add-hook 'c-mode-hook 'my-c-mode-hook)
(add-hook 'c++-mode-hook 'my-c-mode-hook)
(add-hook 'php-mode-user-hook 'my-c-mode-hook)

;; うるさいベルはカエレ!
(setq visible-bell t)

;; ツールバーいらね
(tool-bar-mode -1)
(menu-bar-mode -1)
(set-scroll-bar-mode 'right)
(display-time)

;; {{ for YaTeX
(setq auto-mode-alist 
      (cons (cons "\\.tex$" 'yatex-mode) auto-mode-alist))
(autoload 'yatex-mode "yatex" "Yet Another LaTeX mode" t)
(setq tex-command "platex")
(setq dvi2-command "dviout")
(setq yatex-kanji-code 3)
(add-hook 'yatex-mode-hook
	  '(lambda () (auto-fill-mode 0) (setq fill-column 70)))
;;(add-hook 'yatex-mode-hook
;;	  '(lambda () (require 'font-latex)
;;	     (font-latex-setup)))
(setq dviprint-command-format "dvipdfm %s")
(setq makeindex-command "mendex")
;; for YaTeX }}

;; {{ for PHP
(autoload 'php-mode "php-mode" "PHP mode" t)

(defcustom php-file-patterns (list "\\.php[34]?\\'" "\\.phtml\\'" "\\.inc\\'")
  "*List of file patterns for which to automatically invoke php-mode."
  :type '(repeat (regexp :tag "Pattern"))
  :group 'php)
(let ((php-file-patterns-temp php-file-patterns))
  (while php-file-patterns-temp
    (add-to-list 'auto-mode-alist
	 (cons (car php-file-patterns-temp) 'php-mode))
    (setq php-file-patterns-temp (cdr php-file-patterns-temp))))

;; for PHP }}

;; {{ YaHTML
(setq yahtml-kanji-code 3)
(setq auto-mode-alist 
      (cons (cons "\\.\\(html$\\|htm$\\)" 'yahtml-mode) auto-mode-alist))
(autoload 'yahtml-mode "yahtml" "YaHTML mode" t)

(defun close-last-tag () "Closes last opened SGML tag." (interactive nil)
    (if (save-excursion (re-search-backward "<\\([-_a-zA-Z0-9]*\\)[ >]" nil t))
	(let ((tag-name (buffer-substring (match-beginning 1) (match-end 1))))
	  (insert (concat "</" tag-name ">"))
	)
      (message "No opened tag")
    )
)

;; YaHTML }}

;; X clipboard との間で kill/yank できるように
(setq x-select-enable-clipboard t)

(require 'psvn) ;; Subversion
(require 'migemo)
(require 'un-define)

(setq paragraph-start '"^\\([  ・○<\t\n\f]\\|(?[*0-9a-zA-Z]+)\\)")

;;;; sticky *scratch* ----
(defun save-scratch-data ()
  (let ((str (progn
               (set-buffer (get-buffer "*scratch*"))
               (buffer-substring-no-properties
                (point-min) (point-max))))
        (file "~/.scratch"))
    (if (get-file-buffer (expand-file-name file))
        (setq buf (get-file-buffer (expand-file-name file)))
      (setq buf (find-file-noselect file)))
    (set-buffer buf)
    (erase-buffer)
    (insert str)
    (save-buffer)))

(defadvice save-buffers-kill-emacs
  (before save-scratch-buffer activate)
  (save-scratch-data))

(defun read-scratch-data ()
  (let ((file "~/.scratch"))
    (when (file-exists-p file)
      (set-buffer (get-buffer "*scratch*"))
      (erase-buffer)
      (insert-file-contents file))
    ))

(read-scratch-data)

;; ---- sticky *scratch*

(setq w3m-use-cookies t)
(require 'refe)
(require 'generic-x) ;; to enable javascript-mode
(put 'narrow-to-region 'disabled nil)

Autch.net > 小ネタ > .emacs Last-Modified: 2008-09-10 16:40:04 (JST)
Valid XHTML 1.0! Valid CSS! Made with Cascading Style Sheets Powered by PHP Powered by Smarty
転載・引用・リンク・アンリンク自由。一切のコンテンツは無保証。
Copyright © 2000 - 2008, Autch.net. "gray_forest" theme designed by OCEAN-NET.