Created
July 19, 2010 10:23
-
-
Save handlename/481244 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; ;;; .emacs written by NAGATA Hiroaki (handlename.net) | |
(add-to-list 'load-path "~/.emacs.d/site-lisp/") | |
(require 'cl) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; General settings ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; | |
;; mail address | |
;;______________________________________________________________________ | |
(setq user-mail-address "main@handlename.net") | |
;; | |
;; meta key | |
;;______________________________________________________________________ | |
(setq ns-command-modifier (quote meta)) | |
(setq ns-alternate-modifier (quote super)) | |
;; | |
;; Window settings | |
;;______________________________________________________________________ | |
(if window-system | |
(progn | |
(set-background-color "Black") | |
(set-foreground-color "LightGray") | |
(set-cursor-color "Red") | |
(set-frame-parameter nil 'alpha 80) | |
(tool-bar-mode nil) | |
(set-scroll-bar-mode nil) | |
(setq line-spacing 0.2) | |
(when (>= emacs-major-version 23) | |
(tool-bar-mode nil) | |
(set-face-attribute 'default nil | |
:family "M+2VM+IPAG circle" | |
:height 140) | |
(set-fontset-font | |
(frame-parameter nil 'font) | |
'japanese-jisx0208 | |
'("M+2VM+IPAG circle" . "iso10646-1")) | |
(set-fontset-font | |
(frame-parameter nil 'font) | |
'japanese-jisx0212 | |
'("M+2VM+IPAG circle" . "iso10646-1")) | |
(set-fontset-font | |
(frame-parameter nil 'font) | |
'mule-unicode-0100-24ff | |
'("M+2VM+IPAG circle" . "iso10646-1")) | |
(setq face-font-rescale-alist | |
'(("^-apple-hiragino.*" . 1.3) | |
(".*osaka-bold.*" . 1.2) | |
(".*osaka-medium.*" . 1.2) | |
(".*courier-bold-.*-mac-roman" . 1.0) | |
(".*monaco cy-bold-.*-mac-cyrillic" . 0.9) | |
(".*monaco-bold-.*-mac-roman" . 0.9) | |
("-cdac$" . 1.3)))) | |
(ns-toggle-fullscreen) | |
(setq ns-pop-up-frames nil) | |
)) | |
;; | |
;; encoding | |
;;______________________________________________________________________ | |
(set-language-environment "Japanese") | |
(prefer-coding-system 'utf-8-unix) | |
(setq default-buffer-file-coding-system 'utf-8) | |
(set-buffer-file-coding-system 'utf-8) | |
(set-terminal-coding-system 'utf-8) | |
(set-keyboard-coding-system 'utf-8) | |
(set-clipboard-coding-system 'utf-8) | |
;; | |
;; general key bind | |
;;______________________________________________________________________ | |
(global-set-key (kbd "C-c a") 'align) | |
(global-set-key (kbd "C-c M-a") 'align-regexp) | |
(global-set-key (kbd "C-h") 'backward-delete-char) | |
(global-set-key (kbd "C-c d") 'delete-indentation) | |
(global-set-key (kbd "M-g") 'goto-line) | |
(global-set-key (kbd "C-S-i") 'indent-region) | |
(global-set-key (kbd "C-m") 'newline-and-indent) | |
(global-set-key (kbd "C-t") 'next-multiframe-window) | |
(global-set-key (kbd "M-<RET>") 'ns-toggle-fullscreen) | |
(global-set-key (kbd "C-S-t") 'previous-multiframe-window) | |
(global-set-key (kbd "C-M-r") 'replace-regexp) | |
(global-set-key (kbd "C-r") 'replace-string) | |
(global-set-key (kbd "C-/") 'undo) | |
;; | |
;; backup file | |
;;______________________________________________________________________ | |
(defun make-backup-file-name (filename) | |
(expand-file-name | |
(concat "~/.backup/" (file-name-nondirectory filename) "~") | |
(file-name-directory filename))) | |
;; | |
;; miscellaneous | |
;;______________________________________________________________________ | |
;; Bell | |
(setq ring-bell-function 'ignore) | |
;; Scroll | |
(setq scroll-step 1) | |
;; Line and column number | |
(global-linum-mode) | |
(column-number-mode t) | |
;; Fill column | |
(setq default-fill-column 72) | |
;; Truncate | |
(setq truncate-lines t) | |
(setq truncate-partial-width-windows t) | |
;; Indent | |
(setq-default tab-width 4) | |
(setq-default indent-tabs-mode nil) | |
(setq-default c-basic-offset 4) | |
(setq-default tab-width 4) | |
;; Narrowing | |
(put 'narrow-to-region 'disabled nil) | |
;; Delete trailing whitespace before saving | |
(add-hook 'before-save-hook 'delete-trailing-whitespace) | |
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; ;; Custom commands ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; | |
;; kill-all-buffers | |
;;______________________________________________________________________ | |
(defun kill-all-buffers () | |
(interactive) | |
(loop for buffer being the buffers | |
do (kill-buffer buffer))) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; Additional functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; | |
;; align | |
;;______________________________________________________________________ | |
(require 'align) | |
;; Align for php-mode | |
;; http://d.hatena.ne.jp/Tetsujin/20070614/1181757931 | |
(add-to-list 'align-rules-list | |
'(php-assignment | |
(regexp . "[^-=!^&*+<>/.| \t\n]\\(\\s-*[.-=!^&*+<>/|]*\\)=>?\\(\\s-*\\)\\([^= \t\n]\\|$\\)") | |
(justify . t) | |
(tab-stop . nil) | |
(modes . '(php-mode)))) | |
(add-to-list 'align-dq-string-modes 'php-mode) | |
(add-to-list 'align-sq-string-modes 'php-mode) | |
(add-to-list 'align-open-comment-modes 'php-mode) | |
(setq align-region-separate (concat "\\(^\\s-*$\\)\\|" | |
"\\([({}\\(/\*\\)]$\\)\\|" | |
"\\(^\\s-*[)}\\(\*/\\)][,;]?$\\)\\|" | |
"\\(^\\s-*\\(}\\|for\\|while\\|if\\|else\\|" | |
"switch\\|case\\|break\\|continue\\|do\\)[ ;]\\)" | |
)) | |
;; for ruby-mode | |
;; http://d.hatena.ne.jp/rubikitch/20080227/1204051280 | |
(add-to-list 'align-rules-list | |
'(ruby-comma-delimiter | |
(regexp . ",\\(\\s-*\\)[^# \t\n]") | |
(repeat . t) | |
(modes . '(ruby-mode)))) | |
(add-to-list 'align-rules-list | |
'(ruby-hash-literal | |
(regexp . "\\(\\s-*\\)=>\\s-*[^# \t\n]") | |
(repeat . t) | |
(modes . '(ruby-mode)))) | |
(add-to-list 'align-rules-list | |
'(ruby-assignment-literal | |
(regexp . "\\(\\s-*\\)=\\s-*[^# \t\n]") | |
(repeat . t) | |
(modes . '(ruby-mode)))) | |
(add-to-list 'align-rules-list ;TODO add to rcodetools.el | |
'(ruby-xmpfilter-mark | |
(regexp . "\\(\\s-*\\)# => [^#\t\n]") | |
(repeat . nil) | |
(modes . '(ruby-mode)))) | |
;; for css-mode | |
;; | |
;; anything | |
;;______________________________________________________________________ | |
(require 'anything-config) | |
(define-key anything-map (kbd "C-M-n") 'anything-next-source) | |
(define-key anything-map (kbd "C-M-p") 'anything-previous-source) | |
;; Don't record histories. If not, anything get error | |
(remove-hook 'kill-emacs-hook 'anything-c-adaptive-save-history) | |
(ad-disable-advice 'anything-exit-minibuffer 'before 'anything-c-adaptive-exit-minibuffer) | |
(ad-disable-advice 'anything-select-action 'before 'anything-c-adaptive-select-action) | |
(setq anything-c-adaptive-history-length 0) | |
;; Serach for current buffer | |
(defun anything-for-occur () | |
"Search current buffer in anything" | |
(interactive) | |
(anything '(anything-c-source-occur))) | |
(define-key global-map (kbd "C-s") 'anything-for-occur) | |
;; buffer list + buffer history + files in current directory | |
(defun anything-for-buffers () | |
"Open buffer list in anything" | |
(interactive) | |
(anything '(anything-c-source-buffers | |
anything-c-source-file-name-history | |
anything-c-source-files-in-current-dir))) | |
(define-key global-map (kbd "C-x b") 'anything-for-buffers) | |
;; calc | |
(defun anything-for-calc () | |
"Calculate in anything" | |
(interactive) | |
(anything '(anything-c-source-calculation-result))) | |
(define-key global-map (kbd "C-M-c") 'anything-for-calc) | |
;; killring history | |
(define-key global-map (kbd "C-M-y") 'anything-show-kill-ring) | |
;; emacs commands | |
(defun anything-for-emacs-commands () | |
"Execute emacs commands in anything" | |
(interactive) | |
(anything '(anything-c-source-emacs-commands))) | |
(define-key global-map (kbd "M-x") 'anything-for-emacs-commands) | |
;; tag jump | |
(require 'anything-etags) | |
(require 'anything-gtags) | |
(defun anything-etags-and-gtags-select () | |
"Tag jump using etags, gtags and `anything'." | |
(interactive) | |
(let* ((initial-pattern (regexp-quote (or (thing-at-point 'symbol) "")))) | |
(anything (list anything-c-source-gtags-select | |
anything-c-source-etags-select)) | |
"Find Tag: " nil)) | |
(define-key global-map (kbd "C-x t") 'anything-etags-and-gtags-select) | |
;; | |
;; highlight | |
;;______________________________________________________________________ | |
;; highlight current line | |
(require 'highlight-current-line) | |
(highlight-current-line-on t) | |
(set-face-background 'highlight-current-line-face "#191919") | |
;; hilight paren | |
(show-paren-mode 1) | |
;; highlight reagion | |
(setq transient-mark-mode t) | |
;; highlight edit characters | |
(require 'jaspace) | |
(setq jaspace-highlight-tabs t) | |
(add-hook 'mmm-mode-hook 'jaspace-mmm-mode-hook) | |
;; highlight current buffer | |
;; http://ksugita.blog62.fc2.com/blog-entry-8.html | |
(load-file "~/.emacs.d/site-lisp/hiwin.el") | |
(setq hiwin-color "#191919") | |
(hiwin-mode) | |
;; | |
;; Install elisp | |
;;______________________________________________________________________ | |
(require 'install-elisp) | |
(setq install-elisp-repository-directory "~/.emacs.d/") | |
;; | |
;; open file as root | |
;;______________________________________________________________________ | |
(defun th-rename-tramp-buffer () | |
(when (file-remote-p (buffer-file-name)) | |
(rename-buffer | |
(format "%s:%s" | |
(file-remote-p (buffer-file-name) 'method) | |
(buffer-name))))) | |
(add-hook 'find-file-hook | |
'th-rename-tramp-buffer) | |
(defadvice find-file (around th-find-file activate) | |
"Open FILENAME using tramp's sudo method if it's read-only." | |
(if (and (not (file-writable-p (ad-get-arg 0))) | |
(y-or-n-p (concat "File " | |
(ad-get-arg 0) | |
" is read-only. Open it as root? "))) | |
(th-find-file-sudo (ad-get-arg 0)) | |
ad-do-it)) | |
(defun th-find-file-sudo (file) | |
"Opens FILE with root privileges." | |
(interactive "F") | |
(set-buffer (find-file (concat "/sudo::" file)))) | |
;; | |
;; sense-region | |
;; http://taiyaki.org/elisp/sense-region/ | |
;;______________________________________________________________________ | |
(autoload 'sense-region-on | |
"sense-region" | |
"System to toggle region and rectangle." t nil) | |
(sense-region-on) | |
;; | |
;; revive | |
;;______________________________________________________________________ | |
(autoload 'save-current-configuration "revive" "Save status" t) | |
(autoload 'resume "revive" "Resume Emacs" t) | |
(autoload 'wipe "revive" "Wipe emacs" t) | |
(define-key global-map (kbd "C-x S") 'save-current-configuration) | |
(define-key global-map (kbd "C-x F") 'resume) | |
(add-hook 'kill-emacs-hook 'save-current-configuration) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; major mode settings ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; | |
;; c++-mode | |
;;______________________________________________________________________ | |
(setenv "CPLUS_INCLUDE_PATH" "/opt/local/include") | |
(add-to-list 'auto-mode-alist '("\\.h\\'" . c++-mode)) | |
(add-hook 'c++-mode-hook | |
'(lambda () | |
(local-set-key (kbd "C-c c") 'compile) | |
(c-set-style "cc-mode"))) | |
;; | |
;; change-log-mode | |
;;______________________________________________________________________ | |
(add-hook 'change-log-mode-hook | |
'(lambda () | |
(setq tab-width 4) | |
(setq left-margin 4))) | |
;; | |
;; html-helper-mode | |
;;______________________________________________________________________ | |
(autoload 'html-helper-mode "html-helper-mode" "Yay HTML" t) | |
(setq auto-mode-alist (cons '("\\.html$" . html-helper-mode) auto-mode-alist)) | |
(setq html-helper-basic-offset 0) | |
(setq html-helper-item-continue-indent 0) | |
(defvar html-helper-new-buffer-template | |
'("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n" | |
"<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"ja\" lang=\"ja\">\n" | |
"\n" | |
"<head>\n" | |
"<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\">\n" | |
"<title></title>\n" | |
"</head>\n" | |
"\n" | |
"<body>\n" | |
"\n" | |
"\n" | |
"\n" | |
"</body>\n" | |
"</html>\n") | |
"*Template for new buffers, inserted by html-helper-insert-new-buffer-strings if html-helper-build-new-buffer is set to t") | |
(require 'sgml-mode) | |
(add-hook 'html-helper-mode-hook | |
'(lambda () | |
(local-set-key (kbd "C-c C-e") 'sgml-close-tag))) | |
;; | |
;; emacs-lisp-mode | |
;;______________________________________________________________________ | |
(add-hook 'emacs-lisp-mode-hook | |
'(lambda () | |
(local-set-key (kbd "C-c C-e") 'eval-last-sexp) | |
(local-set-key (kbd "C-c e") 'eval-region) | |
(setq indent-tabs-mode nil))) | |
;; | |
;; Js2-mode | |
;;______________________________________________________________________ | |
;; (autoload 'js2-mode "js2" nil t) | |
;; (add-to-list 'auto-mode-alist '("\\.js$" . js2-mode)) | |
;; | |
;; lisp-mode | |
;;______________________________________________________________________ | |
(add-hook 'lisp-mode-hook | |
'(lambda () | |
(local-set-key (kbd "C-c C-e") 'eval-last-sexp) | |
(local-set-key (kbd "C-c e") 'eval-region) | |
(setq indent-tabs-mode nil))) | |
;; | |
;; org-mode | |
;;______________________________________________________________________ | |
(require 'org-install) | |
;; | |
;; php-mode | |
;;______________________________________________________________________ | |
(require 'php-mode) | |
(autoload 'php-mode "php-mode") | |
;; (setq auto-mode-alist | |
;; (cons '("\\.php\\'" . php-mode) auto-mode-alist)) | |
(setq php-mode-force-pear) | |
(add-hook 'php-mode-hook | |
'(lambda () | |
(setq php-manual-path "/usr/share/doc/php/html") | |
(setq php-search-url "http://www.phppro.jp/") | |
(setq php-manual-url "http://www.phppro.jp/phpmanual") | |
(setq tab-width 4) | |
(setq c-basic-offset 4))) | |
;; | |
;; ruby-mode | |
;;______________________________________________________________________ | |
(add-hook 'ruby-mode-hook | |
'(lambda () | |
(setq tab-width 4) | |
(setq ruby-indent-level tab-width))) | |
;; | |
;; yatex-mode | |
;;______________________________________________________________________ | |
(require 'yaml-mode) | |
(add-to-list 'auto-mode-alist '("\\.yml$" . yaml-mode)) | |
(add-hook 'yaml-mode-hook | |
'(lambda () | |
(define-key yaml-mode-map "\C-m" 'newline-and-indent))) | |
;; | |
;; yatex-mode | |
;;______________________________________________________________________ | |
(add-to-list 'load-path "~/.emacs.d/site-lisp/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 "/opt/local/bin/platex") | |
(setq dvi2-command "/opt/local/bin/xdvi") | |
(setq YaTeX-kanji-code 4) ;; utf-8 | |
(add-hook 'yatex-mode-hook'(lambda ()(setq auto-fill-function nil))) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; minor mode settings ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; | |
;; auto complete | |
;;______________________________________________________________________ | |
(require 'auto-complete) | |
(append '(yahtml-mode) ac-modes) | |
(global-auto-complete-mode t) | |
(define-key ac-complete-mode-map (kbd "M-n") 'ac-next) | |
(define-key ac-complete-mode-map (kbd "M-p") 'ac-previous) | |
;; ac-my-completion for auto-complete | |
(defun ac-my-completion-list-in-files (files &optional keywords-variable) | |
"create completion list for auto-complete" | |
(let ((ksymbol keywords-variable) keywords) | |
(cond | |
((stringp files) | |
(setq files (list files))) | |
((stringp keywords-variable) | |
(setq ksymbol (intern keywords-variable)))) | |
(if (not (boundp ksymbol)) | |
(progn | |
(dolist (file files) | |
(let ((buffer (find-file-noselect file)) filename) | |
(setq filename (file-name-nondirectory file)) | |
(with-current-buffer buffer | |
(rename-buffer | |
(concat " *" filename "*") t) | |
(if (< (buffer-size) 131072) ; 128Kb | |
(save-excursion | |
(goto-char (point-min)) | |
(while (re-search-forward "^[^;]\\(\\s_\\|\\sw\\)+\\b$" nil t) | |
(let ((candidate (match-string-no-properties 0))) | |
(if (not (member candidate keywords)) | |
(push candidate keywords)))) | |
(setq keywords (nreverse keywords))))))) | |
;; (sort keywords #'(lambda (a b) (> (length a) (length b)))) | |
(if ksymbol | |
(set-default ksymbol keywords)) | |
(message (concat "Building ac-source keywords(" (symbol-name ksymbol) ")...done.")) | |
keywords)))) | |
(defun ac-my-completion-files (files mode-name &optional set-hook) | |
"set completion list to mode-variable for auto-complete" | |
(lexical-let | |
((--ac-source (intern (concat "ac-source-" mode-name))) | |
(--ac-source-keywords (intern (concat "ac-source-" mode-name "-keywords"))) | |
(--mode-hook (intern (concat mode-name "-mode-hook"))) | |
(--files files)) | |
(set-default --ac-source | |
(list (cons 'candidates | |
(lambda () | |
(all-completions ac-prefix (symbol-value --ac-source-keywords)))))) | |
(if set-hook | |
(add-hook --mode-hook | |
(lambda() | |
(ac-my-completion-list-in-files --files --ac-source-keywords) | |
(make-local-variable 'ac-sources) | |
(setq ac-sources (append ac-sources (list --ac-source))))) | |
(ac-my-completion-list-in-files --files --ac-source-keywords)))) | |
;; 以下をモード毎に設定 | |
(ac-my-completion-files "~/.emacs.d/completions/javascript+DOM" "js" t) | |
(ac-my-completion-files "~/.emacs.d/completions/C" "c" t) | |
(ac-my-completion-files "~/.emacs.d/completions/C++" "c++" t) | |
(ac-my-completion-files "~/.emacs.d/completions/CSS" "css" t) | |
(ac-my-completion-files "~/.emacs.d/completions/elisp" "emacs-lisp" t) | |
(ac-my-completion-files "~/.emacs.d/completions/HTML" "html-helper" t) | |
(ac-my-completion-files "~/.emacs.d/completions/HTML" "yahtml" t) | |
(ac-my-completion-files "~/.emacs.d/completions/PHP" "php" t) | |
(ac-my-completion-files "~/.emacs.d/completions/Ruby" "ruby" t) | |
(ac-my-completion-files "~/.emacs.d/completions/TeX" "yatex" t) | |
;; auto-complete-etags | |
(require 'auto-complete-etags) | |
;; | |
;; clmemo | |
;;______________________________________________________________________ | |
(autoload 'clmemo "clmemo" "ChangeLog memo mode." t) | |
(setq clmemo-file-name "~/Dropbox/chalow/changelog") | |
(global-set-key (kbd "C-x m") 'clmemo) | |
;; | |
;; Flymake | |
;;______________________________________________________________________ | |
(require 'flymake) | |
;; http://svn.coderepos.org/share/lang/elisp/set-perl5lib/set-perl5lib.el | |
(require 'set-perl5lib) | |
;; The face for errors and warnings | |
(set-face-background 'flymake-errline "red4") | |
(set-face-foreground 'flymake-errline "white") | |
(set-face-background 'flymake-warnline "yellow") | |
(set-face-foreground 'flymake-warnline "black") | |
;; Display errer message in mini buffer | |
;; http://d.hatena.ne.jp/xcezx/20080314/1205475020 | |
(defun flymake-display-err-minibuf () | |
"Displays the error/warning for the current line in the minibuffer" | |
(interactive) | |
(let* ((line-no (flymake-current-line-no)) | |
(line-err-info-list (nth 0 (flymake-find-err-info | |
flymake-err-info line-no))) | |
(count (length line-err-info-list))) | |
(while (> count 0) | |
(when line-err-info-list | |
(let* ((file (flymake-ler-file | |
(nth (1- count) line-err-info-list))) | |
(full-file (flymake-ler-full-file | |
(nth (1- count) line-err-info-list))) | |
(text (flymake-ler-text | |
(nth (1- count) line-err-info-list))) | |
(line (flymake-ler-line | |
(nth (1- count) line-err-info-list)))) | |
(message "[%s] %s" line text))) | |
(setq count (1- count))))) | |
(global-set-key "\C-cd" 'flymake-display-err-minibuf) | |
;; for C++ | |
;; http://d.hatena.ne.jp/suztomo/20080905/1220633281 | |
;; (defun flymake-cc-init () | |
;; (let* ((temp-file (flymake-init-create-temp-buffer-copy | |
;; 'flymake-create-temp-inplace)) | |
;; (local-file (file-relative-name | |
;; temp-file | |
;; (file-name-directory buffer-file-name)))) | |
;; (list "g++" (list "-Wall" "-Wextra" "-fsyntax-only" local-file)))) | |
;; (defun flymake-cch-init () | |
;; (let* ((temp-file (flymake-init-create-temp-buffer-copy | |
;; 'flymake-create-temp-inplace)) | |
;; (local-file (file-relative-name | |
;; temp-file | |
;; (file-name-directory buffer-file-name)))) | |
;; (list "g++" | |
;; (list "-Wall" "-Wextra" "-fsyntax-only" "-x c++-header" local-file)))) | |
;; (push '("\\.h$" flymake-cc-init) flymake-allowed-file-name-masks) | |
;; (push '("\\.cpp$" flymake-cc-init) flymake-allowed-file-name-masks) | |
;; (push '("\\.hpp$" flymake-cch-init) flymake-allowed-file-name-masks) | |
;; (add-hook 'c++-mode-hook | |
;; '(lambda () | |
;; (flymake-mode t))) | |
;; for C | |
;; (defun flymake-c-init () | |
;; (let* ((temp-file (flymake-init-create-temp-buffer-copy | |
;; 'flymake-create-temp-inplace)) | |
;; (local-file (file-relative-name | |
;; temp-file | |
;; (file-name-directory buffer-file-name)))) | |
;; (list "gcc" | |
;; (list "-Wall" "-Wextra" "-fsyntax-only" local-file)))) | |
;; (push '("\\.h$" flymake-cc-init) flymake-allowed-file-name-masks) | |
;; (push '("\\.c$" flymake-cc-init) flymake-allowed-file-name-masks) | |
;; (add-hook 'c-mode-hook | |
;; '(lambda () | |
;; (flymake-mode t))) | |
;; ;; for Perl | |
;; ;; http://unknownplace.org/memo/2007/12/21#e001 | |
;; (defvar flymake-perl-err-line-patterns | |
;; '(("\\(.*\\) at \\([^ \n]+\\) line \\([0-9]+\\)[,.\n]" 2 3 nil 1))) | |
;; (defconst flymake-allowed-perl-file-name-masks | |
;; '(("\\.pl$" flymake-perl-init) | |
;; ("\\.pm$" flymake-perl-init) | |
;; ("\\.t$" flymake-perl-init))) | |
;; (defun flymake-perl-init () | |
;; (let* ((temp-file (flymake-init-create-temp-buffer-copy | |
;; 'flymake-create-temp-inplace)) | |
;; (local-file (file-relative-name | |
;; temp-file | |
;; (file-name-directory buffer-file-name)))) | |
;; (list "perl" (list "-wc" local-file)))) | |
;; (defun flymake-perl-load () | |
;; (interactive) | |
;; (defadvice flymake-post-syntax-check (before flymake-force-check-was-interrupted) | |
;; (setq flymake-check-was-interrupted t)) | |
;; (ad-activate 'flymake-post-syntax-check) | |
;; (setq flymake-allowed-file-name-masks | |
;; (append flymake-allowed-file-name-masks flymake-allowed-perl-file-name-masks)) | |
;; (setq flymake-err-line-patterns flymake-perl-err-line-patterns) | |
;; (set-perl5lib) | |
;; (flymake-mode t)) | |
;; (add-hook 'cperl-mode-hook 'flymake-perl-load) | |
;; | |
;; mmm-mode | |
;;______________________________________________________________________ | |
(require 'mmm-mode) | |
(setq mmm-global-mode 'maybe) | |
(set-face-background 'mmm-default-submode-face "#111111") | |
;; Setting from http://www.bookshelf.jp/soft/meadow_13.html#SEC101 | |
;; html + css | |
(mmm-add-classes | |
'((mmm-css-in-html | |
:submode css-mode | |
:front "<style[^>]*>" | |
:back "</style>"))) | |
(mmm-add-mode-ext-class nil "\\.html?\\'" 'mmm-css-in-html) | |
;; html + js | |
(mmm-add-classes | |
'((mmm-js-in-html | |
:submode js-mode | |
:front "<script[^>]*>[^<]" | |
:front-offset -1 | |
:back "\n?[ \t]*</script>"))) | |
(mmm-add-mode-ext-class nil "\\.html?\\'" 'mmm-js-in-html) | |
;; php + html + js + css | |
;;(add-to-list 'auto-mode-alist '("\\.php?\\'" . html-helper-mode)) | |
(mmm-add-classes | |
'((mmm-php-in-html | |
:submode php-mode | |
:front "<\\?\\(php\\)?" | |
:back "\\?>"))) | |
(mmm-add-mode-ext-class nil "\\.php?\\'" 'mmm-php-in-html) | |
;; (mmm-add-mode-ext-class nil "\\.php?\\'" 'mmm-css-in-html) | |
;; (mmm-add-mode-ext-class nil "\\.php?\\'" 'mmm-js-in-html) | |
;; インデントが効かなくなるのを解消 | |
(defun save-mmm-c-locals () | |
(with-temp-buffer | |
(php-mode) | |
(dolist (v (buffer-local-variables)) | |
(when (string-match "\\`c-" (symbol-name (car v))) | |
(add-to-list 'mmm-save-local-variables `(,(car v) nil | |
,mmm-c-derived-modes)))))) | |
(save-mmm-c-locals) | |
;; | |
;; symfony-minor-mode | |
;;______________________________________________________________________ | |
(require 'symfony) | |
;; | |
;; zencoding-mode | |
;;______________________________________________________________________ | |
(require 'zencoding-mode) | |
(add-hook 'html-helper-mode-hook 'zencoding-mode) | |
(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. | |
'(gud-gdb-command-name "gdb --annotate=1") | |
'(large-file-warning-threshold nil) | |
'(safe-local-variable-values (quote ((clmemo-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. | |
) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; Initial process ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
(resume) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment