2013년 12월 21일 토요일

Note for installing emacs on mac

Install GNU emacs on your mac.

1. compile emacs


# ./configure --with-ns
# make
# make install
# install nextstep's Emacs.app to Application folder


2. ecb install

- download latest version of ecb on this site
http://ecb.sourceforge.net
- unarchive the downloaded file to ~/.emacs.d/ecb folder
-add follow script to ~/.emacs file

if you encounter some ecb version error add follow text on .emacs
(custom-set-variables '(ecb-options-version "2.32"))



(add-to-list 'load-path "~/app/ecb-2.32/")
(require 'ecb)
(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.
 '(ecb-fix-window-size (quote width))
 '(ecb-layout-name "left1")
 '(ecb-layout-window-sizes (quote (("left9" (0.32857142857142857 . 0.9791666666666666)))))
 '(ecb-options-version "2.32")
 '(ecb-windows-width 0.33))
(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.
 )

;; customize the keys for ECB
(define-key ecb-mode-map (kbd "M-1") 'ecb-goto-window-directories)
(define-key ecb-mode-map (kbd "M-2") 'ecb-goto-window-sources)
(define-key ecb-mode-map (kbd "M-3") 'ecb-goto-window-methods)
(define-key ecb-mode-map (kbd "M-4") 'ecb-goto-window-history)
(define-key ecb-mode-map (kbd "M-5") 'ecb-goto-window-compilation)
(define-key ecb-mode-map (kbd "M-0") 'ecb-goto-window-edit1)

;; auto ecb mode
(setq ecb-auto-activate 'true)
(put 'scroll-left 'disabled nil)
script form http://poongbek.blogspot.kr/2011/06/emacs_04.html
  • "C-c s s": search symbol
  • "C-c s d", "C-c s g": search symbol defines
  • "C-c s G": move to symbol defines
  • "C-c s c": search function caller
  • "C-c s C": search function callee
  • "C-c s t": search string pattern
  • "C-c s e": search egrep pattern 
  • "C-c s f": search files
  • "C-c s i": search files which include the file
  • "C-c s b": show *cscope* 
  • "C-c s n": search a next symbol
  • "C-c s p": search a previous symbol
  • "C-c s N": search to next file
  • "C-c s P": search to pevious file
  • "C-c s a": set cscope database directory 
  • "C-c s A": resolve cscope database directory


3. Install autocomplete

http://www.emacswiki.org/emacs/AutoComplete

AutoCompleteScreenshot

git clone https://github.com/auto-complete/auto-complete
-git submodule init; git submodule update
- make install
- input directory name as ~/.emacs.d/auto-complete
- move libs folder such as popup, fuzzy and ert from auto-complete's source directory to ~/.emacs.d

add follow script to .emacs

;;auto-complete
(add-to-list 'load-path "/Users/kwangjo/.emacs.d/auto-complete")
(add-to-list 'load-path "/Users/kwangjo/.emacs.d/popup");
(require 'auto-complete-config)
(require 'popup)
(ac-config-default) 


4. Install CSCOPE

 - cscope should be installed using brew or make binary
 - Download source file from http://cscope.sourceforge.net
- you should make cscope.files on project directory
find . -name "*.java" > cscope.files
- emacs command using like below

5. using eTags

 - you can make navigate tags (like ctag with vi) using following command
find /usr/src/linux -name '*.[csSh]' | xargs etags

you can using follow script, navigate like vi.

(fset 'find-next-tag "\C-u\256") ; macro for C-u M-. 
(fset 'find-prev-tag "\C-u-\256") ; macro for C-u - M-. 
(global-set-key "\M-]" 'find-next-tag) (global-set-key "\M-[" 'find-prev-tag)

You can find tag using M-. and navigate using M-[ and M-]


6. customise emacs setting

I do not complete this setting. I write just reference pages as follow.

  you can customise colour and font on emacs
-http://www.emacswiki.org/emacs/ColorTheme

  you can customise font.
-http://www.emacswiki.org/emacs/SetFonts

 you can customise indentation.
- http://www.emacswiki.org/emacs/IndentingJava
-http://www.emacswiki.org/emacs/IndentingC



my .emacs setting file
(set-language-environment "Korean")
(prefer-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-selection-coding-system 'utf-8)
(setq coding-system-for-read 'utf-8)
(setq-default file-name-coding-system 'utf-8)

(add-hook 'eshell-mode-hook
          'lambda nil
          (let ((bashpath (shell-command-to-string "/bin/bash -l -c 'printenv PATH'")))
            (let ((pathlst (split-string bashpath ":")))
              (setq exec-path pathlst))
            (setq eshell-path-env bashpath)
            (setenv "PATH" bashpath)))


;;auto-complete
(add-to-list 'load-path "/Users/kwangjo/.emacs.d/auto-complete")
(add-to-list 'load-path "/Users/kwangjo/.emacs.d/popup")
(require 'auto-complete-config)
(require 'popup)
(ac-config-default)


;;ECB
(custom-set-variables '(ecb-options-version "2.40"))
(add-to-list 'load-path "/Users/kwangjo/.emacs.d/ecb")
(require 'ecb)

;; customize the keys for ECB
(define-key ecb-mode-map (kbd "M-1") 'ecb-goto-window-directories)
(define-key ecb-mode-map (kbd "M-2") 'ecb-goto-window-sources)
(define-key ecb-mode-map (kbd "M-3") 'ecb-goto-window-methods)
(define-key ecb-mode-map (kbd "M-4") 'ecb-goto-window-history)
(define-key ecb-mode-map (kbd "M-5") 'ecb-goto-window-compilation)
(define-key ecb-mode-map (kbd "M-0") 'ecb-goto-window-edit1)

;; auto ecb mode
(setq ecb-auto-activate 'true)
(put 'scroll-left 'disabled nil)

;;CSCOPE
(add-to-list 'load-path "/Users/kwangjo/.emacs.d/xcscope")
(require 'xcscope)
(add-hook 'java-mode-hook (function cscope:hook))
(add-hook 'html-helper-mode-hook (function cscope:hook))


;;ETAG hook
(fset 'find-next-tag "\C-u\256") ; macro for C-u M-.
(fset 'find-prev-tag "\C-u-\256") ; macro for C-u - M-.
(global-set-key "\M-]" 'find-next-tag)

(global-set-key "\M-[" 'find-prev-tag)

댓글 없음:

댓글 쓰기

RPI is not good handling DHT11

Hello? This is failure story about converting c code to python. There is GPIO controlling library on Python such as RPI, wiringPI. But...