현재 사용중인 .emacs입니다. 백업도 해둘겸 겸사겸사 올립니다.
(setq load-path (cons (expand-file-name "~/.emacs.d/") load-path))
먼저 유저경로를 추가하는 부분으로 시작합니다.
(when window-system
(set-face-font 'default "jin3")
(set-fontset-font "fontset-default" 'hangul '("jin3" . "unicode-bmp"))
(set-fontset-font "fontset-default" 'kana '("Haansoft Dotum" . "unicode-bmp"))
(set-fontset-font "fontset-default" 'han '("Haansoft Dotum" . "unicode-bmp"))
(set-fontset-font "fontset-default" 'cjk-misc '("Haansoft Dotum" . "unicode-bmp"))
(set-frame-size (selected-frame) 140 50))
emacs를 xwindow에서 사용할때만 글꼴 설정과 창크기를 조정합니다. 글꼴은 각 언어별로 다르게 적용해놨습니다. emacs snapshot xft버전에서만 저방식의 폰트 설정이 가능합니다.
;; syntax highlighting
(global-font-lock-mode t)
;; highlight line
(global-hl-line-mode t)
;; highlight marked region
(transient-mark-mode t)
;; match parenthesis
(show-paren-mode t)
;; no new line at end
(setq next-line-add-newlines nil)
;; no backup file
(setq make-backup-files nil)
;; uncompress files
(auto-compression-mode t)
;; del키 또는 backspace키를 눌렀을때 선택한 영역을 삭제
(delete-selection-mode nil)
;; 창 제목을 바꿈
(setq frame-title-format (list "GNU Emacs " emacs-version "@" system-name " - " '(buffer-file-name "%f" "%b")))
(setq icon-title-format frame-title-format)
(which-function-mode t)
;; column number
(column-number-mode t)
;; 툴바숨김
(tool-bar-mode nil)
;; tab설정
(setq default-tab-width 4)
(setq-default c-basic-offset 4
indent-tabs-mode nil)
하이라이팅,탭등 기타 잡다한것을 설정합니다.
(global-set-key [(ctrl f4)] 'kill-this-buffer) (global-set-key [(meta g)] 'goto-line) (global-set-key [f1] (lambda () (interactive) (manual-entry (current-word)))) (global-set-key [f5] 'replace-string) (global-set-key [(ctrl f5)] 'query-replace) (global-set-key [f6] 'replace-regexp) (global-set-key [(ctrl f6)] 'query-replace-regexp) (global-set-key [f7] 'compile) (global-set-key [(ctrl f7)] 'kill-compilation) (global-set-key [f8] 'next-error) (global-set-key [(ctrl f8)] 'previous-error) (global-set-key [(f11)] 'shell)
제가 사용하는 키바인딩입니다.
(ido-mode 'buffer) (global-set-key [(ctrl tab)] 'ido-switch-buffer) (global-set-key [(ctrl shift tab)] 'ido-switch-buffer) (add-hook 'ido-setup-hook (lambda () (define-key ido-buffer-completion-map [(ctrl tab)] 'ido-next-match) (define-key ido-buffer-completion-map [(ctrl shift tab)] 'ido-prev-match)))
버퍼 전환을 편하게 하고자 ido-mode를 사용합니다. ctrl tab으로 다음 버퍼, ctrl shift tab으로 이전 버퍼로 전환이 가능합니다.
;; SLIME 설정
(setq common-lisp-hyperspec-symbol-table nil)
(require 'slime)
(setq inferior-lisp-program "/usr/bin/sbcl"
lisp-indent-function 'common-lisp-indent-function
slime-complete-symbol-function 'slime-fuzzy-complete-symbol
slime-startup-animation nil)
;; UTF-8 인코딩을 기본으로 사용
(setq slime-net-coding-system 'utf-8-unix)
(setq common-lisp-hyperspec-root
"/usr/share/doc/hyperspec/")
(add-hook
'inferior-lisp-mode-hook
(lambda ()
(inferior-slime-mode t)))
(slime-setup)
(add-hook
'lisp-mode-hook
(lambda ()
(define-key lisp-mode-map [f1] 'info-lookup-symbol)))
(eval-after-load "slime"
'(progn
(add-to-list 'load-path "/usr/share/emacs/site-lisp/slime/contrib")
(slime-setup '(slime-fancy slime-asdf slime-banner))
(setq slime-complete-symbol*-fancy t)
(setq slime-complete-symbol-function 'slime-fuzzy-complete-symbol)))
(require 'info-look)
(info-lookup-add-help
:mode 'lisp-mode
:regexp "[^][()'\" \t\n]+"
:ignore-case t
:doc-spec '(("(ansicl)Symbol Index" nil nil nil)))
;; scheme 설정
(setq scheme-program-name "mzscheme")
(add-hook
'scheme-mode-hook
(lambda ()
(define-key scheme-mode-map [f1] 'info-lookup-symbol)))
(add-hook
'inferior-scheme-mode-hook
(lambda ()
(define-key inferior-scheme-mode-map [f1] 'info-lookup-symbol)))
common lisp과 scheme을 사용하기 때문에 slime과 scheme환경을 설정해두었습니다.
;; LaTeX 환경설정
(setq TeX-command-list
(list (list "TeX" "tex \\nonstopmode\\input %t" 'TeX-run-TeX nil t)
(list "LaTeX" "%l --interaction=nonstopmode %t" 'TeX-run-LaTeX nil t)
(list "LaTeX PDF" "pdflatex --interaction=nonstopmode %t" 'TeX-run-LaTeX nil t)
(list "LaTeX DVIPDFMx" "dvipdfmx %d" 'TeX-run-command t nil)
(list "View" "%v" 'TeX-run-discard t nil)
(list "View PS" "gsview32 %f" 'TeX-run-command t nil)
(list "View PDF" "evince %s.pdf" 'TeX-run-command t nil)
(list "DVIPS" "dvips %d -o %f" 'TeX-run-command t nil)
(list "Print" "dvips %d -o %f " 'TeX-run-command t nil)
(list "File" "dvips %d -o %f " 'TeX-run-command t nil)
(list "BibTeX" "bibtex %s" 'TeX-run-BibTeX nil nil)
(list "Index" "makeindex %s" 'TeX-run-command nil t)
(list "Check" "lacheck %s" 'TeX-run-compile nil t)
(list "Other" "" 'TeX-run-command t t)))
(setq TeX-auto-save t
TeX-parse-self t)
;; LaTeX 컴파일 단축키
(add-hook
'LaTeX-mode-hook
(lambda ()
(define-key LaTeX-mode-map [f7] 'do-PDFLaTeX)))
(setq LaTeX-verbatim-environments '("verbatim" "verbatim*" "Verbatim"))
(defun do-PDFLaTeX ()
"PDFLaTeX the curent file."
(interactive)
(TeX-command "LaTeX PDF" 'TeX-master-file))
그리고 latex을 사용하기 때문에 설정을 해두었는데 저많은 커맨드 중에 pdflatex밖에 사용안합니다. 헷갈리지 않게 컴파일과 동일한 f7로 바인딩 해두었습니다.
(add-hook
'c-mode-common-hook
(lambda ()
(unless (file-exists-p "Makefile")
(set (make-local-variable 'compile-command)
(let ((file (file-name-nondirectory buffer-file-name)))
(format "%s -o %s %s %s %s"
(or (getenv "CC") "gcc")
(file-name-sans-extension file)
(or (getenv "CPPFLAGS") "")
(or (getenv "CFLAGS") "-Wall -g")
file))))))
(add-hook
'c++-mode-hook
(lambda ()
(unless (file-exists-p "Makefile")
(set (make-local-variable 'compile-command)
(let ((file (file-name-nondirectory buffer-file-name)))
(format "%s -o %s %s %s %s"
(or (getenv "CC") "g++")
(file-name-sans-extension file)
(or (getenv "CPPFLAGS") "")
(or (getenv "CFLAGS") "-Wall -g")
file))))))
(add-hook
'java-mode-hook
(lambda ()
(unless (file-exists-p "Makefile")
(set (make-local-variable 'compile-command)
(let ((file (file-name-nondirectory buffer-file-name)))
(format "%s %s %s"
(or (getenv "JAVAC") "javac")
(or (getenv "JAVACFLAGS") "")
file))))))
컴파일을 편하게 하고자 컴파일 커맨드를 설정했습니다. Makefile이 있다면 make를 호출하고 없다면 gcc, g++, javac등을 호출하여 컴파일 합니다.
(add-hook 'haskell-mode-hook 'turn-on-haskell-ghci)
(autoload 'run-ghci "haskell-ghci"
"Go to the *ghci* buffer" t nil)
(set-variable 'haskell-program-name "ghci")
(add-hook
'haskell-mode-hook
(lambda ()
(unless (file-exists-p "Makefile")
(set (make-local-variable 'compile-command)
(let ((file (file-name-nondirectory buffer-file-name)))
(format "%s -o %s %s %s"
(or (getenv "GHC") "ghc")
(file-name-sans-extension file)
(or (getenv "GHCFLAGS") "")
file))))))
haskell을 가끔 쓰기때문에 haskell환경과 컴파일 커맨드를 설정했습니다.
(when (locate-library "erc")
(eval-after-load "erc"
'(progn
(setq erc-default-coding-system '(cp949 . undecided))
(setq erc-server "irc.hanirc.org:6667"))))
챗팅을 하고자 erc를 설정했는데 리눅스에서는 xchat을 쓰기때문에 잘안씁니다. 가끔 윈도 환경에서 emacs를 사용할때 유용하게 사용합니다.
(load "~/.emacs.d/nxml/autostart.el")
(add-to-list 'auto-mode-alist '("\\.ctp\\'" . nxhtml-mumamo))
웹프로그래밍을 할땐 nXhtml을 쓰면 편합니다. 링크된 홈페이지에서 nXhtml을 받아서 .emacs.d에 압축을 푼후 로드하면 적용됩니다. CakePHP를 쓰기때문에 ctp확장자를 등록했습니다.
(setq ecb-tip-of-the-day nil) (setq ecb-layout-name "left11") (setq ecb-windows-width 0.25) (custom-set-variables '(ecb-fix-window-size (quote width)) '(ecb-layout-window-sizes nil) '(ecb-options-version "2.32"))
잘안쓰는 ECB에 대한 설정이 있네요. 개인적으로 layout은 left11을 선호하는데 테스트해보면서 맘에 드는걸로 고르시면 될겁니다.
(when (require 'tabbar nil t)
(setq tabbar-buffer-groups-function
(lambda (b) (list "All Buffers")))
(setq tabbar-buffer-list-function
(lambda ()
(remove-if
(lambda(buffer)
(find (aref (buffer-name buffer) 0) " *")) (buffer-list))))
(tabbar-mode))
(set-face-attribute
'tabbar-default-face nil
:background "gray60")
(set-face-attribute
'tabbar-unselected-face nil
:background "gray85"
:foreground "gray30"
:box nil)
(set-face-attribute
'tabbar-selected-face nil
:background "#f2f2f6"
:foreground "black"
:box nil)
(set-face-attribute
'tabbar-button-face nil
:box '(:line-width 1 :color "gray72" :style released-button))
(set-face-attribute
'tabbar-separator-face nil
:height 0.7)
(global-set-key [(ctrl shift tab)] 'tabbar-backward)
(global-set-key [(ctrl tab)] 'tabbar-forward)
이전에는 tabbar모드를 즐겨 사용했었는데 ido-mode를 사용하면서 사용안하게 되더군요. 사용하실려면 먼저 tabbar.el을 .emacs.d에 복사하셔야 됩니다. ido-mode와 마찬가지로 ctrl tab, ctrl shift tab으로 버퍼 전환이 가능하도록 설정해서 사용했습니다.
댓글 없음:
댓글 쓰기