Skip to content

Instantly share code, notes, and snippets.

@TakashiUNUMA
Created May 7, 2016 08:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TakashiUNUMA/8676bb8aa92964dde9e2a7b8549ad335 to your computer and use it in GitHub Desktop.
Save TakashiUNUMA/8676bb8aa92964dde9e2a7b8549ad335 to your computer and use it in GitHub Desktop.
My .emacs setting file
;;
;; .emacs
;;
;; Last modified: 7th May 2016
;;
;; Load PATH
(add-to-list 'load-path "~/.emacs.d/scripts/")
;; package
;;(add-to-list 'load-path "~/.emacs.d/package/")
(require 'package)
(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
;(add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/"))
;(add-to-list 'package-archives '("elpy" . "http://jorgenschaefer.github.io/packages/"))
(package-initialize)
;; Mozc
(require 'mozc)
(setq default-input-method "japanese-mozc")
;; Ricty fonts
(add-to-list 'default-frame-alist '(font . "ricty-13.5"))
;; color-theme
;-- emacs24 built-in
;(load-theme 'manoj-dark t)
;-- manually installed
;(add-to-list 'load-path "~/.emacs.d/color-theme-6.6.0/")
;(require 'color-theme)
;(color-theme-initialize)
;; auto-complete
(add-to-list 'load-path "~/.emacs.d/auto-complete/")
(require 'auto-complete)
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "~/.emacs.d/auto-complete/ac-dict")
(ac-config-default)
(add-to-list 'ac-modes 'text-mode)
;; auto-complete-latex
(add-to-list 'load-path "~/.emacs.d/auto-complete-latex/")
(require 'auto-complete-latex)
(setq ac-l-dict-directory "~/.emacs.d/auto-complete-latex/ac-l-dict/")
(add-to-list 'ac-modes 'latex-mode)
(add-hook 'latex-mode-hook 'ac-l-setup)
;; yatex
(add-to-list 'load-path "~/.emacs.d/yatex/")
(when (require 'auto-complete-latex nil t)
(setq ac-l-dict-directory "~/.emacs.d/auto-complete-latex/ac-l-dict/")
(add-to-list 'ac-modes 'yatex-mode)
(add-hook 'yatex-mode-hook 'ac-l-setup))
(autoload 'yatex-mode "yatex" "Yet Another LaTeX mode" t)
(setq auto-mode-alist
(append '(("\\.tex$" . yatex-mode)
("\\.cls$" . yatex-mode)
("\\.sty$" . yatex-mode)) auto-mode-alist))
(setq YaTeX-inhibit-prefix-letter t)
; nil=YaTeX-kanji-code が nil なら coding-system に感知しない
; 0=no-converion -> Emacs 内部で使用されている文字コードで保存される (Emacs 23 以降では utf-8-emacs)
; 1=Shift JIS (Shift_JIS)
; 2=JIS (ISO-2022-JP)
; 3=EUC (EUC-JP)
; 4=UTF-8
(setq YaTeX-kanji-code nil)
(setq YaTeX-latex-message-code 'utf-8)
;; 自動改行の無効化
; -> yatex.el を編集済み
;(setq-default text-mode-hook 'turn-off-auto-fill)
;(setq-default yatex-mode-hook 'turn-off-auto-fill)
;(add-hook 'yatex-mode-hook '(lambda () (setq auto-fill-function nil) ))
;; yahtml
;(setq auto-mode-alist
; (cons (cons "\\.html$" 'yahtml-mode) auto-mode-alist))
;(autoload 'yahtml-mode "yahtml" "Yet Another HTML mode" t)
;; ispell and aspell
(setq-default ispell-program-name "aspell")
(eval-after-load "ispell"
'(add-to-list 'ispell-skip-region-alist '("[^\000-\377]+")))
;; ac-ispell
(add-to-list 'load-path "~/.emacs.d/ac-ispell/")
(add-hook 'text-mode-hook 'ac-ispell-ac-setup)
(add-hook 'yatex-mode-hook 'ac-ispell-ac-setup)
(add-hook 'latex-mode-hook 'ac-ispell-ac-setup)
(add-hook 'yahtml-mode-hook 'ac-ispell-ac-setup)
(add-hook 'html-mode-hook 'ac-ispell-ac-setup)
;; flyspell
(global-set-key (kbd "C-c <f8>") 'flyspell-mode)
(global-set-key (kbd "C-c <ESC> <f8>") 'flyspell-buffer)
;(add-to-list 'auto-mode-alist '("\\.txt" . flyspell-mode))
;(add-to-list 'auto-mode-alist '("\\.tex" . flyspell-mode))
(mapc
(lambda (hook)
(add-hook hook 'flyspell-prog-mode))
'(
c-mode-common-hook
fortran-mode-common-hook
f90-mode-hook
emacs-lisp-mode-hook
gs-mode-hook
ncl-mode-hook
php-mode-hook
))
(defun my-flyspell-mode-enable ()
(flyspell-mode 1))
(mapc
(lambda (hook)
(add-hook hook 'my-flyspell-mode-enable))
'(
yahtml-mode-hook
yatex-mode-hook
text-mode-hook
)
)
;;; --- 各種 mode 設定 ---
;; fortran90
(setq auto-mode-alist
(append '(("\\.f90$" . f90-mode)
("\\.F$" . f90-mode)) auto-mode-alist))
(autoload 'f90-mode "~/.emacs.d/scripts/f90.el")
(add-hook 'f90-mode-hook (lambda ()))
;; NCL scripts
(setq auto-mode-alist (cons '("\.ncl$" . ncl-mode) auto-mode-alist))
(autoload 'ncl-mode "~/.emacs.d/scripts/ncl.el")
(add-hook 'ncl-mode-hook (lambda ()))
;; GrADS scripts
(setq auto-mode-alist (cons '("\.gs$" . gs-mode) auto-mode-alist))
(autoload 'gs-mode "~/.emacs.d/scripts/gs-mode.el")
(add-hook 'gs-mode-hook (lambda ()))
;; PHP
(setq auto-mode-alist (cons '("\.php$" . php-mode) auto-mode-alist))
(autoload 'php-mode "~/.emacs.d/scripts/php-mode.el")
(add-hook 'php-mode-hook (lambda ()))
;; SCons
(setq tab-width 4)
(set-variable 'py-indent-offset 4)
(set-variable 'python-indent-guess-indent-offset nil)
(setq auto-mode-alist (cons '("SConstruct" . python-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("SConscript" . python-mode) auto-mode-alist))
;; jedi (Python) (package.elの設定より下に書く)
(require 'epc)
(require 'auto-complete-config)
(require 'python)
; PYTHONPATH上のソースコードがauto-completeの補完対象になる
(setenv "PYTHONPATH" "/usr/local/lib/python2.7/site-packages")
(require 'jedi)
(add-hook 'python-mode-hook 'jedi:setup)
(setq jedi:complete-on-dot t)
;; migemo (全般的な補完機能)
(load "migemo.elc")
(setq migemo-use-pattern-alist t)
(setq migemo-use-frequent-pattern-alist t)
;; mew
(require 'mew)
(autoload 'mew "mew" nil t)
(autoload 'mew-send "mew" nil t)
;; Optional setup (Read Mail menu):
(setq read-mail-command 'mew)
;; Optional setup (e.g. C-xm for sending a message):
(autoload 'mew-user-agent-compose "mew" nil t)
(if (boundp 'mail-user-agent)
(setq mail-user-agent 'mew-user-agent))
(if (fboundp 'define-mail-user-agent)
(define-mail-user-agent
'mew-user-agent
'mew-user-agent-compose
'mew-draft-send-message
'mew-draft-kill
'mew-send-hook))
;; grammar
;(require 'grammar)
;(setq grammar-program-name "~/.emacs.d/scripts/grammar.el")
;(set-face-attribute 'grammar-error-face nil
; :background "#Ff6347"
; :foreground "#000000")
;(add-hook 'twittering-edit-mode-hook 'grammar-mode)
;; pukiwiki-mode
;; (add-to-list 'load-path "~/.emacs.d/pukiwiki/")
;; (load-library "pukiwiki-mode")
;; (add-hook 'pukiwiki-mode-hook (lambda ()))
;; (setq pukiwiki-site-list
;; '(
;; ("unuwiki" "http://localhost/wiki/pukiwiki/" nil utf-8-unix)
;; )
;; )
;; (setq pukiwiki-auto-insert t)
;; (autoload 'pukiwiki-edit "pukiwiki-mode" nil t)
;; (autoload 'pukiwiki-index "pukiwiki-mode" nil t)
;; (autoload 'pukiwiki-edit-url "pukiwiki-mode" nil t)
;; lookup
;; (autoload 'lookup "lookup" nil t)
;; (autoload 'lookup-region "lookup" nil t)
;; (autoload 'lookup-pattern "lookup" nil t)
;; (global-set-key "\C-cw" 'lookup-pattern)
;; (global-set-key "\C-cW" 'lookup-word)
;; (setq lookup-search-agents
;; '(
;; (ndeb "/usr/share/dict" :alias "英辞郎")
;; ))
;; sdic-eijiro for tooltip
;; (defun temp-cancel-read-only (function &optional jaspace-off)
;; "eval temporarily cancel buffer-read-only
;; &optional t is turn of jaspace-mode"
;; (let ((read-only-p nil)
;; (jaspace-mode-p nil))
;; (when (and jaspace-off jaspace-mode)
;; (jaspace-mode)
;; (setq jaspace-mode-p t))
;; (when buffer-read-only
;; (toggle-read-only)
;; (setq read-only-p t))
;; (eval function)
;; (when read-only-p
;; (toggle-read-only))
;; (when jaspace-mode-p
;; (jaspace-mode))))
;; (defun my-sdic-describe-word-with-popup (word &optional search-function)
;; "Display the meaning of word."
;; (interactive
;; (let ((f (if current-prefix-arg (sdic-select-search-function)))
;; (w (sdic-read-from-minibuffer)))
;; (list w f)))
;; (let ((old-buf (current-buffer))
;; (dict-data))
;; (set-buffer (get-buffer-create sdic-buffer-name))
;; (or (string= mode-name sdic-mode-name) (sdic-mode))
;; (erase-buffer)
;; (let ((case-fold-search t)
;; (sdic-buffer-start-point (point-min)))
;; (if (prog1 (funcall (or search-function
;; (if (string-match "\\cj" word)
;; 'sdic-search-waei-dictionary
;; 'sdic-search-eiwa-dictionary))
;; word)
;; (set-buffer-modified-p nil)
;; (setq dict-data (buffer-string))
;; (set-buffer old-buf))
;; (temp-cancel-read-only
;; '(popup-tip dict-data :scroll-bar t :truncate nil))
;; (message "Can't find word, \"%s\"." word))))
;; )
;; (defadvice sdic-describe-word-at-point (around sdic-popup-advice activate)
;; (letf (((symbol-function 'sdic-describe-word) (symbol-function 'my-sdic-describe-word-with-popup)))
;; ad-do-it))
;; (global-set-key "\C-cp" 'sdic-describe-word-at-point)
;; sdic-eijiro
;; (autoload 'sdic-describe-word "sdic" "search word" t nil)
;; (global-set-key "\C-cw" 'sdic-describe-word)
;; (autoload 'sdic-describe-word-at-point "sdic" "search word at the cursor" t nil)
;; (global-set-key "\C-cW" 'sdic-describe-word-at-point)
;; (eval-after-load "sdic"
;; '(progn
;; (setq sdicf-array-command "/usr/bin/sary")
;; (setq sdic-eiwa-dictionary-list
;; '((sdicf-client "/usr/share/dict/eijiro-utf8.sdic" (strategy array)))
;; sdic-waei-dictionary-list
;; '((sdicf-client "/usr/share/dict/waeijiro-utf8.sdic" (strategy array))))
;; (fset 'sdicf-array-init 'sdicf-common-init)
;; (fset 'sdicf-array-quit 'sdicf-common-quit)
;; (fset 'sdicf-array-search
;; (lambda (sdic pattern &optional case regexp)
;; (sdicf-array-init sdic)
;; (if regexp
;; (signal 'sdicf-invalid-method '(regexp))
;; (save-excursion
;; (set-buffer (sdicf-get-buffer sdic))
;; (delete-region (point-min) (point-max))
;; (apply 'sdicf-call-process
;; sdicf-array-command
;; (sdicf-get-coding-system sdic)
;; nil t nil
;; (if case
;; (list "-i" pattern (sdicf-get-filename sdic))
;; (list pattern (sdicf-get-filename sdic))))
;; (goto-char (point-min))
;; (let (entries)
;; (while (not (eobp)) (sdicf-search-internal))
;; (nreverse entries))))))
;; (defadvice sdic-forward-item (after sdic-forward-item-always-top activate)
;; (recenter 0))
;; (defadvice sdic-backward-item (after sdic-backward-item-always-top activate)
;; (recenter 0))))
;; (setq sdic-default-coding-system 'utf-8-unix)
(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)
'(inhibit-startup-screen 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.
'(comint-highlight-prompt ((t (:inherit minibuffer-prompt :background "white"))))
'(custom-comment-tag ((t (:foreground "skyblue"))))
'(font-lock-comment-face ((t (:foreground "pink"))))
'(highlight ((t (:background "yellow" :foreground "black"))))
'(link ((t (:foreground "cyan" :underline t))))
'(minibuffer-prompt ((t (:foreground "skyblue")))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment