ページ

2010年11月18日木曜日

.emacs を 晒す

.emacsを晒します。

完全に自分のためですw



.emacs

;; -*- Mode: Emacs-Lisp -*-
;;
;; Emacs 共通設定
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;

;;; Language Environment: Japanese
(set-language-environment "Japanese")

;; default coding system
(set-default-coding-systems 'utf-8-unix)

(prefer-coding-system 'utf-8-unix)
(set-keyboard-coding-system 'utf-8)

(global-font-lock-mode t)
(setq max-specpdl-size 2400)
;;
;; 色とか
;;
;;; A setup of the initial value of a frame parameter
(setq default-frame-alist
(append (list
;; Size
'(width . 80)  ; Breadth (the number of beams)
'(height . 40) ; Height (the number of lines)
;; Position
'(left . 10) ; Upper left corner x coordinates
'(top . 30)  ; Upper left corner y coordinates
;; The color of a background and a character
;;      '(font . "bdf-fontset")    ; BDF
(cond
((featurep 'meadow)
'(font . "private-fontset")
)
((featurep 'emacs)
'(font . "fontset-default")
)
)
'(background-color . "black")
'(foreground-color . "white")
'(cursor-color . "green")
;; font
;; Scroll bar un-displaying.
'(vertical-scroll-bars . nil)
)
default-frame-alist))


;; site-list path
;; プラットホーム別設定を切り替える
;;

(cond
((featurep 'meadow)
;; ここにMeadow固有の設定
(load (expand-file-name "~/.meadow"))
)
(t
;; ここにEmacs固有の設定
(load (expand-file-name "~/.gnuemacs"))
)
)


;; sesssion
(require 'session)
(add-hook 'after-init-hook 'session-initialize)
(when (require 'session nil t)
(setq session-initialize '(de-saveplace session keys menus)
session-globals-include '((kill-ring 100)
(session-file-alist 200 t)
(file-name-history 200)))
(add-hook 'after-init-hook 'session-initialize))


;; Windows IME ON/OFF on mode line
(setq mw32-ime-show-mode-line t)

;;; line and column number on mode line 
(column-number-mode t) ; column number

;;; view menu ber
;;; default don't view
(menu-bar-mode -1)
(global-set-key "\C-cm" 'menu-bar-mode)

;;; View Scroll ber is nill
(scroll-bar-mode -1)

; バックアップファイル無効
(setq make-backup-files nil)

; 自動保存ファイル無効
(setq auto-save-default nil)


;; A setup of a mode line color
(set-face-foreground 'modeline  "black")
(set-face-background 'modeline  "gray")

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;  The selection range is colored.
(set-face-background 'region "dark red")
(set-face-foreground 'region "white")

;;;;;; Key bind
;; C-h It uses as backspace.
(keyboard-translate ?\C-h ?\C-?)
(global-set-key "\C-h" nil)

;;  C-c h  help-command
(global-set-key "\C-c?" 'help-command)

;; M-? help-for-help
(global-set-key "\M-?" 'help-for-help)

;; Height regulation of a window
(global-set-key "\M-," 'enlarge-window)

;; line number specification movement
(global-set-key "\M-g" 'goto-line)

;; Starting of Dired
(global-set-key "\C-x\C-d" 'dired)

;;; Substitution (since it M-% is hard to push)
(global-set-key "\M-s" 'query-replace)

;;; Substitution (since it M-% is hard to push)
(global-set-key "\C-xs" 'replace-regexp)

;;; hl-line-mode toggle
(global-set-key "\C-l" 'hl-line-mode)

;;; shell-mode
(global-set-key "\C-z" 'shell)

;; Grep command
(global-set-key "\C-cg" 'grep)

;;; shrink-window-horizontally
(global-set-key "\M-o"'shrink-window-horizontally)

;;; enlarge-window-horizontally
(global-set-key "\M-p" 'enlarge-window-horizontally)

;;; 指定した文字列を行頭に挿入
(global-set-key "\M-a" 'string-rectangle)

;; 全バッファ対象置換
(global-set-key "\C-cs" 'gresreg)

;; php保管モード
(global-set-key "\C-x\t" 'php-complete-function)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; 今開いているファイルを ~/backupにコピーしてから通常セーブする
;;; ついでにBuildNumberも埋め込むようにする
(setq backup-inhibited t)

(defconst legacy-backup-directory (expand-file-name
(concat "~/backup/" (format-time-string "%y-%m%d" (current-time))))
"The directory for legacy-backup.")

(defun legacy-backup-save ()
"filename.year-date-timeの書式で `legacy-backup-directory'に
ファイルをバックアップしてから、通常セーブします。
ファイルは際限なく溜まっていくので、各自削除して下さい。"
(interactive)
;; カーソル位置の保持
(save-excursion
(cond
((and (boundp 'legacy-backup-directory) legacy-backup-directory)
(let (backupname
(realname buffer-file-name)
(large (> (buffer-size) 1000000)))
(when (and realname (file-exists-p realname) (buffer-modified-p) (not large))
(unless (file-exists-p legacy-backup-directory)
(make-directory legacy-backup-directory t))
(setq backupname
(expand-file-name
(concat
(file-name-nondirectory realname)
"."
(format-time-string "%H%M" (current-time)))
legacy-backup-directory))
(message "Copying...")
(copy-file realname backupname t nil)
(message "Copying...done."))

(save-buffer)))
(t (message (format "%sを設定して下さい。" (symbol-name 'legacy-backup-directory)))))))
(global-set-key "\C-x\C-s" 'legacy-backup-save)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Redo is made to be made.
(when (locate-library "redo")
(require 'redo)
(define-key ctl-x-map (if window-system "U" "r") 'redo)
(define-key global-map [?\C-.] 'redo))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; A corresponding parenthesis is emphasis-displayed.
(require 'mic-paren)
(paren-activate)     ; activating
(setq paren-face 'bold)
(setq paren-match-face 'bold)
(setq paren-sexp-mode t)


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; edit grep result
(require 'grep-edit)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; backward-delete-word
;;;
(global-set-key [(meta backspace)] 'backward-delete-word)
(defun delete-word (arg)
"Delete characters forward until encountering the end of a word.
With argument, do this that many times."
(interactive "*p")
(delete-region (point) (save-excursion (forward-word arg) (point))))

(defun backward-delete-word (arg)
"Delete characters backward until encountering the end of a word.
With argument, do this that many times."
(interactive "*p")
(delete-word (- arg)))

;; Meta backspace kills and puts words in kill ring is very unintuitive and
;; screws up kill ring. Use delete instead.
(global-set-key [(meta backspace)] 'backward-delete-word)
(global-set-key [(meta d)] 'delete-word)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; The high-speed change of a buffer (function)
;;;

(defun previous-buffer ()
"Select previous window."
(interactive)
(bury-buffer))
(defun backward-buffer ()
"Select backward window."
(interactive)
(switch-to-buffer
(car (reverse (buffer-list)))))

;; high-speed buffer change key bind
(global-set-key "\C-t" 'previous-buffer)
(global-set-key "\M-t" 'backward-buffer)

;;
;; Font Face Settings
;;

;; Keyword face
(set-face-foreground 'font-lock-keyword-face "PaleGreen")

;; Comment face
(set-face-foreground 'font-lock-comment-face "DarkOrange2")

;; Strings face
(set-face-foreground 'font-lock-string-face "PowderBlue")

;; Function Name face
(set-face-foreground 'font-lock-function-name-face "Green")

;; Constant face
(set-face-foreground 'font-lock-constant-face "MediumSeaGreen")

;; Type Face Name
(set-face-foreground 'font-lock-type-face "Gold3")

;; Variable Name
(set-face-foreground 'font-lock-variable-name-face "DeepSkyBlue")

;; Worning face
(set-face-foreground 'font-lock-warning-face "Firebrick1")



;; 日付/時刻表示
(setq display-time-24hr-format t)
(setq display-time-format "%Y-%m/%d %H:%M")
(setq display-time-day-and-date t)
(display-time)


;;
;; Diced で新しいバッファをつくらない
;;
;;
(defvar my-dired-before-buffer nil)
(defadvice dired-advertised-find-file
(before kill-dired-buffer activate)
(setq my-dired-before-buffer (current-buffer)))

(defadvice dired-advertised-find-file
(after kill-dired-buffer-after activate)
(if (eq major-mode 'dired-mode)
(kill-buffer my-dired-before-buffer)))

(defadvice dired-up-directory
(before kill-up-dired-buffer activate)
(setq my-dired-before-buffer (current-buffer)))

(defadvice dired-up-directory
(after kill-up-dired-buffer-after activate)
(if (eq major-mode 'dired-mode)
(kill-buffer my-dired-before-buffer)))

;; ここにその他共通設定
;; HOME と END キーでバッファーの先頭/最後へ移動
(global-set-key [home] 'beginning-of-buffer)
(global-set-key [end] 'end-of-buffer)

;; ツールバーやモードラインにカーソルを置くとヒントが表示されます
;; このヒントをミニバッファで表示するように変更
(setq tooltip-use-echo-area t)

;; カーソルを点滅させない
(blink-cursor-mode nil)

;;; ツールバーを表示しない
(tool-bar-mode 0)

;; カーソルキーで新しい行を作る
(setq next-line-add-newlines nil)

;; dired でディレクトリを先頭に表示
(setq ls-lisp-dirs-first t)

;; バックアップファイルの作成場所を固定
(setq make-backup-files t)
(setq backup-directory-alist
(cons (cons "\\.*$" (expand-file-name "~/bak"))
backup-directory-alist))

;; リストを評価したらすべて出て欲しい,他
(setq eval-expression-print-level nil
eval-expression-print-length nil
eval-expression-debug-on-error nil)

;; ミニバッファの大きさを変えない
(setq resize-mini-windows nil)

;; 他のウィンドウにはカーソルを表示しない
(setq cursor-in-non-selected-windows nil)

;;行間を調節
(setq-default line-spacing 1)

;;etags でのみ大文字,小文字を区別する
;; (setq tags-case-fold-search nil)

(custom-set-variables
;; custom-set-variables was added by Custom -- don't edit or cut/paste it!
;; Your init file should contain only one such instance.
'(column-number-mode t)
'(display-time-mode t nil (time))
'(fringe-mode (quote (0 . 0)) nil (fringe))
'(navi2ch-localfile-default-file-modes 511)
'(scroll-bar-mode (quote nil)))

;; php (PEAR coding style

;;(require 'php-mode)

(add-to-list 'auto-mode-alist '("\\.php?\\'" . php-mode))

(defun php-mode-hook ()
(setq tab-width 4
c-basic-offset 4
c-hanging-comment-ender-p nil
indent-tabs-mode nil
indent-tabs-mode
(not
(and (string-match "/\\(PEAR\\|pear\\)/" (buffer-file-name))
(string-match "\.php$" (buffer-file-name))))))

(custom-set-faces
;; custom-set-faces was added by Custom -- don't edit or cut/paste it!
;; Your init file should contain only one such instance.
)
</code>

.gnuemacs
<code>
;; -*- Mode: Emacs-Lisp -*-
;;
;; GNU/Emacs 固有設定
;;

;; タイトルバーにファイル名をフルパスで表示
(setq frame-title-format "Emacs: %f")

;;保存するファイル名の文字コード指定
(setq file-name-coding-system 'utf-8)

;; ホームディレクトリをロードパスに追加
(setq load-path (cons "~/.emacs.d/lisp/" load-path))
(add-to-list 'default-frame-alist '(font. "fontset-default"))


Meadowは別の機会に。

0 件のコメント:

コメントを投稿