Programming editor 를 이용함에 있어서 auto-completion 기능은 참 좋은 기능 같습니다.
Emacs 에서도 이를 지원하는 auto-complete.el package 가 있네요.

[#0] Download and compile

Download auto-compile.el and compile it.

[#1] 기본 설정 in .emacs
;; ----------------------------------------------------------------------------
;; Auto-complete
;; ----------------------------------------------------------------------------
(require 'auto-complete)(global-auto-complete-mode t)

[#2] 추가 configuration in .emacs

Auto-complete mode 가 enable 되어 있는 경우에 pop-up color setting 및 key-binding 설정 등등.
;; ----------------------------------------------------------------------------
;; Auto-complete
;; ----------------------------------------------------------------------------
(require 'auto-complete)
(global-auto-complete-mode t)

(when (require 'auto-complete nil t)
   (global-auto-complete-mode t)
   (set-face-background 'ac-selection-face "steelblue")
   (set-face-background 'ac-menu-face "skyblue")
   (define-key ac-complete-mode-map "\t" 'ac-expand)
   (define-key ac-complete-mode-map "\r" 'ac-complete)
   (define-key ac-complete-mode-map "\C-\M-n" 'ac-next)
   (define-key ac-complete-mode-map "\C-\M-p" 'ac-previous)
   (setq ac-auto-start t)
   (setq ac-sources '(ac-source-yasnippet ac-source-abbrev ac-source-words-in-buffer))
   (add-to-list 'ac-modes 'eshell-mode)
   (add-hook 'emacs-lisp-mode-hook
             (lambda ()
               (make-local-variable 'ac-sources)
               (setq ac-sources '(ac-source-yasnippet ac-source-abbrev ac-source-words-in-buffer ac-source-symbols))))
   (add-hook 'eshell-mode-hook
             (lambda ()
               (make-local-variable 'ac-sources)
               (setq ac-sources '(ac-source-yasnippet ac-source-abbrev ac-source-files-in-current-dir ac-source-words-in-buffer)))))
(defconst c++-keywords 
       (list "and" "bool" "compl" "do" "export" "goto" "namespace" "or_eq" "return"
             "struct" "try" "using" "xor" "and_eq" "break" "const" "double" "extern"
             "if" "new" "private" "short" "switch" "typedef" "virtual" "xor_eq" "asm"
             "case" "const_cast" "dynamic_cast" "false" "inline" "not" "protected" 
             "signed" "template" "typeid" "void" "auto" "catch" "continue" "else" 
             "float" "int" "not_eq" "public" "sizeof" "this" "typename" "volatile"
             "bitand" "char" "default" "enum" "for" "long" "operator" "register"
             "static" "throw" "union" "wchar_t" "bitor" "class" "delete" "explicit"
             "friend" "mutable" "or" "reinterpret_cast" "static_cast" "true" 
             "unsigned" "while" ) #'(lambda (a b) (> (length a) (length b)))))
(defvar ac-source-c++
         . (lambda ()
             (all-completions ac-target c++-keywords))))
      "Source for c++ keywords.")
(add-hook 'c++-mode-hook
              (lambda ()
                (make-local-variable 'ac-sources)
                (setq ac-sources '(ac-source-c++))))
저작자 표시 비영리 변경 금지
Posted by tkhwang


분류 전체보기 (61)
소프트웨어 (30)
잡담 (17)
BOOK (7)
펜,잉크,노트,문구 (6)
Blog (1)
Bookmark (0)


«   2017/09   »
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30

티스토리 툴바