Screaming Loud

日々是精進

.emacs.el晒し

;;;;;;;;;;;;;;;;;;;;;;;;;;
;;        表示          ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;

;;対応する括弧をハイライト表示させる設定
(show-paren-mode t)

;同名のファイルを開いたとき Switch to buffer などでファイル名がわかりやすく見えるようになる設定
(require 'uniquify)
(setq uniquify-buffer-name-style 'post-forward-angle-brackets)

;選択されたリージョンを色付きにしてわかりやすくする設定
(setq-default transient-mark-mode t)

;; マッチした場合の色
(set-face-background 'show-paren-match-face "RoyalBlue1")
(set-face-foreground 'show-paren-match-face "black")
;; マッチしていない場合の色
(set-face-background 'show-paren-mismatch-face "Red")
(set-face-foreground 'show-paren-mismatch-face "black")

;;メニューを日本語化
;(require 'menu-tree t)

;;;;;;;;;;;;;;;;;;;;;;;;;;
;;        基本          ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;

;; C-kで改行も含めてカットする
(setq kill-whole-line t)

;; Ctrl+Zで最小化しない
(define-key global-map "\C-z" 'scroll-down)

;;find-fileのファイル名補完で大文字小文字を区別しない設定
(setq read-file-name-completion-ignore-case t)

;;バックアップファイルを作成しない
(setq make-backup-files nil)

;; 行数を表示させる
(require 'linum)
(global-linum-mode t)
(setq linum-format "%4d ")

;;選択部分を一気にインデント
(global-set-key "\C-x\C-i" 'indent-region)

;;画面のスクロールの移動量を1にする
(setq scroll-step 1)

;;regionがactiveなときBackspaceでそれを削除
(defadvice backward-delete-char-untabify
  (around ys:backward-delete-region activate)
  (if (and transient-mark-mode mark-active)
      (delete-region (region-beginning) (region-end))
    ad-do-it))

;;;;;;;;;;;;;;;;;;;;;;;;;;
;;        補完          ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;

;;auto-complete
(setq load-path (cons "/home/lr/yuto/emacs-setup/auto-complete-1.3.1" load-path))
(require 'auto-complete)
(global-auto-complete-mode t)

;;補完が自動で起動するのを停止
(setq ac-auto-start nil)
;;補完の起動キーの設定
(ac-set-trigger-key "TAB")

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;        折り畳み          ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(add-hook 'python-mode-hook 'my-python-hook)

(defun py-outline-level ()
"This is so that `current-column` DTRT in otherwise-hidden text"
;; from ada-mode.el
(let (buffer-invisibility-spec)
(save-excursion
(skip-chars-forward "\t ")
(current-column))))

; this fragment originally came from the web somewhere, but the outline-regexp
; was horribly broken and is broken in all instances of this code floating
; around. Finally fixed by Charl P. Botha <<a href="http://cpbotha.net/">http://cpbotha.net/</a>>
(defun my-python-hook ()
(setq outline-regexp "[^ \t\n]\\|[ \t]*\\(def[ \t]+\\|class[ \t]+\\)")
; enable our level computation
(setq outline-level 'py-outline-level)
; do not use their \C-c@ prefix, too hard to type. Note this overides
;some python mode bindings
(setq outline-minor-mode-prefix "\C-c")
; turn on outline mode
(outline-minor-mode t)
; initially hide all but the headers
(hide-body)
(show-paren-mode 1)
)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;        Load Path          ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(setq load-path(append(list(expand-file-name "/home/lr/yuto/.emacs.d"))load-path))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;          Lookup           ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  (autoload 'lookup "lookup" nil t)
  (autoload 'lookup-region "lookup" nil t)
  (autoload 'lookup-pattern "lookup" nil t)
  (setq lookup-search-agents '((ndtp "dserver") (ndspell)))


;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;        Python          ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; pysmell
(setq load-path (cons "/home/lr/yuto/emacs-setup/pysmell-0.7.3" load-path))
(require 'pysmell)
(add-hook 'python-mode-hook (lambda () (pysmell-mode 1)))
(defvar ac-source-pysmell
  '((candidates
     . (lambda ()
         (require 'pysmell)
         (pysmell-get-all-completions))))
  "/home/lr/yuto/emacs-setup")
 
(add-hook 'python-mode-hook
          '(lambda ()
             (set (make-local-variable 'ac-sources) (append ac-sources '(ac-source-pysmell)))))

;; python-mode
(setq auto-mode-alist (cons '("\\.py$" . python-mode) auto-mode-alist))
(setq interpreter-mode-alist (cons '("python" . python-mode)
interpreter-mode-alist))
(autoload 'python-mode "python-mode" "Python editing mode." t)

;; pycomplete
(add-hook 'python-mode-hook '(lambda () 
     (require 'pycomplete)))

;; pymacs
(autoload 'pymacs-apply "pymacs")
(autoload 'pymacs-call "pymacs")
(autoload 'pymacs-eval "pymacs" nil t)
(autoload 'pymacs-exec "pymacs" nil t)
(autoload 'pymacs-load "pymacs" nil t)
(eval-after-load "pymacs"
  '(add-to-list 'pymacs-load-path "/home/lr/yuto/emacs-setup/python-mode"))