2012년 5월 23일 수요일

Emacs 윈도용 설정파일

출처 : http://blog.naver.com/bonalena/20013545314


;;; =============================================================
;;; Fonts and Frame for Windows 95/NT
;;; =============================================================
; To see list of fonts in your Windows 95/NT,
; (w32-select-font) or
; (insert (prin1-to-string (x-list-fonts "*")))
(if (eq window-system 'w32)
    (progn
       ;(setq w32-enable-italics t)
       ;; for better font dialog menu for fontset
       (setq w32-use-w32-font-dialog t)
       (setq w32-enable-unicode-output t)
       (setq initial-frame-alist '((top . 10) (left . 30)))
       (setq default-frame-alist
           (append '( ;; Choose only one for your default font set.
       (font . "-outline-HyhwpEQ-normal-r-normal-normal-*-*-96-96-p-*-ksc5601.1987")
;       (font . "-outline-\307\321\304\304\265\270\277\362-normal-r-normal-normal-*-*-96-96-p-*-ksc5601.1987")
         (width . 100)
         (height . 52)
         (background-color . "gray85")
         (foreground-color . "Black")
         (vertical-scroll-bars . right))
           default-frame-alist))))

;;; =============================================================
;;; Mode Line and Minibuffer Settings
;;; =============================================================
;(icomplete-mode)
(partial-completion-mode 1)
(column-number-mode 1)
;; For bug fix of localized date output and better display for Korean
;(setq display-time-string-forms
;'((if
;     (and
;      (not display-time-format)
;      display-time-day-and-date)
;     (decode-coding-string (format-time-string "%m/%d (%a) " now)
;                           (car default-process-coding-system))
;   "")
;  (decode-coding-string
;   (format-time-string
;    (or display-time-format
;        (if display-time-24hr-format "%H:%M" "%p %-I:%M"))
;    now)
;   (car default-process-coding-system))
;  load
;  (if mail " Mail" "")))
(setq display-time-day-and-date t)
(display-time)

;;; =============================================================
;;; Misc. Setting
;;; =============================================================
;; In Unix terminal mode, make Backspace and Control-h key work as real backspace key.
;; (In any Emacs, F1 key work as an help key, too.)
(if (and (not (eq system-type 'windows-nt)) (null window-system))
    (keyboard-translate ?\C-h ?\C-?))
(setq scroll-step 1)
(global-set-key [?\C-x?\C-j] 'goto-line)
(setq query-replace-highlight t)
(show-paren-mode)
(transient-mark-mode 1)
(auto-compression-mode 1)  ; For auto compression and decompression

;;; =============================================================
;;; Syntax Highlighting, Spell Checking, Completion
;;; (ftp://ftp.hanq.net/pub/gnu/ (Source Code))
;;; (http://www.cat.rpi.edu/~tibbetts/ispell_toc.html (Windows 95/NT))
;;; =============================================================
(global-font-lock-mode 1)
(setq font-lock-maximum-decoration t)
;(setq font-lock-support-mode 'lazy-lock-mode)
(add-hook 'flyspell-mode-hook
   (function (lambda ()
        (define-key flyspell-mode-map "\M-\t"
   'flyspell-mode-complete))))
;(add-hook 'text-mode-hook 'turn-on-flyspell-mode)
(defun turn-on-flyspell-mode ()
  (flyspell-mode 1))
;; Enable fly spell checking only for strings and comments in program modes.
;; (font lock mode should be enabled for use of this feature)
;(add-hook 'c-mode-common-hook 'turn-on-flyspell-mode-program)
;(add-hook 'sh-mode-hook 'turn-on-flyspell-mode-program)
;(add-hook 'makefile-mode-hook 'turn-on-flyspell-mode-program)
;(add-hook 'emacs-lisp-mode-hook 'turn-on-flyspell-mode-program)
(defun turn-on-flyspelL-mode-program ()
  (setq flyspell-generic-check-word-p 'program-mode-flyspell-verify)
  (flyspell-mode 1))
(defun program-mode-flyspell-verify ()
  (let ((prop (get-text-property (point) 'face)))
    (or (eq prop 'font-lock-string-face)
 (eq prop 'font-lock-comment-face))))
(defun flyspell-mode-complete ()
  (interactive)
  (cond ((eq major-mode 'emacs-lisp-mode)
  (ispell-complete-word))
 ((or (eq major-mode 'latex-mode)
      (eq major-mode 'tex-mode))
  (or (TeX-complete-symbol)
      (ispell-complete-word)))
 (t
  (let ((prop (get-text-property (point) 'face)))
    (if (or (eq prop 'font-lock-string-face)
     (eq prop 'font-lock-comment-face))
        (ispell-complete-word)
      (let ((complete-func (lookup-key (current-local-map) "\M-\t")))
        (if complete-func
     (funcall complete-func)
   (complete-tag))))))))
(setq Info-default-directory-list
      (append '("/usr/local/teTeX/info/") Info-default-directory-list ))

;;; =============================================================
;;; Text Mode
;;; =============================================================
(setq default-major-mode (quote text-mode))
;(add-hook 'text-mode-hook
;          (function (lambda ()
;                      (setq fill-column 70)
;                      (turn-on-auto-fill))))
;;; =============================================================
;;; Programming Modes
;;; =============================================================
(c-add-style
 "java"
 '((c-basic-offset . 4)
   (c-comment-only-line-offset 0 . 0)
   (c-hanging-comment-starter-p)
   (c-offsets-alist
    (topmost-intro-cont . +)
    (statement-block-intro . +)
    (substatement-open . 0)
    (substatement . +)
    (inline-open . 0)
    (label . 0)
    (statement-case-open . +)
    (statement-cont . +)
    (knr-argdecl-intro . 5)
    (arglist-intro . +)
    (arglist-close . c-lineup-arglist)
    (brace-list-entry . 0)
    (access-label . 0)
    (inher-cont . c-lineup-java-inher)
    (func-decl-cont . c-lineup-java-throws))))
(add-hook 'java-mode-hook
   (function (lambda ()
        (c-set-style "java"))))
(add-hook 'c-mode-hook
   (function (lambda ()
        (c-set-style "stroustrup"))))
(add-hook 'c++-mode-hook
   (function (lambda ()
        (c-set-style "stroustrup"))))
(add-hook 'idl-mode-hook
   (function (lambda ()
        (c-set-style "stroustrup"))))

;;; =============================================================
;;; Compilation Modes
;;; =============================================================
; To avoid cursor disappearing problem.
; There should be better solution.
(if (and (eq system-type 'windows-nt)
         (null window-system))
    (progn
      (setq-default grep-command "grep -n -e")
      (setq-default grep-find-command
                    '("find . -type f -exec grep -n -e {} /dev/null \\;" . 32))
      (setq-default grep-find-use-xargs nil)))

;;; =============================================================
;;; Version Control
;;; =============================================================
(setq vc-make-backup-files t)

;;; =============================================================
;;; Settings for Non-standard Packages
;;; =============================================================
;;; =============================================================
;;; Crypting
;;; ftp://archive.cis.ohio-state.edu/pub/emacs-lisp/misc/crypt++.el.Z
;;; http://www.cs.washington.edu/homes/voelker/ntemacs.html
;;; =============================================================
(condition-case nil
    (require 'crypt++)
  (error nil))
;;; =============================================================
;;; Calcualtor (ftp://ftp.hanq.net/pub/gnu/calc-2.02f.tar.gz)
;;; =============================================================
;;; Commands added by calc-public-autoloads on Mon Oct  6 21:31:58 1997.
(autoload 'calc-dispatch    "calc" "Calculator Options" t)
(autoload 'full-calc     "calc" "Full-screen Calculator" t)
(autoload 'full-calc-keypad    "calc" "Full-screen X Calculator" t)
(autoload 'calc-eval     "calc" "Use Calculator from Lisp")
(autoload 'defmath     "calc" nil t t)
(autoload 'calc      "calc" "Calculator Mode" t)
(autoload 'quick-calc     "calc" "Quick Calculator" t)
(autoload 'calc-keypad     "calc" "X windows Calculator" t)
(autoload 'calc-embedded    "calc" "Use Calc inside any buffer" t)
(autoload 'calc-embedded-activate  "calc" "Activate =>'s in buffer" t)
(autoload 'calc-grab-region    "calc" "Grab region of Calc data" t)
(autoload 'calc-grab-rectangle    "calc" "Grab rectangle of data" t)
(global-set-key "\e#" 'calc-dispatch)
;;; End of Calc autoloads.

;;; =============================================================
;;; HTML Helper Mode (http://www.santafe.edu/~nelson/tools/)
;;; =============================================================
(autoload 'html-helper-mode "html-helper-mode" "Yay HTML" t)
;(setq auto-mode-alist (append '(("\\.html$" . html-helper-mode)
;                                ("\\.jsp$" . html-helper-mode))
;                              auto-mode-alist))
(add-hook 'html-helper-load-hook '(lambda () (require 'html-font)))
(add-hook 'html-helper-mode-hook '(lambda () (font-lock-mode 1)))
(setq html-helper-do-write-file-hooks t)
(setq html-helper-build-new-buffer t)

;;; =============================================================
;;; AUC TeX - Integrated environment for editing LaTeX files.
;;; (ftp://ftp.dante.de/tex-archive/support/auctex)
;;; teTeX, MikTeX (http://free.kaist.ac.kr/ChoF/)
;;; =============================================================
(condition-case nil
    (require 'tex-site)
  (error nil))
(add-hook
 'TeX-mode-hook
 (function
  (lambda ()
    (define-key TeX-mode-map "\C-x`" 'TeX-next-error)
    (define-key LaTeX-mode-map "\C-x`" 'TeX-next-error))))
(if (eq system-type 'windows-nt)
    (setq TeX-view-style '(("^a5$" "yap %d -paper a5")
                           ("^landscape$" "yap %d -paper a4r -s 4")
                           ("." "yap %d"))))

;;; =============================================================
;;; JDE - Java Development Environment (http://sunsite.auc.dk/jde/)
;;; =============================================================
;;; Copy `/usr/local/share/emacs/20.3/site-lisp/jde-2.1.3/jtags*' to `/usr/local/bin/'
(condition-case nil
    (require 'jde)
  (error nil))
(if (eq system-type 'windows-nt)
    (setq jde-db-source-directories '("C:/jdk1.2/src/"))
  (setq jde-db-source-directories '("/usr/local/jdk1.2/src")))

;;; =============================================================
;;; Telnet (http://www.watchit.com/~iganza/jtelnet.html) for Windows 95/NT
;;; =============================================================
;; Install JDK from http://java.sun.com/
;; Change followings properly for your system configuration
(if (eq system-type 'windows-nt)
    (progn
      (setq jtelnet-java-path "java")
      ;; for JDK 1.2.x
      (setq jtelnet-class-arg "-cp")
      (setq jtelnet-class-path
     (concat
      (apply 'concat (mapcar
        (lambda (x) (if (= x ?/) "\\" (char-to-string x)))
        data-directory))
      "..\\site-lisp\\jtelnet"))
      ;; for JDK 1.1.x
      ;(setq jtelnet-class-arg "-classpath")
      ;(setq jtelnet-class-path
      ;      (concat "d:\\jdk1.1\\lib\\classes.zip;"
      ;              (apply 'concat (mapcar
      ;                              (lambda (x) (if (= x ?/) "\\" (char-to-string x)))
      ;                              data-directory))
      ;              "..\\site-lisp\\jtelnet")))
      (condition-case nil
   (require 'jtelnet)
 (error nil))))
 
;;; ================================================================================
;;; Talk (ftp://archive.cis.ohio-state.edu/pub/emacs-lisp/packages/etalk-0.8.tar.gz)
;;; ================================================================================
;;; Need to build and install "etalk" executable in Emacs bin directory.
(autoload 'etalk "etalk"
  "Talk to anyone on any machine through BSD talk protocol." t)
(autoload 'etalk-batch "etalk"
  "Talk to anyone on any machine through BSD talk protocol from command line." t)
(autoload 'etalk-mail "etalk"
  "Talk to anyone on any machine through mail as connector." t)
(autoload 'finger "finger"
  "Run finger on a host." t)

;;; =============================================================
;;; Misc.
;;; =============================================================
(autoload 'which "which" nil t)

;;; =============================================================
;;; Private Settting and Customization
;;; =============================================================
;; To see available colors, run `M-x list-colors-dislay'


(require 'cl)
(when enable-multibyte-characters
  (set-language-environment "Korean")
 
  (setq-default file-name-coding-system 'euc-kr)
  (setq default-korean-keyboard "3")
  ;; (setq input-method-verbose-flag nil
  ;;       input-method-highlight-flag nil)
  (prefer-coding-system 'euc-kr)
  (set-default-coding-systems 'euc-kr)
  (set-keyboard-coding-system 'euc-kr)
  (set-terminal-coding-system 'euc-kr)
  (define-key encoded-kbd-mode-map [27] nil)

;  (set-selection-coding-system 'compound-text-with-extensions)
(set-selection-coding-system
 (cond ((eq system-type 'windows-nt) 'euc-kr-dos)
       (t 'euc-kr)))

  ;; Hangul Mail setting
  (setq-default sendmail-coding-system 'euc-kr))
(unless (or enable-multibyte-characters window-system)
  (standard-display-european t)
  (set-input-mode (car (current-input-mode))
                  (nth 1 (current-input-mode))
                  0))

;; sealover's setup (by Learning GNU Emacs)
(setq default-major-mode 'text-mode)
(add-hook 'text-mode-hook 'turn-on-auto-fill)
(setq-default transient-mark-mode t)
;;(enable-flow-control)
(global-unset-key "\e\e")
(global-unset-key "\C-x\C-u")
(define-key global-map "\C-x?" 'help-command)
(define-key global-map "\C-h" 'backward-char)
;;(setq suggest-key-bindings nil)
(set-background-color "black")
(set-foreground-color "white")
(set-cursor-color "khaki")
(set-face-foreground 'region "white")
(set-face-background 'region "mediumblue")
;;;;(global-font-lock-mode 1 t)
;; mode-line color
(when enable-multibyte-characters
  (set-face-foreground 'modeline "blue")
  (set-face-background 'modeline "khaki"))
(unless enable-multibyte-characters
  (set-face-foreground 'modeline "Red")
  (set-face-background 'modeline "Yellow"))
;;shell environment
(setq-default shell-cd-regexp nil)
(setq-default shell-pushd-regexp nil)
(setq-default shell-popd-regexp nil)
;(setq explicit-shell-file-name "/usr/local/bin/bash")
;; secure on shell mode
(add-hook 'comint-output-filter-functions 'comint-watch-for-password-prompt)
(setq default-tab-width 4)
;; c-mode
(add-hook 'c-mode-hook '(lambda() (c-set-style "gnu")))
(global-font-lock-mode t)
(setq font-lock-maximum-decoration t)
(setq truncate-partial-width-windows nil)

댓글 없음:

댓글 쓰기