Skip to content

Instantly share code, notes, and snippets.

@srbmiy srbmiy/linux.emacs.el
Last active Dec 14, 2015

Embed
What would you like to do?
Emacs設定晒し
;; Ubuntuでの設定です。.emacs.dの中身とかは察して下さい
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Set-up modes ;;
(show-paren-mode t)
(define-key global-map [f4] 'kill-frame)
(define-key global-map [f5] 'make-frame)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Program modes ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Flymake
(require 'flymake)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; CC mode hooks
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; CC flymake
(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))))
(push '("\\.cc$" flymake-cc-init) flymake-allowed-file-name-masks)
(add-hook 'c++-mode-hook
'(lambda ()
(flymake-mode t)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Python mode hook
(add-to-list 'auto-mode-alist '("\\.py\\'" . python-mode))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Coq mode hook
(load-file "~/.emacs.d/proofgeneral/generic/proof-site.el")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Haskell mode hook
(load "~/.emacs.d/haskell-mode/haskell-site-file")
(require 'haskell-mode)
(add-to-list 'auto-mode-alist '("\\.hs$" . haskell-mode))
(add-hook 'haskell-mode-hook '(lambda ()
(turn-on-haskell-indentation)))
;; Scala mode hook -- 停止中
;;(add-to-list 'load-path "~/.emacs.d/scala-mode/")
;;(load "~/.emacs.d/scala-mode/scala-mode-auto.el")
;;(add-hook 'scala-mode-hook '(lambda ()
;; (scala-mode-feature-electric-mode)))
;;(add-to-list 'auto-mode-alist '("\\.scala$" . scala-mode))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Scheme mode hook
(add-to-list 'auto-mode-alist '("\\.scm$" . scheme-mode))
(setq scheme-program-name "gosh -i")
(autoload 'scheme-mode "cmuscheme" "Major mode for Scheme." t)
(autoload 'run-scheme "cmuscheme" "Run an inferior Scheme process." t)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Scheme flymake
;; This requires package -- glint, codechecker written by gauche
(defvar flymake-glint-err-line-patterns '(("^\\(.+\\):\\([0-9]+\\): \\(.+\\)$" 1 2 nil 3)))
(defconst flymake-allowed-gauche-file-name-masks '(("\\.scm$" flymake-gauche-init)))
(defun flymake-gauche-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 "glint" (list local-file))))
(defun flymake-gauche-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-gauche-file-name-masks))
(setq flymake-err-line-patterns flymake-glint-err-line-patterns)
(flymake-mode t))
(defun credmp/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)))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Scheme mode hook
(add-hook 'scheme-mode-hook '(lambda ()
(flymake-gauche-load)
(define-key scheme-mode-map "\C-cd" 'credmp/flymake-display-err-minibuf)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; LaTeX flymake
(defun flymake-tex-init ()
(let* ((temp-file (flymake-init-create-temp-buffer-copy
'flymake-create-temp-inplace))
(local-dir (file-name-directory buffer-file-name))
(local-file (file-relative-name
temp-file
local-dir)))
(list "platex" (list "-file-line-error" "-interaction=nonstopmode" local-file))))
(defun flymake-tex-cleanup-custom ()
(let* ((base-file-name (file-name-sans-extension (file-name-nondirectory flymake-temp-source-file-name)))
(regexp-base-file-name (concat "^" base-file-name "\\.")))
(mapcar '(lambda (filename)
(when (string-match regexp-base-file-name filename)
(flymake-safe-delete-file filename)))
(split-string (shell-command-to-string "ls"))))
(setq flymake-last-change-time nil))
(defun flymake-tex-display-err-minibuf ()
"Displays the error/warning for the current line in the minibuffer"
(interactive)
(let* ((line-err-info-list (nth 0 (flymake-find-err-info flymake-err-info (flymake-current-line-no))))
(count (length line-err-info-list)))
(while (> count 0)
(when line-err-info-list
(let* ((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)))))
(push '("\\.tex$" flymake-tex-init flymake-tex-cleanup-custom) flymake-allowed-file-name-masks)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; LaTeX mode hook
(add-hook 'LaTeX-mode-hook
(function (lambda ()
(flymake-mode t)
(define-key LaTeX-mode-map "\C-cd" 'flymake-tex-display-err-minibuf)
(add-to-list 'TeX-command-list
'("platex" "platex %t"
TeX-run-TeX nil (latex-mode) :help "Run ASCII pLaTeX"))
(add-to-list 'TeX-command-list
'("pdfview" "acroread %s.pdf"
TeX-run-command t nil))
(add-to-list 'TeX-command-list
'("pdf" "dvipdfmx -V 4 %s.dvi"
TeX-run-command t nil)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.