Skip to content

Instantly share code, notes, and snippets.

@akm
Created July 7, 2010 05:18
Show Gist options
  • Save akm/466335 to your computer and use it in GitHub Desktop.
Save akm/466335 to your computer and use it in GitHub Desktop.
.emacs
;; add load-path
(let ((dir (expand-file-name "~/.emacs.d/lisp")))
(if (member dir load-path) nil
(setq load-path (cons dir load-path))
(let ((default-directory dir))
(load (expand-file-name "subdirs.el") t t t))))
;; デフォルトの透明度を設定する (85%)
(add-to-list 'default-frame-alist '(alpha . 92))
;; カレントウィンドウの透明度を変更する (85%)
;; (set-frame-parameter nil 'alpha 0.85)
(set-frame-parameter nil 'alpha 98)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(column-number-mode t)
;; '(cua-mode t nil (cua-base))
'(ecb-options-version "2.32")
'(tool-bar-mode nil nil (tool-bar))
'(transient-mark-mode t))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
(setq-default tab-width 2)
(setq-default indent-tabs-mode nil)
(setq mac-autohide-menubar-on-maximize nil)
(global-set-key [C-tab] 'indent-rigidly)
;;-----------------------------------------------------------------
;; タブ, 全角スペースを表示する
;; http://www.bookshelf.jp/soft/meadow_26.html#SEC318
;;-----------------------------------------------------------------
;;(defface my-face-r-1 '((t (:background "gray15"))) nil)
(defface my-face-b-1 '((t (:background "gray"))) nil)
(defface my-face-b-2 '((t (:background "gray26"))) nil)
(defface my-face-u-1 '((t (:foreground "SteelBlue" :underline t))) nil)
;;(defvar my-face-r-1 'my-face-r-1)
(defvar my-face-b-1 'my-face-b-1)
(defvar my-face-b-2 'my-face-b-2)
(defvar my-face-u-1 'my-face-u-1)
(defadvice font-lock-mode (before my-font-lock-mode ())
(font-lock-add-keywords
major-mode
'(("\t" 0 my-face-b-2 append)
(" " 0 my-face-b-1 append)
("[ \t]+$" 0 my-face-u-1 append)
;;("[\r]*\n" 0 my-face-r-1 append)
)))
(ad-enable-advice 'font-lock-mode 'before 'my-font-lock-mode)
(ad-activate 'font-lock-mode)
;; ;;-----------------------------------------------------------------
;; ;; ECB
;; ;;-----------------------------------------------------------------
;; (add-to-list 'load-path "~/.emacs.d/lisp/ecb-2.32")
;; (load-file "~/.emacs.d/lisp/cedet-1.0pre4/common/cedet.el")
;; (require 'ecb)
;; (defun ecb-toggle ()
;; (interactive)
;; (if ecb-minor-mode
;; (ecb-deactivate)
;; (ecb-activate)))
;; (global-set-key [f2] 'ecb-toggle)
;; (require 'ecb-autoloads)
;;-----------------------------------------------------------------
;; psvn.el
;;-----------------------------------------------------------------
(require 'psvn)
(add-hook 'dired-mode-hook
'(lambda ()
(require 'dired-x)
;;(define-key dired-mode-map "V" 'cvs-examine)
(define-key dired-mode-map "V" 'svn-status)
(turn-on-font-lock)
))
(setq svn-status-hide-unmodified t)
;;(setq process-coding-system-alist
;; (cons '("svn" . utf-8) process-coding-system-alist))
(add-hook 'svn-log-edit-mode-hook
'(lambda ()
(set-buffer-file-coding-system 'utf-8)))
(setq svn-status-svn-executable "svn2")
(setq process-coding-system-alist
(cons '("svn" . utf-8) process-coding-system-alist))
(setq svn-status-svn-process-coding-system 'utf-8)
;;-----------------------------------------------------------------
;; ruby
;;-----------------------------------------------------------------
(autoload 'ruby-mode "ruby-mode" "Ruby editing mode." t)
(setq auto-mode-alist (cons '("\\.rb$" . ruby-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.rhtml$" . html-mode) auto-mode-alist))
;; インデント
(setq ruby-deep-indent-paren-style nil)
(add-hook 'ruby-mode-hook
'(lambda ()
(setq tab-width 2)
(setq indent-tabs-mode nil)
(setq ruby-indent-level tab-width)
))
(require 'ruby-mode)
;; (defun ruby-mode-set-encoding () ())
;;-----------------------------------------------------------------
;; rails
;;-----------------------------------------------------------------
(setq load-path (cons "~/.emacs.d/lisp/emacs-rails" load-path))
(require 'rails)
;; ;;-----------------------------------------------------------------
;; ;; rails rinari
;; ;;
;; ;; http://d.hatena.ne.jp/willnet/20090110/1231595231
;; ;;-----------------------------------------------------------------
;; ;; Interactively Do Things (highly recommended, but not strictly required)
;; ;; (require 'ido)
;; ;; (ido-mode t)
;; ;; Rinari
;; (add-to-list 'load-path "~/.emacs.d/lisp/rinari")
;; (require 'rinari)
;;
;; ;;; rhtml-mode
;; (add-to-list 'load-path "~/.emacs.d/lisp/rhtml")
;; (require 'rhtml-mode)
;; (add-hook 'rhtml-mode-hook
;; (lambda () (rinari-launch)))
;;
;; ;; ちなみにこのキーバインドや、ここより下のキーバインドを試したときに、「Missing the Rails gem.」
;; ;; のようなエラーが出る方はEmacsのPATHの設定を修正する必要があります。僕は下記のようにして解決しました。
;; (dolist (dir (mapcar 'expand-file-name '("/usr/local/bin")))
;; (setenv "PATH" (concat dir ":" (getenv "PATH")))
;; (setq exec-path (append (list dir) exec-path)))
;;
;; load-pathにyasnippetのパスを通す
;; (setq load-path (cons (expand-file-name "~/.emacs.d/lisp/yasnippet-0.5.9") load-path))
;;
;; ;; yasnippetのロード
;; (require 'yasnippet)
;; (yas/initialize)
;; (yas/load-directory "~/.emacs.d/lisp/yasnippets-rails/rails-snippets")
;; ;;-----------------------------------------------------------------
;; ;; jde
;; ;;-----------------------------------------------------------------
;; (load "cedet")
;; (setenv "JAVA_HOME" "/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home")
;; (require 'jde)
;; (add-hook 'jde-mode-hook
;; '(lambda ()
;; (c-set-offset 'arglist-intro '+)
;; (c-set-offset 'arglist-close 0)
;; (c-set-offset 'topmost-intro-cont 0)
;; (c-set-offset 'func-decl-cont 0)
;; (setq indent-tabs-mode nil)
;; ))
;;-----------------------------------------------------------------
;; git
;;-----------------------------------------------------------------
;; (defadvice git-status-quit
;; (after my-git-status-quit activate)
;; (delete-window))
;;
;; (require 'ido)
;; (ido-mode t)
;;(setq load-path (cons (expand-file-name "/usr/share/doc/git-core/contrib/emacs") load-path))
(require 'vc-git)
(when (featurep 'vc-git) (add-to-list 'vc-handled-backends 'git))
(require 'git)
(autoload 'git-blame-mode "git-blame"
"Minor mode for incremental blame for Git." t)
(define-key global-map "\C-x\C-g" 'git-status)
(setq git--repository-bookmarks
'("git://github.com/xcezx/scratch.git"
"git://github.com/xcezx/dotfiles.git"))
;;-----------------------------------------------------------------
;; language
;;-----------------------------------------------------------------
(set-language-environment 'Japanese)
(set-terminal-coding-system 'utf-8)
(setq file-name-coding-system 'utf-8)
(set-clipboard-coding-system 'utf-8)
(setq default-buffer-file-coding-system 'utf-8)
(setq coding-system-for-read 'mule-utf-8-unix)
(prefer-coding-system 'utf-8-unix)
(set-default-coding-systems 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-buffer-file-coding-system 'utf-8-unix)
(setq default-input-method "MacOSX")
;;-----------------------------------------------------------------
;; emacs-nav
;; http://code.google.com/p/emacs-nav/
;;-----------------------------------------------------------------
(add-to-list 'load-path "~/.emacs.d/lisp/emacs-nav-28")
(require 'nav)
;;-----------------------------------------------------------------
;; howm
;; ;; http://howm.sourceforge.jp/uu/#label:11
;;-----------------------------------------------------------------
;; ;; case 1: emacs 起動時に読み込む
;; (setq howm-menu-lang 'ja)
;; (require 'howm-mode)
;;case 2: はじめて C-c , , した時に読み込む
(setq howm-menu-lang 'ja)
(global-set-key "\C-c,," 'howm-menu)
(autoload 'howm-menu "howm-mode" "Hitori Otegaru Wiki Modoki" t)
;; ;; いずれも, もし「Cannot open load file」とかエラーが出るなら, 上記の前にこれを追加
;;(add-to-list 'load-path "/usr/share/emacs/site-lisp/howm/")
;; (require 'cl)
;; (defgroup nav nil
;; "A lightweight file/directory navigator."
;; :group 'applications)
;; (defcustom nav-width 30
;; "*Initial width of the Nav window."
;; :type 'integer
;; :group 'nav)
;; (defcustom nav-boring-file-regexps
;; (list "\\.pyc$" "\\.o$" "~$" "\\.bak$" "^\\.[^/]" "^\\./?$" "/\\.")
;; "*Nav ignores filenames that match any regular expression in this list."
;; :type '(repeat string)
;; :group 'nav)
;; (defcustom nav-split-window-direction 'horizontal
;; "*Window split direction for `nav-open-file-other-window-2'.
;; This is used if only one window besides the Nav Window is visible."
;; :type '(choice (const horizontal) (const vertical))
;; :group 'nav)
;; (defcustom nav-resize-frame-p nil
;; "*If non-nil, activating and deactivating nav will resize the current frame."
;; :type 'boolean
;; :group 'nav)
;; ;;-----------------------------------------------------------------
;; ;; desktop
;; ;;-----------------------------------------------------------------
;; ;;(setq desktop-files-not-to-save "^$")
;; ;; (desktop-load-default)
;; ;; (desktop-read)
;; ;; (desktop-save-mode)
;; (desktop-save-mode 1)
;; ;;-----------------------------------------------------------------
;; ;; windows.el
;; ;; http://technique.sonots.com/?UNIX%2F%E5%AD%A6%E7%94%9F%E3%83%84%E3%83%BC%E3%83%AB%2Femacs%2Fwindows.el
;; ;;-----------------------------------------------------------------
;; ;; デフォルトは C-c C-w
;; (require 'windows)
;; ;; 新規にフレームを作らない
;; (setq win:use-frame nil)
;; (win:startup-with-window)
;; (define-key ctl-x-map "C" 'see-you-again)
;;
;;
;; ;; revive.el
;; (autoload 'save-current-configuration "revive" "Save status" t)
;; (autoload 'resume "revive" "Resume Emacs" t)
;; (autoload 'wipe "revive" "Wipe emacs" t)
;; ;;終了時に保存?
;; (add-hook 'kill-emacs-hook 'save-current-configuration)
;; ;; 起動時のウィンドウの復元
;; (resume-windows)
(put 'upcase-region 'disabled nil)
(put 'downcase-region 'disabled nil)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment