특 정 시점의 snapshot을 만들기 위한 것이다. svn은 cvs와는 다르게 따로 tag를 붙일 수 있는 방법을 가지고 있지 않다. 리비전 번호가 전체적으로 적용되는 것도 아니어서 특정 시점의 상태를 기억해둘 필요가 있을 때에는 /tags/REL-1.0.0 과 같이 태그 디렉토리를 만든다.
개발의 기본 가지(줄기, trunk)에서 따로 분리된 개발을 진행하고자 할 때이다. 말 그대로 브랜치(branch)를 만들기 위해서다. /branches/RB-1.0 과 같이 브랜치 디렉토리를 복사해서 만든다.
Emacs 로 코딩을 하다보면 CEDET 와 ECB 를 만나게 된다. 처음에는 너무 무겁길래 그냥 깔았다가 지웠고, 후에 Emacs 를 본격적으로 쓰면서 vim 의 TagList 가 필요해서 다시 깔게 되었다. 내가 원한것이 TagList 정도의 기능뿐이었기 때문에, 이 페이지에 나온내용은 CEDET 와 ECB 의 일부만을 다룬다.
CEDET 와 ECB 를 설치하기 위해서는 MSYS 가 필요하다(또는 cygwin) mingw, msys 는 여러모로 쓸모있으니 깔아두자
CEDET 설정
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; cedet 설정
;; http://cedet.sourceforge.net/ 에서 받을수 있다.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(when (file-exists-p "~/.emacs_plugin/cedet-1.0beta3b")
(progn
(setq semantic-load-turn-useful-things-on t)
(load-file "~/.emacs_plugin/cedet-1.0beta3b/common/cedet.el")
(setq semantic-default-c-path
(cond
(officep
'("c:/MinGW/include" "C:/MinGW/include/c++/3.2")) ; 사무실에서는 mingw 를 c:/ 에 깔았다
(homep
'("c:/bin/MinGW/include" "C:/bin/MinGW/include/c++/3.2")) ; 집에서는 mingw 를 c:/bin 에 깔았다
(t "/usr/include" "/usr/local/include" "/usr/dt/include" "/usr/X11R6/include" ))) ; 그외 장비는 유닉스라고 생각하자
;; semantic database
(require 'semanticdb)
(global-semanticdb-minor-mode 1)
(setq semanticdb-project-roots
(list "d:/src/rrun"
"d:/src/Cleopatra/chairking"))
))
semantic-default-c-path 를 지정하는것을 잊지 말자. 이놈은 ffap 의 ffap-c-path 와 유사한 역할을 한다. 이놈을 안해주면 ECB 의 메서드뷰에서 include 파일들을 열지 못하는 일이 생긴다. (이것을 해주더라도, 프로젝트별로 쓰고있는 include 의 헤더를 열어주지는 못한다. 음.. 방법을 찾아봐야겠다. 프로젝트 관리해주는 패키지들이 몇개 있던데 그쪽부터 찾아봐야지 ToDo)
그리고 semanticdb 를 적당히 세팅해 주는것도 잊지 말자. 이놈이 빠지면, 다른 파일에 있는 심볼을 completion 해주거나 ECB 의 메서드 뷰에서 부모 클래스를 찾아가는것이 불가능해진다. emanticdb-project-roots 를 .emacs 에 지정하는것은 좀 모양이 안나는 일이 긴 한데.. 이거 따로 뽑을 궁리를 해봐야 겠다.
cedet 의 semantic 을 ctags 대용으로 써볼려고 했는데, 아무래도 좀 아니더라. 태그는 ctags 로 쓰는것이 더 나을듯.
이 패키지가 completion 을 지원하는데, 위처럼 세팅해놓으면 자동적으로 completion 이 활성화 된 상태이다. 적당히 메서드이름을 치다가 잠시 쉬면(idle) 후보들이 툴팁으로 뜨고 그때 TAB 으로 completion 이 가능하다. 또는 semantic-ia-complete-symbol,semantic-ia-complete-symbol-menu, semantic-ia-complete-tip 를 명시적으로 불러줘도 된다. 하지만 그다지 똘똘한 편은 못되는듯. 후에 더 개선되면 . 이나 -> 를 저놈들로 bind 하면 편하겠다. completion 에 관심있다면 IntellisenseOnEmacs 또는 http://cedet.sourceforge.net/intellisense.shtml 를 살펴보자.
ECB
(when (file-exists-p "~/.emacs_plugin/ecb-2.32")
(add-to-list 'load-path "~/.emacs_plugin/ecb-2.32")
(require 'ecb-autoloads)
;; 윈도스럽게, 왼쪽버튼과 오른쪽 버튼을 쓰는게 편하다.
(setq ecb-primary-secondary-mouse-buttons (quote mouse-1--mouse-2))
;; 초기 팁 알려주는거 끈다
(setq ecb-tip-of-the-day nil)
;; ecb-source-path 를 세팅해두면 좀더 편해진다.
;; cedet 와 같이 ffap-c-path 를 재사용했다.
(add-hook 'ecb-activate-hook
'(lambda ()
(setq ecb-source-path
(append ecb-source-path ffap-c-path))))
;; method-buffer 외에는 별 필요가 없어보인다.(vim 의 TagList 를 원하고 있기 때문에)
;; 음 ecb-layout-name 은 setq 로 지정하지 말고 customize 로만 바꿔야 한다고 문서에 있네..
;; 일단 주석처리 한다.
;;(setq ecb-layout-name "left9")
)
ECB 는 마우스클릭만 바꿔주면 바로 쓸만하다. 모니터가 작은경우는 레이아웃을 left9 로 쓰도록 하자. vim 의 TagList 와 유사한 느낌으로 쓸수 있다. TagList 정도로 쓸거라면 단축키도 몇개만 알면 충분하다.
C-c .
ECB 커맨드들의 prefix
C-c . g m
메서드뷰 를 본다. go method 정도로 기억해두자
C-c . r
메서드뷰가 깨지는 경우가 있는데 그때 불러주자. rebuild 한다고 기억하면 된다.
C-c . e
eshell 을 연다
C-c . p
웹브라우저의 back 과 유사하다.
C-c . n
웹브라우저의 Foward 와 유사하다.
C-c . l w
ecb 창들을 켜고 끌수 있다. ECB 창들이 거슬리면 deactive 하지 말고 이걸 써보자.
C-c . g m 을 C-c C-c 로
(defun my-c-mode-common-hook ()
(c-add-style "PERSONAL" my-c-style t)
(setq tab-width 4
indent-tabs-mode t
c-basic-offset 4)
(c-toggle-auto-state -1) ; disable auto-newline mode
(c-toggle-hungry-state 1) ; enable hungry-delete mode
;; return 으로 indent 까지 같이 하도록했다
(define-key c-mode-base-map "\C-m" 'newline-and-indent)
;; C-c RET 로 .h .cpp 간의 전환을 하도록 했다.
(define-key c-mode-base-map [(control c)(return)] 'ff-find-other-file)
;; ecb 가 켜진 상태라면, C-c C-c 를 ecb-goto-window-methods 에 바인딩했다.
(when (fboundp 'ecb-goto-window-methods)
(define-key c-mode-base-map [(control c)(control c)] 'ecb-goto-window-methods))
(c-set-offset 'substatement-open 0)
(c-set-offset 'member-init-intro '++)
(c-set-offset 'inline-open 0)
(c-set-offset 'comment-intro 0)
(c-set-offset 'label 0)
(c-set-offset 'arglist-intro '++)
(hs-minor-mode 1)
)
핵심은 이것
;; ecb 가 켜진 상태라면, C-c C-c 를 ecb-goto-window-methods 에 바인딩했다.
(when (fboundp 'ecb-goto-window-methods)
(define-key c-mode-base-map [(control c)(control c)] 'ecb-goto-window-methods))
emacs 를 사용한 이후로 emacs 설정파일 묶음은 내 개발역사나 마찬가지다.
org 모드에 블로그보다 많은 정보를 들고 있고 이걸 .emacs 들과 함께 hg 로 버전관리중이니 뭐 그 이상이지...
오래 전 위키에 올렸던 페이지가 어쩌다 오늘 내눈에 보이길래 지금 쓰는 dot emacs 파일을 올려봤다. 예전 위키에 적을때하고 다른점은.. 그때는 주로 윈도에서 놀았으나 지금은 거의 리눅스에서만 개발을 하고 있다는 점? 그리고 그때는 재미삼아 common lisp 을 주로 구경했는데 지금은 haskell 에 좀더 관심있다는 정도...
그때나 지금이나 허접한 개발자란건 변함이 없구만.
아래 소스를 올리긴 하는데 내가 워낙 게으른놈이라 코드가 정리가 전혀안됐다. 주석도 처음에 주절주절 적어둔거 그대로.. 심지어는 svn 쓰던 시절의 $Id$ 이것까지 남아있네. 이거 전부 정리해야 할 글인데.. 지금도 몇몇 코드들은 다픈 파일로 따로 뽑아낸 상태인데 언제 시간내서 싹 정리를 해야겠다.
;; vim을 쓰다가 emacs 를 쓰면서 만들고 있는 .emacs ;; 각 섹션마다 ;;;;어쩌구 를 쓰고, 이를 outline-regexp 에 걸리도록 해서 ;; outline-minor-mode 와 같이 쓰기 편하도록 했다.
;; emacs 가 최초로 읽어들이는 설정은 ~/.emacs 이다. ;; ( site-lisp 의 el 을 먼저 읽지만, 그건 개인이 건드릴만한게 아니니 제외 ) ;; ;; .emacs 를 바로 수정해도 되지만, 커스텀변수가 그곳에 저장되는곳이기도 하고 ;; (emacs 가 알아서 써준다), svn 에 넣으려면 따로 폴더를 만들어야 하기 때문에 ;; ~/emacs/emacs.el 을 만들게 되었다.
;; ~/.emacs 의 내용은 다음과 같은 형식이다. ;; ;; (load "~/emacs/emacs.el") ;; (load "~/emacs/office.el") ; 집이라면 home.el ;; ;; 이런식으로 만들어서 쓰니 편하더라.
(require 'cl)
;;;; 여러 환경에서 쓰기 위한 설정값들
(defconstwin32p(eq system-type 'windows-nt)"윈도머신이면 참") (defconstunixp(eq system-type (or 'gnu/linux 'berkeley-unix))"FreeBSD 머신이면 참") (defconsthomep(string-match "MOONFIRE" system-name)"집의 pc 라면 참") (defconstofficep(not homep)"사무실의 pc 라면 참") (defconstextra-packages"~/.emacs.d""내가 추가로 설치한 el 패키지들의 위치")
(defmacrowith-extra-package(path &rest body) "path 가 있으면, load-path 에 추가한다, 단 리눅스인 경우는 경로를 무시하고 있는것으로 간주한다. 지금 우분투를 데스크탑으로 쓰고있는데, 우분투에서는 내가 쓰는 대부분의 el 들이 패키지로 제공이 되니 이런식으로 해결했다." `(let((fullpath (format "%s/%s" extra-packages ,path))) (when(or unixp (file-accessible-directory-p fullpath)) (message "%s 패키지를 찾았습니다" fullpath) (add-to-list 'load-path fullpath) ,@body)))
;;;; 마이너 모드들, 그외 eye-candy 세팅들
(global-font-lock-mode 1); syntanx highlight (transient-mark-mode t); marking highlight (show-paren-mode t); 짝이 맞는 괄호 보여준다 (if(functionp 'global-hi-lock-mode); C-x w h 등으로 특정 단어들을 빛내준다 (global-hi-lock-mode 1) (hi-lock-mode 1)) ;;(global-hl-line-mode 1) ; 현재줄을 빛내준다. 이거 좀 불편해서 뺐다. (setq ring-bell-function (lambda() nil)); bell 무시
(line-number-mode 1); mode line 에 라인수를 표시한다 (column-number-mode 1); mode line 에 컬럼을 표시한다(기본이 아니더라)
(setq-default indent-tabs-mode nil); TAB 보다 space 가 더 좋아졌다.
; lisp 등에서 괄호를 흐리게 보여주는 모드 M-x customize-face ; paren-face 로 적절한 값으로 조절해서 쓰자. 지금은 흰색 바탕화면에서 ; grey80 을 쓰고 있다. (load "~/emacs/parenface") (require 'parenface)
;; http://emacswiki.org/cgi-bin/wiki?InteractiveSearch ;; isearch 중 붙여넣기를 하려면 C-y 가 아닌 M-y 를 해야 하는데 ;; 이건 뭔가 아니다. C-y 로 바꾸자 (define-key isearch-mode-map (kbd "C-y") 'isearch-yank-kill)
;;;; X 에서 휠마우스 버튼 쓰기 ;;(global-set-key [(mouse-4)] 'scroll-down) ;;(global-set-key [(mouse-5)] 'scroll-up)
;;;; 윈도에서는 윈도키를 잘 써먹자 (when win32p (setq w32-pass-lwindow-to-system nil w32-pass-rwindow-to-system nil w32-pass-apps-to-system nil w32-lwindow-modifier 'super ;; Left Windows w32-rwindow-modifier 'super ;; Rigth Windows w32-apps-modifier 'hyper);; App-Menu (right to Right Windows) (global-set-key [(super g)] 'goto-line))
;;;; 폰트 설정 ;; http://www.emacswiki.org/cgi-bin/wiki/ChangeFontsPermanentlyOnWindows ;; http://www.emacswiki.org/cgi-bin/wiki/GoodFonts 에 다른이들이 쓰는 폰트들이 소개되어있다. ;; 폰트를 고른후 (frame-parameter nil 'font) 를 실행하면 폰트를 알수 있다.
;; http://www.emacswiki.org/cgi-bin/wiki/FontSets ;; Finegrained Fontset Control 참고 ;; 원래의 폰트셋에서 korean-ksc5601 부분의 폰트만 굴림으로 바꿨다. (when nil;win32p ;; consolas 에 굴림체 적용 폰트셋 ;; 시프트 클릭으로 적당한 폰트를 고르고 ;; (frame-parameter nil 'font) 를 이용해서 폰트 이름을 얻어서 ;; 그 이름을 이용 create-fontset-from-ascii-font 으로 폰트셋을 만들고, ;; set-fontset-font 으로 korean-ksc5601 에 대해서만 굴림체를 적용시켜줬다. ;; 단 이때 사이즈가 홀수 인경우 커서의 잔상이 남는등 오동작을 하길래 14 로 바꿔주니 잘되더라. (setq w32-enable-italics t) (create-fontset-from-ascii-font "-outline-Consolas-normal-r-normal-normal-14-97-96-96-c-*-iso8859-1") (set-fontset-font "-outline-consolas-normal-r-normal-normal-14-105-96-96-c-*-fontset-iso8859_1" 'korean-ksc5601 "-*-맑은 고딕-normal-r-*-*-14-*-*-*-c-*-ksc5601.1987-*") (set-face-font 'default "-outline-consolas-normal-r-normal-normal-14-105-96-96-c-*-fontset-iso8859_1")
;; 좀더 작은 크기 ;; (create-fontset-from-ascii-font "-outline-Consolas-normal-r-normal-normal-13-97-96-96-c-*-iso8859-1") ;; (set-fontset-font "-*-*-normal-r-normal-normal-13-97-96-96-c-*-fontset-iso8859_1_13" 'korean-ksc5601 "-*-Gulimche-normal-r-*-*-13-*-*-*-c-*-ksc5601.1987-*") ;; (set-face-font 'default "-*-*-normal-r-normal-normal-13-97-96-96-c-*-fontset-iso8859_1_13") )
;; sun 라운드고딕을 한글로, fixed 를 영문으로 (when(and unixp window-system) ;;(set-face-font 'default "-sun-roundgothic-medium-r-normal--12-120-75-75-c-120-ksc5601.1987-0") (set-face-font 'default "fixed") )
;;;; 버퍼 전환 설정(http://www.emacswiki.org/cgi-bin/wiki/CategoryBufferSwitching)
;; from http://www.emacswiki.org/cgi-bin/wiki/BufferMenu (global-set-key (kbd "C-x C-b") 'buffer-menu)
;;;; home 키를 비쥬얼 스튜디오 처럼 ;; from http://www.emacswiki.org/cgi-bin/wiki/BackToIndentationOrBeginning ;; ;; 이거 지워버렸다. ;; 공백이 아닌 첫 문자로 point 를 위치시킬때는 M-m 을 하면 된다.
;; Customizations for all modes in CC Mode. (defunmy-c-mode-common-hook() (c-add-style "PERSONAL" my-c-style t) (setq tab-width 4 ;;indent-tabs-mode t c-basic-offset 4) (c-toggle-auto-state -1); disable auto-newline mode (c-toggle-hungry-state 1); enable hungry-delete mode
;; return 으로 indent 까지 같이 하도록했다 (define-key c-mode-base-map "\C-m" 'newline-and-indent)
;; C-c RET 로 .h .cpp 간의 전환을 하도록 했다. (define-key c-mode-base-map [(control c)(return)] 'ff-find-other-file)
;; ecb 가 켜진 상태라면, C-c C-c 를 ecb-goto-window-methods 에 바인딩했다. (when(fboundp 'ecb-goto-window-methods) (define-key c-mode-base-map [(control c)(control c)] 'ecb-goto-window-methods))
;; cedet 가 로딩된상태라면 META-Ret 를 semantic-analyze-possible-completions 로 매핑했다. ;; semantic-ia-complete-symbol 등 여러선택이 있지만 이놈이 맘에들었다. ;; ...다가 다시 semantic-ia-complete-symbol 로 바꿨다. 새로 버퍼가 열리면서 인자까지 보여주는게 맘에 들었었는데, ;; 버퍼가 다시 사라지지 않은게 이유 (when(fboundp 'semantic-analyze-possible-completions) (define-key c-mode-base-map [(meta return)] 'semantic-ia-complete-symbol-menu))
;;;; eshell 설정 ;; http://www.emacswiki.org/cgi-bin/wiki/CategoryEshell
;; From http://www.emacswiki.org/cgi-bin/wiki.pl?EshellFunctions (defuneshell/emacs(&rest args) "Open a file in emacs. Some habits die hard." (if(null args) ;; If I just ran "emacs", I probably expect to be launching ;; Emacs, which is rather silly since I'm already in Emacs. ;; So just pretend to do what I ask. (bury-buffer) ;; We have to expand the file names or else weird stuff happens ;; when you try to open a bunch of different files in wildly ;; different places in the filesystem. (mapc #'find-file (mapcar #'expand-file-name args))))
;; from http://www.emacswiki.org/cgi-bin/wiki.pl/EshellInteractivelyRemove (setq eshell-cp-interactive-query t eshell-ln-interactive-query t eshell-mv-interactive-query t eshell-rm-interactive-query t eshell-mv-overwrite-files nil)
;; eshell 스크롤, 아직 원하는대로 돌지 않는다. ;; http://www.emacswiki.org/cgi-bin/wiki/EshellScrolling (setq eshell-scroll-show-maximum-output t eshell-scroll-to-bottom-on-output nil)
;;;; FFAP(Finding Files and URLs at Point) ;; ido 를 쓰면서 이놈 뺀다. ;;(ffap-bindings)
;; ffaq-c-path 는 vim 의 includeexpr 같은놈으로, ffap 시의 path 를 지정해 준다 ;; ffap-bindings 을 뺐지만 ido 가 ffap 의 코드를 그대로 썼다 하니 ffap-c-path 값은 살려둔다. (setq ffap-c-path (cond(win32p '("C:/Program Files/Microsoft Platform SDK/Include" "C:/Program Files/Microsoft Visual Studio 8/VC/include" "C:/Program Files/Microsoft Visual Studio 8/VC/atlmfc/include" "C:/Program Files/Microsoft Visual Studio 8/VC/PlatformSDK/Include")) (t ; win32 가 아니면 유닉스라고 생각. '("~/boost/include/boost-1_38" "/usr/include" "/usr/include/c++/4.3" "/usr/local/include" "/usr/X11R6/include" ))))
;;;; putty 를 통해 접속한경우를 위해서(미완성) ;; 아직은 코딩할때 vim 쓰기 때문에.. 이부분 업데이트는 최후에 한다.
(global-set-key "\e[A" 'previous-line); VT100 small keypad up arrow (global-set-key "\e[B" 'next-line); VT100 small keypad down arrow (global-set-key "\e[C" 'forward-char); VT100 small keypad right arrow (global-set-key "\e[D" 'backward-char); VT100 small keypad left arrow
(global-set-key "\e[2~" 'overwrite-mode); insert (global-set-key "\e[1~" 'beginning-of-line); home (global-set-key "\e[4~" 'end-of-line); end (global-set-key "\e[5~" 'scroll-down); page up (global-set-key "\e[6~" 'scroll-up)); page down
;;;; word-at-point 로 영어사전 검색 ;; 햐.. 몇줄안되지만 elisp 처음 써보는거라 힘들었다. ;; thingatpt 의 word-at-point ( thing-at-point 의 alias ) 의 존재를 모르고 ;; word-at-point 를 만들어 볼려고 고생했었는데.. thingatpt 의 존재를 알게되서 다행이다 ;; 키바인딩을 해야 하는데.. 뭘로 할까? vim 이면 <Leader>dic 정도로 했을텐데..
;;;; backup 설정 ;; 나는 작업 디렉토리에 백업파일이 남는것을 싫어한다 ;; backup-by-coping 이라는 중요한 변수가 있는데, 메뉴얼을 봐라
(setq backup-directory-alist '(("." . "~/.emacs_backup"))) (setq version-control t ; 백업을 여러벌한다 kept-old-versions 2 ; oldest 백업 2개는 유지 kept-new-versions 3 ; newest 백업 3개 유지 delete-old-versions t); 지울때마다 묻지 않도록
;;;; M-x compile 설정
(require 'compile)
;; 내가 원하는 빌드 과정을 간단히 적으면 ;; ;; 1. 어떤 코드를 수정을 하다가 빌드를 하려는 마음이 생기면 ;; 2. Makefile ( 또는 *.sln ) 이 존재하는 디렉토리로 가서 ;; 3. 적절한 빌드 명령 (make 또는 devenv) 을 내리고 ;; 4. 원래의 코드 작성으로 돌아온다. ;; ;; 위와 같다. ;; 아래 함수는 그런 일을 해주는데 간단히 설명을 적으면 ;; ;; .emacs-dirvars 등을 통해 yoonkn-build-option 의 값을 ;; (:wc "c:/tmp/a/build" :cmd "make -k ") ;; 이런식으로 지정을 해두고 아래 함수를 실행하면 ;; 현재 작업 디렉토리를 기억해두고 wc 로 지정된 디렉토리로 가서 ;; cmd 로 지정된 명령을 실행후 기억해둔 작업디렉토리로 돌아오게 된다. ;; ;; 2008/12/19 ;; dirvars 에 해당하는 기능이 emacs 에 정식으로 들어와서 그쪽을 쓰도록 ;; 했다. 뭐 사실 yoonkn-build 는 안바꿔도 되지만 수정 하는 김에 plist ;; 에서 alist 형태로 바꿨다. ;; ;; 세팅은 아래 코드 참고 ;; ;; (setq project-directory-alist nil) ;; (define-project-bindings 'mao ;; '((nil . ((yoonkn-build-option . ((source-directory . "~/scratch/voceweb/libbrpc") ;; (build-directory . "/tmp/mao") ;; (build-command . "make "))))))) ;; (set-directory-project "~/scratch/voceweb/libbrpc" 'mao) ;; (defunyoonkn-build() (interactive) (if(and (boundp 'yoonkn-build-option) (not (null yoonkn-build-option))) (let((pwd (substring (pwd)(length "Directory "))) (wc (cdr (assq 'build-directory yoonkn-build-option))) (compile-command (cdr (assq 'build-command yoonkn-build-option)))) (unwind-protect (progn (cd wc) (call-interactively 'compile)) (cd pwd))) (call-interactively 'compile)))
;;;; psvn.el subversion 지원 ;; ~/emacs 폴더 안에 psvn.el(http://www.xsteve.at/prg/emacs/psvn.el) 을 집어넣었다. ;; vim 의 subversion 지원 플러그인보다 불편한것 같다 ;; http://www.xsteve.at/prg/index.html 는 좋은 내용이 많으니 한번씩 가보자 ;; 이곳의 .emacs 는 내가 지금까지 본것중에는 가장 방대하더라
;;;; F12 키를 누르면 *svn-status* 를 바로 보도록 ;; 내가주로 코딩을 할때 svn-status 를 자주 쓰기때문에 이렇게 만들어 둔다. ;; F12 에 매핑할 가치가 있다.. ;; ;; (mapcar #'buffer-name (buffer-list)) 로 현재 버퍼들의 이름을 따오고 ;; (remove-if-not .. ) 로 *svn-statur* 를 찾아서 ;; 있다면, switch-to-buffer ;; 없다면 svn-status 를 실행 ;; (defunswitch-to-svn-status-buffer() "if there is a buffer named *svn-statys*, switch to it. or execute svn-status" (interactive) (if(remove-if-not #'(lambda(x)(string-equal "*svn-status*" x)) (mapcar #'buffer-name (buffer-list))) (switch-to-buffer "*svn-status*") (call-interactively 'svn-status))) ;; (global-set-key [(f12)] 'switch-to-svn-status-buffer)
;;;; 이건 C-u F12 로 현재 버퍼 기억, F12 로 그 버퍼로 점프 (defunyoonkn/quick-switch-buffer() "f12 에 매핑을 했다면 C-u f12 를 눌러서 현재 버퍼를 기억해두고 f12 를 누르면 그 버퍼로 뿅" (interactive) (if current-prefix-arg (setq yoonkn/quick-switch-buffer-registered (current-buffer)) (switch-to-buffer yoonkn/quick-switch-buffer-registered))) (global-set-key [(f12)] 'yoonkn/quick-switch-buffer)
;;;; darcsum.el ;; http://chneukirchen.org/repos/darcsum/ ;; http://darcs.net/DarcsWiki/DarcsumMode ;; ;; 전에는 에러가 나서 못쓰고있었는데, 갑자기 생각나서 새버전을 받아보니 ;; 잘 돌아가더라. M-F12 를 darcsum-whatsnew 에 매핑도 해둔다. ;; (require 'darcsum) ;; (defun switch-to-darcsum-buffer () ;; (interactive) ;; (if (remove-if-not #'(lambda (x) (string-equal "*darcs*" x)) ;; (mapcar #'buffer-name (buffer-list))) ;; (switch-to-buffer "*darcs*") ;; (call-interactively 'darcsum-whatsnew))) ;; (global-set-key [(meta f12)] 'switch-to-darcsum-buffer)
;; 윈도스럽게, 왼쪽버튼과 오른쪽 버튼을 쓰는게 편하다. (setq ecb-primary-secondary-mouse-buttons (quote mouse-1--mouse-2))
;; 초기 팁 알려주는거 끈다 (setq ecb-tip-of-the-day nil)
;; ecb-source-path 를 세팅해두면 좀더 편해진다. ;; cedet 와 같이 ffap-c-path 를 재사용했다. (add-hook 'ecb-activate-hook '(lambda() (setq ecb-source-path (append ecb-source-path ffap-c-path))))
;; method-buffer 외에는 별 필요가 없어보인다.(vim 의 TagList 를 원하고 있기 때문에) ;; 음 ecb-layout-name 은 setq 로 지정하지 말고 customize 로만 바꿔야 한다고 문서에 있네.. ;; 일단 주석처리 한다. ;;(setq ecb-layout-name "left9") )
;;;; renumber regeion ;; http://www.emacswiki.org/cgi-bin/wiki/RenumberList ;; 주석문 안의 region 에는 적용안되는게 좀 아쉽다. ;; 그냥 정규식에 * 이후도 포함하게 해버릴까? ;; 모드마다 주석인지 감지해서 돌아갔으면 좋겠는데..
(defunrenumber-list(start end &optional num) "Renumber the list items in the current START..END region. If optional prefix arg NUM is given, start numbering from that number instead of 1." (interactive "*r\np") (save-excursion (goto-char start) (setq num (or num 1)) (save-match-data (while(re-search-forward "^[0-9]+" end t) (replace-match (number-to-string num)) (setq num (1+ num))))))
;;;; vim 의 % 처럼, 짝이 맞는 괄호를 찾아주는 놈 ;; http://www.emacswiki.org/cgi-bin/wiki/MatchParenthesis ;; 에서 가져왔다. (defunmatch-paren() "% command of vi" (interactive) (let((char (char-after (point)))) (cond((memq char '(?\( ?\{ ?\[)) (forward-sexp 1) (backward-char 1)) ((memq char '(?\) ?\} ?\])) (forward-char 1) (backward-sexp 1)) (t (call-interactively 'self-insert-command)))))
;; (defun match-paren (arg) ;; "Go to the matching paren if on a paren; otherwise insert %." ;; (interactive "p") ;; (cond ((looking-at "\\s\(") (forward-list 1) (backward-char 1)) ;; ((looking-at "\\s\)") (forward-char 1) (backward-list 1)) ;; (t (self-insert-command (or arg 1)))))
;; % 에 바로 바인딩했다. ;; 필요하다면, C-q % 를 쓰자 (global-set-key (kbd "%") 'match-paren)
;;;; timestamp 입력 ;; 나중에 주석을 달고 자동으로 넣는다던지.. 등등할때 쓸려고 만들어 둔다. ;; howm-mode 인경우엔 [2005-06-08] 의 형태로 입력하도록 했다. ;; 추후에도 특별한 상황에 특별한 포맷스트링을 쓰려면, cond 부분에 적당히 추가해주면 된다. (defunyoonkn-insert-timestamp() (interactive) (insert (format-time-string (cond((and (featurep 'howm) howm-mode)"[%Y-%m-%d]") (t "%Y/%m/%d %H:%M:%S"))))) (global-set-key (kbd "ESC ESC tm") 'yoonkn-insert-timestamp); tm 은 time 의 tm
;; hs-minor-mode 가 더 어울리겠지만, 주석 ;;;; 로 아웃아리닝을 하기위해서 ;; outline-minor-mode 를 골랐다. hs-minor-mode 를 켜고 정규식을 바꿔주려고 했는데 ;; 방법을 아직 못찾았다. (outline-minor-mode 1) (local-set-key (kbd "RET") 'newline-and-indent) (setq indent-tabs-mode nil))))
;; ffap 에 python module 을 찾는 기능을 넣기 위해서, 구글링해서 가져온 코드들 ;; ;; ffap.py 의 내용은 아래와 같다. ;; import imp, sys, string ;; ;; def find(parts, path=None): ;; top = parts[0] ;; file, pathname, stuff = imp.find_module(top, path) ;; if not parts[1:]: ;; return pathname ;; mod = imp.load_module(top, file, pathname, stuff) ;; return find(parts[1:], mod.__path__) ;; ;; if __name__ == '__main__': ;; try: ;; sys.stdout.write(find(string.split(sys.argv[1], '.'))) ;; except ImportError: ;; pass
(defunffap-python() (interactive) (let((keyword (word-at-point))); word-at-point 가 어쩌구.저쩌구 에서 저쩌구 만 가져오기 때문에 깔끔하게 돌지 못하더라. (let((text (shell-command-to-string (format "cmd.exe /c \"%s\" %s" (expand-file-name "~/emacs/ffap.py") (read-from-minibuffer "module? " keyword))))) (find-file text))))
;;;; ispell 설정 ;; 영어로 주석을 달기 위해서 flyspell-prog-mode 를 쓰고싶었는데, ;; 이거 켜니까 너무 느리구나. ;; 그냥 aspell 깔아만 둔다. ;; aspell 은 http://aspell.sourceforge.net/ 에서 윈도용 포트도 받을수 있다.
;;;; table.el 사용 ;; http://table.sourceforge.net/ ;; 테이블 작성할때 괜찮아 보이길래 주워왔다. ;; M-x table-insert 로 사용시작. ;; 역시 한글은 잘 안된다. ;; 폰트를 다른것으로 바꿔보면 제대로 보이게 되는데, ;; 음 왜 쿠리어로는 안되지? ;; 프비에서 fixed 폰트를 쓰면 정상으로 보이더라. ;; 내가 주로 쓰는 쿠리어뉴, 루시다, 선 라운드고딕은 모두 비정상이다.
;; (require 'table)
;;;; RSS reader, newsticker.el 설정
;; SharpReader 로 대체했다. ;; newsticker.el 은 많은 사이트를 등록했을때 느려지는 현상이 있더라. ;; 동작하는 방식은 newsticker.el 에 만족을 하지만 ;; 어쩔수 없이 SharpReader 로 옮겨갔다
;; http://www.nongnu.org/newsticker/ (http://savannah.nongnu.org/projects/newsticker/) ;; M-x newsticker-start 로 시작 ;; M-x newsticker-show-news 로 뉴스를 보면 된다. ;; newsticker-url-list 는 4개의 element 를 가지는데, 각각 ;; (이름 주소 시작시각 인터벌) ;; 이다.( \C-h v newsticker-url-list 로 좀더 자세한 도움말)
;; ;; ESC ESC rss 를 newsticker-show-news 에 바인딩 ;; (global-set-key (kbd "ESC ESC rss") 'newsticker-show-news)
;;;; lua-mode 설정 ;; lua-mode.el 은 구글링해서 lua 관련페이지에서 주워왔다. ;; 나중에 emacs 에 정식으로 lua-mode 가 지원되면 지우자 (require 'lua-mode)
;;;; w32-find-dired ;; http://www.emacswiki.org/cgi-bin/wiki/WThirtyTwoFindDired ;; w32-find-dired.el 때문에 findr.el 도 추가되었는데, ;; 이놈이 쏠쏠하다. (require 'w32-find-dired)
;;;; Makefile.* 를 열때 makefile-mode 로 뜨도록 (add-to-list 'auto-mode-alist '("\\`Makefile\\.[[:alpha:]]*" . makefile-mode))
;;;; yoonkn-grep-project ;; ;; 아래 주석의 세줄은 이전버전의 yoonkn-grep-semantic-project-root 에서 배운것들로, ;; 힘들게 찾았던것이니 주석에 남겨둔다. ;; ;; convert-standard-filename 가 유닉스 스타일 path 를 윈도 스타일 path 로 바꿔주는 함수 ;; elt 는 시퀀스(배열) 에서 n 번째 엘리먼트를 얻을때 ;; 그리고 백쿼트, `(이건평가안되고 ,(이건평가된다)) 는 꼭 외워두자 ;;
;; (defun yoonkn-grep-project () ;; "현재 디렉토리, 또는 project-root 를 대상으로 gre-find(strfind.exe 를 이용한) 을 한다.
;; 만약 current-prefix-arg 가 지정되었거나, 현재 디렉토리가 ;; 프로젝트관리하에 없다면 현재 디렉토리로 grep-find 를 하고,
;; (autoload 'gcl "ilisp" "Inferior GNU Common Lisp." t)
;; ;; 기본적으로 깔리는 gcl.bat 는 gcl binary 를 start 를 이용해 띄우고 ;; ;; 있는데, 이럴경우 새창으로 떠버리기 때문에, emacs 내에서 같이 쓰지 ;; ;; 못한다. start 를 제외한 gcl2.bat 를 만들어서 이놈을 불러주면 해결된다. ;; (setq gcl-program "C:/bin/GCL-2.6.5-ANSI/bin/gcl2.bat") ;; (setq inferior-lisp-program gcl-program)
(defunindent-or-slime-complete-symbol() "포인트(커서)가 단어 끝에 위치했다면 slime-complete-symbol 을 부르고 아니라면 인덴트" (interactive) (if(looking-at "\\>") (slime-complete-symbol) (indent-according-to-mode)))
;;;; use GNU GLOBAL ;; ;; xgtags.el 를 잠시 써봤는데, gtags.el 의 동작이 더 맘에 들어서 원복 ;; (load "~/emacs/gtags") (add-hook 'c-mode-common-hook (lambda()(gtags-mode 1))) (global-set-key "\C-c\M-." 'gtags-find-rtag); gtags-find-rtag 는 매핑해서 써야지
;; gtags-mode 상태에서는 C-S-f 를 gtags 의 기능을 이용하도록 하자 (defunyoonkn%search-project-by-gtags() (interactive) (if current-prefix-arg (yoonkn-grep-project) (gtags-find-pattern)))
;; 헐 힘들게 만들었다. ;; 리스트들을 join 해서 스트링으로 만드는것은 (mapconcat 'identity ffap-c-path "") 으로 하고 ;; 거기에 loop collect 를 한번 써봤다. ;; (defun yoonkn%setenv-gtagslibpath (path-list) ;; (setenv "GTAGSLIBPATH" ;; (mapconcat 'identity ;; (loop for path in path-list ;; collect (concat (convert-standard-filename path) ";")) ;; "" ;; )))
;; 위의 함수를 이용해서 ffap-c-path 를 GTAGSLIBPATH 로 잡아주도록 하자. ;; dirvars.el 하고 같이 쓰려다 보니 find-file-hook 에 매달게 되었다. ;; 다른 hook 에 매달면 dirvars.el 통해서 ffap-c-path 가 바뀌기 전에 불려버리네.. ;; (add-hook 'find-file-hook ;; '(lambda () (yoonkn%setenv-gtagslibpath ffap-c-path)))
;;;; use xcscope.el ;; 요거 존내 좋구나 ;; gtags 의 깔끔함이 더 맘에 들지만 이것도 세팅해둔다 ;; cscope-database-regexps 설정은 office.el 에 해둔다. ;; cscope 설치후엔 INCLUDEDIRS 환경변수를 잡는것을 잊지 말자 (require 'xcscope)
(defunyoonkn%select-other-window() "cscope-bury-buffer 가 오동작하길래 땜빵으로 만들었다" (interactive) (message "cscope-bury-buffer 가 정상작동하는지 확인해보고 이거 지워라!") (select-window (previous-window)) (delete-other-windows))
;;;; cdb-gud.el ;; MS 의 cdb.exe 를 쓰기 위해 ;; http://www.emacswiki.org/elisp/cdb-gud.el ;; (load "cdb-gud")
;;;; quack.el ;; SICP 를 공부하기 위해서 scheme 모드를 설치했다. ;; http://www.neilvandyke.org/quack/ ;; (setq quack-pltcollect-dirs '("C:/Program Files/PLT/collects/")) ;; (require 'quack)
;;;; howm ;; http://howm.sourceforge.jp/ 에서 받을수 있다. ;; planner 보다 좀더 나은듯 ;; ;; NOTE 음. EmacsW32 의 문제인가.. emacs 를 새로 깔았더니 howm 을 ;; .emacs 실행중에 읽으면 안되고 user init 이 다 끝난후에 불러야만 ;; 로딩이 되는 문제가 있어서 window-setup-hook 에 매달아 뒀다. (when nil (add-to-list 'auto-mode-alist '("\\.howm$" . org-mode)) (add-hook 'window-setup-hook (lambda() (with-extra-package "howm-1.3.4" (add-hook 'org-mode-hook 'howm-mode) (let((howm-installed-path (format "%s/howm-1.3.4" extra-packages))) (defconsthowm-en-dir(expand-file-name (concat howm-installed-path "/en"))) (add-to-list 'load-path howm-installed-path) (setf howm-directory "~/emacs/howm/") (require 'howm) (setf howm-menu-todo-priority (- howm-huge-))))))); 지나간 TODO 들이 표시되는것을 막았다. 버전1.3.3 부터 이러더라.
;;;; RFC 가져오기 ;; http://emacswiki.org/cgi-bin/wiki/JorgenSchaefersEmacsConfig ;; M-x rfc 후 0 또는 원하는 rfc 문서번호를 넣는다. ;; RFC 를 가져오는것 자체보다, 여러가지로 응용해볼만한 함수 (defunrfc(num) "Show RFC NUM in a buffer." (interactive "nRFC (0 for index): ") (let((url (if(zerop num) "http://www.ietf.org/iesg/1rfc_index.txt" (format "http://www.ietf.org/rfc/rfc%i.txt" num))) (buf (get-buffer-create "*RFC*"))) (with-current-buffer buf (let((inhibit-read-only t)) (delete-region (point-min)(point-max)) (let((proc (start-process "wget" buf "wget""-q""-O""-" url))) (set-process-sentinel proc 'rfc-sentinel)) (message "Getting RFC %i..." num)))))
;;;; dired-do-kill-comment dired 모드중 선택된 파일의 주석 제거 ;; 공부겸 짜봤다. ;; save-current-buffer, set-buffer, save-buffer 의 사용법과 ;; dolist, dired-get-marked-files, find-file-noselect, 그외 ;; count-lines, point-min, point-max 등의 용법을 봐두자. (defundired-do-kill-comment() "dired 모드중 선택된 파일들의 주석들을 지워준다. kill-comment 를 이용하기 때문에 주석이 지워지고 난후 공백이 남는다." (interactive) (dolist(file (dired-get-marked-files)) (save-current-buffer (set-buffer (find-file-noselect file)) (message "%s 의 주석을 지우는 중입니다." file) (kill-comment (count-lines (point-min)(point-max))) (when(buffer-modified-p) (message "%s 의 주석을 지웠습니다." file) (save-buffer)))))
;;;; yoonkn-fortune ;; shell-command-to-string 의 함수를 몰랐을때는 ;; (insert ;; (with-temp-buffer ;; (shell-command "fortune" t) ;; (buffer-string)))) ;; 이렇게 만들어 썼었다. ;; (with-temp-buffer ... (buffer-string)) ;; 은 기억해둘만한 표현이라 주석으로 남겨둔다. (defunyoonkn-fortune() "시작시 fortune 을 보려고 http://www.pie.pe.kr/cgi-bin/moin.cgi/stupid_fortune_for_win32 를 짜고, 이런 함수를 만든다." (interactive) (insert (shell-command-to-string "fortune")))
;;;; yoonkn/create-file ;; emacs 초기화과정에 필요한 파일이 없는경우 그 파일을 생성해내기 ;; 위해서 만든 함수인데 이걸 만든 현재는 아직 적용하지는 않았다. 대강 ;; 만들어보고 테스트까지만 끝낸 상태. (defunyoonkn/create-file(path content &optional overwrite) "content 의 내용을 가지는 path 파일을 생성한다. 이미 파일이 존재하는 경우는 아무일도 하지 않지만, overwrite 가 t 로 주어지면 파일을 새로 덮어 쓰게 된다." (interactive) (when(or (not (file-exists-p path)) (eql overwrite t)) (set-buffer (find-file-noselect path)) (erase-buffer) (insert content) (save-buffer) (kill-buffer nil)))
pre { padding: 5px; border: 1pt solid #AEBDCC; background-color: #F3F5F7; font-family: Consolas, Bitstream Bera Sans Mono, courier new, courier, monospace; margin-left: 3%; white-space: pre; } </style> ") )
;;;; planner-mode (muse 지원 추가된 신버전) ;;; 원래의 planner 에서 planner-muse 를 쓰다가 planner 에 muse 지원이 ;;; 추가되어서 다시 planner 에 맞는 세팅으로 수정 ;;; 도움말은 http://www.mwolson.org/static/doc/planner.html (with-extra-package "planner" (setq planner-project "WikiPlanner") (load "planner") (require 'planner) (setq muse-project-alist '(("WikiPlanner" ("~/emacs/plans" :default"TaskPool" :major-mode planner-mode :visit-link planner-visit-link) (:base"xhtml":path"~/emacs/published_plans")))) (setq mark-diary-entries-in-calendar t))
;;;; yoonkn-choose-random-line (defunyoonkn-choose-random-line() "현재 버퍼 내에서 랜덤하게 10줄의 내용을 뽑아 보여준다. CD 리스트중 랜덤하게 내용을 뽑고싶을때가 있어서 만들었다.
기억해둘만한 elisp 사용들은,
현재 버퍼의 줄수를 세고, 그중에 하나를 뽑아내는 random-line-number 지정된 줄의 내용을 가져오는 get-line-text 위의 함수들을 보기쉽도록 구분한 flet 용법 dotime 를 통한 반복문 princ 를 통해서 human-readable 한 출력 ( 시험삼아 print 로 바꿔서 출력해보자 ) new line 을 넣어주는 terpri ( common-lisp 의 fresh-line 함수는 지원되지 않았다 ) " (interactive) (flet((random-line-number ()(random (count-lines (point-min)(point-max)))) (get-line-text (num) (save-excursion (goto-line num) (buffer-substring (line-beginning-position) (line-end-position)))) (get-random-line () (get-line-text (random-line-number)))) (dotimes(x 10) (princ (get-random-line)) (terpri))))
;;;; yoonkn-execute-program ;;; http://www.pie.pe.kr/cgi-bin/moin.cgi/EmacsAsLauncher ;;; emacs 를 어플리케이션 런처로 이용 ;;; launchy 를 쓰게되면서 더이상 쓰지 않게됐다. (setq yoonkn-executable-program-list '(("emacs" . "c:/bin/emacs/bin/emacs") ("notepad" . "notepad.exe") ("cmd" . "cmd.exe")))
(defunyoonkn-execute-program() "간단한 런처 함수. QuickCut 이란 런처로부터 동기를 얻고 webjump 와 iswitchb 패키지를 참고해서 작성했다. howm 을 참고해서 메이저모드로 짜고싶었는데 일단 간단한 함수로 하나 만들어 두고 뒤로 미룬다. ;; (setq yoonkn-executable-program-list ;; (append '((\"notepad\" . \"notepad.exe\") ;; (\"emacs\" . \"c:/bin/emacs/bin/emacs.exe\")) ;; yoonkn-executable-program-list)) 이런식으로 원하는 프로그램을 등록해서 사용하자
;;;; gnuserv ;;; 브라우저에서 소스보기등, 윈도우와 emacs 를 좀더 친하게 지내기위한 툴 ;;; http://www.gnu.org/software/emacs/windows/faq3.html#TOC36 를 읽어보자 ;;; 그리고 에러처리를 하는 예제이기도 하다. 위쪽의 코드들도 이런식으로 수정해야 할텐데.. ;;; ;;; EmacsW32 로 갈아타며 주석처리했다. EmacsW32 에선 기본으로 띄워주기때문에 쫑나더라 ;;; ;; (condition-case nil ;; (progn ;; (load-library "gnuserv") ;; (gnuserv-start) ;; (setq gnuserv-frame (selected-frame))) ;; (file-error "no gnuserv.el") ;; (error "unknown error"))
;;;; w3 ;;; 너무 느린감이 있는데, cygwin 을 쓰지 않다보니 w3m 은 안되고, ;;; nero.el 은 모양이 덜이뻐서 이걸 깔았다 ;; (let* ;; ((w3-dir "~/.emacs_plugin/w3-4.0pre.47/lisp") ;; (w3-exists (file-exists-p w3-dir))) ;; (when w3-exists ;; (add-to-list 'load-path w3-dir) ;; (require 'w3-auto)))
;;;; nero.el ;;; w3 은 너무 느리고 최신버전의 윈도용 lynx 를 배포하는곳을 찾은김에 ;;; nero.el 도 로딩해둔다 win32 용 lynx 는 아래사이트에서 받자 ;;; http://csant.info/lynx ;;; ;;; nero.el 은 http://www.ma.utexas.edu/~jcorneli/a/elisp/nero.el 에서 ;;; 받을수있다 ;;; ;;; NOTE: path 내에 포함된 공백때문에 문제가 생겨서 c:/bin/lynx 에 ;;; 설치를 하고 c:/bin/lynx/lynx.bat 를 약간 수정해서 lynx2.bat 를 ;;; 만들었다 전에 쓰던 구버전의 lynx 보다 좀더 피곤한듯 ;;; ;;; -------- lynx2.bat --------- ;;; @set temp=c:\bin\lynx\tmp ;;; @set lynx_cfg=c:\bin\lynx\lynx.cfg ;;; @set lynx_lss=c:\bin\lynx\opaque.lss ;;; @c:\bin\lynx\lynx.exe %1 %2 %3 %4 %5 ;;; ---------------------------- ;; (load-library "nero") ;; (setq nero-lynx-program "c:/bin/lynx/lynx2.bat") ;; (setq nero-links-display-default nil) ;; (setq nero-default-coding-system 'euc-kr)
;;;; tramp-mode ;; /plink:yoonkn@111.111.111.11:/home/yoonkn/src/ 형태로 열면 된다. ;; 아직 자주 쓰지 않으니 상세한 설정은 나중에 (require 'tramp) (setq tramp-auto-save-directory "c:/tmp" tramp-default-method "plink" tramp-password-end-of-line "\r\n")
;;; gud 설정 (setq gdb-many-windows t); mingw 의 gdb 버전을 올리면 그럭저럭 잘 돌아가길래 이걸 기본으로 했다. (global-set-key [f9] 'gud-break) (global-set-key [f10] 'gud-next) (global-set-key [f11] 'gud-step) (global-set-key [(shift f11)] 'gud-finish) (global-set-key [(shift f10)] '(lambda() (interactive) (call-interactively 'gud-tbreak) (call-interactively 'gud-cont))) (global-set-key (kbd "C-x C-a C-c") 'gud-cont) (global-set-key (kbd "C-x C-a C-w") 'gud-watch)
;;;; org-mode ;; 아직 여기 적용하지는 않고 org-customize 를 통해서만 세팅하고 있는데 ;; org-hide-leading-stars 를 t 로 잡고 org-hide face 를 gray90 정도로 ;; 잡으면 흰색바탕에서 보기 좋은 모양이 나온다. (require 'org) (add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode)) (add-to-list 'auto-mode-alist '("\\`TODO\\'" . org-mode)) (add-to-list 'auto-mode-alist '("\\`README\\'" . org-mode)) (global-set-key (kbd "ESC ESC <f12>") 'org-agenda); ESC ESC f12 로 org-agenda 띄우도록 했다. (mapc #'(lambda(x)(add-to-list 'org-agenda-files x)) '("~/emacs/org/office.org" "~/emacs/org/home.org")) (setq org-log-done t ;; 시작할때 적절히 접은 상태로 org-startup-folded 'content ;; 태그로 검색했을때 너무 많이 걸리네. 태그상속은 끄자. org-use-tag-inheritance nil ;; 헤더를 보여주는 * 들을 좀더 이쁘게 보자. org-face 페이스를 ;; gray90 정도로 잡아주는것도 잊지말자. 여기서하는 하는 방법을 ;; 모르겠네 org-hide-leading-stars t )
;;; 매일매일 뭔가를 적을때도 org-mode 를 써먹자. (defunyoonkn-today-org-note-name() "노트를 월단위로 작성하기 위해서 연도.월.org 의 이름을 리턴하도록 했다." (let((tm (decode-time (current-time)))) (format "~/emacs/org/%d.%02d.org"(nth 5 tm)(nth 4 tm))))
;;;; findr 해서 indent 하기 ;; findr.el 이 필요 (defunindent-all-files(dir) "지정된 디렉토리 아래에서 C 소스파일들을 찾아 indent 한다. 사용하기 전에 상황에 맞게 조금씩 수정하면서 사용하자." (interactive "D") (save-excursion (dolist(file (findr "\\.c$\\|\\.h$" dir)) (unless(string-match "_darcs" file) (set-buffer (find-file-noselect file)) (message "indenting %s..." file) (mark-whole-buffer) (call-interactively 'indent-region) (when(buffer-modified-p) (message "done.") (save-buffer)) (kill-buffer (current-buffer))))))
;;;; d-mode.el ;; ;; http://www.prowiki.org/wiki4d/wiki.cgi?EditorSupport/EmacsEditor ;; (autoload 'd-mode "d-mode""Major mode for editing D code." t) (add-to-list 'auto-mode-alist '("\\.d[i]?\\'" . d-mode)) ;; Many of DMD's compilation error messages lack a category prefix ;; (like "Error" or "Warning"). Without the category, the messages ;; don't match Emacs' built-in error matching regexps used for M-x ;; next-error after a M-x compile. That makes M-x compile unable to ;; take you to the the file and line where the error is. (add-to-list 'compilation-error-regexp-alist '("^\\([^ \n]+\\)(\\([0-9]+\\)): \\(?:error\\|.\\|warnin\\(g\\)\\|remar\\(k\\)\\)" 1 2 nil (3 . 4)))
;;;; wedisk lister ;; 짜다 말았다. ;; (defun wedisk () ;; (interactive) ;; (let ((url "http://wedisk.co.kr/wedisk/wedisk.jsp?qrytype=2&ds=107&dasort=107&sorttype=0&rc=100&cate_ds=0&wordtype2=1&category=08&wordtype=1") ;; (inbuf (get-buffer-create "*wedisk-raw*")) ;; (outbuf (get-buffer-create "*wedisk*")) ;; (maxpage 10)) ;; (flet ((output (msg) ;; (with-current-buffer outbuf ;; (goto-char (point-max)) ;; (insert msg))) ;; (extract (text begin end) ;; (let* ((pos1 (+ (string-match begin text) (length begin))) ;; (pos2 (string-match end text pos1))) ;; (substring text pos1 pos2))) ;; (geturl (page) (format "%s&vp=%d" url page))) ;; (with-current-buffer outbuf ;; (delete-region (point-min) (point-max))) ;; (with-current-buffer inbuf ;; (loop for i from 1 to maxpage ;; do (progn ;; (delete-region (point-min) (point-max)) ;; (output (format "======== %d 페이지 ========\n" i)) ;; (insert-buffer (url-retrieve-synchronously (geturl i))) ;; (while (re-search-forward "<td title=.*>.*\n*.*javascript:openDnWin(.*)" nil t) ;; (let* ((text (match-string 0)) ;; (title (extract text "title=\"" "\>")) ;; (id (extract text "javascript:openDnWin(" ", "))) ;; (output (format "%s: %s\n" id title)))))) ;; (switch-to-buffer outbuf)))))
;; ;;;; global-modes ;; ;; 아래의 light-symbol-mode 를 전체 버퍼에 적용하기 위해서 가져왔다. ;; ;; (add-hook 'find-file-hook 'light-symbol-mode) 이런것도 되지 않을까? ;; (load-library "global-modes")
;;;; lispdoc ;; http://bc.tech.coop/blog/070515.html (defunlispdoc() "Searches lispdoc.com for SYMBOL, which is by default the symbol currently under the curser" (interactive) (let*((word-at-point (word-at-point)) (symbol-at-point (symbol-at-point)) (default (symbol-name symbol-at-point)) (inp (read-from-minibuffer (if(or word-at-point symbol-at-point) (concat "Symbol (default " default "): ") "Symbol (no default): ")))) (if(and (string= inp "")(not word-at-point)(not symbol-at-point)) (message "you didn't enter a symbol!") (let((search-type (read-from-minibuffer "full-text (f) or basic (b) search (default b)? "))) (browse-url (concat "http://lispdoc.com?q=" (if(string= inp "") default inp) "&search=" (if(string-equal search-type "f") "full+text+search" "basic+search")))))))
;;;; rect-mark.el ;; http://www.emacswiki.org/cgi-bin/emacs-en/RectangleMark (global-set-key (kbd "C-x r C-SPC") 'rm-set-mark) (global-set-key (kbd "C-x r C-x") 'rm-exchange-point-and-mark) (global-set-key (kbd "C-x r C-w") 'rm-kill-region) (global-set-key (kbd "C-x r M-w") 'rm-kill-ring-save) (autoload 'rm-set-mark "rect-mark" "Set mark for rectangle." t) (autoload 'rm-exchange-point-and-mark "rect-mark" "Exchange point and mark for rectangle." t) (autoload 'rm-kill-region "rect-mark" "Kill a rectangular region and save it in the kill ring." t) (autoload 'rm-kill-ring-save "rect-mark" "Copy a rectangular region to the kill ring." t)
;;;; snippet.el ;; 이정도만 알아두면 쓰는데 지장없다. ;; $${blahblah} blahblah 기본값가진 필드 ;; blahblah$> blahblah 입력후 인덴트 ;; $. 커서위치 ;; \n newline ;; 보기 흉해서 뉴라인을 모두 \n 으로 적어뒀으니 수정할 일이 있으면 \n ;; 을 뉴라인으로 바꿔서 수정후 다시 \n 으로 바꿔주자. (require 'snippet) (defuninstall-c++-snippet() (abbrev-mode 1) (snippet-with-abbrev-table 'c++-mode-abbrev-table ("classx" . "class $${class}$>\n{$>\npublic:$>\n$${class}();$>\n~$${class}();$>\nprivate:$>\n$${class}(const $${class}& _);$>\n$${class}& operator=(const $${class}& _);$>\n};\n") ("doxx" . "/**$>\n* \\brief $${brief}$>\n*$>\n* $.$>\n*/$>") )) (add-hook 'c++-mode-hook 'install-c++-snippet)
;;;; ebrowse
;; ebrowse-build.bat ;; {{{ ;; @echo off ;; set find=c:/bin/find.exe ;; set tr=c:/bin/tr.exe ;; set ebrowse=c:/"Program Files"/Emacs/emacs/bin/ebrowse.exe
;; set srcdir=%1 ;; set list1=%srcdir%/.ebrowse.filelist.1 ;; set list2=%srcdir%/.ebrowse.filelist.2 ;; set brdat=%srcdir%/BROWSE
;;;; anything ;;; 이거 정말 다양하게 응용이 가능할듯. (require 'anything-config) (global-set-key (kbd "ESC ESC aa") 'anything)
;;;; Per-Directory Local Variables 하고 anything 을 이용해서 프로젝트 관리 ;;; define-project-bindings, set-directory-project 로 적절히 프로젝트를 ;;; 세팅해 두면 그걸 anything 이 읽어서 dired 를 띄울수 있도록 해줬다. (defunyoonkn-projects-candidates() (reverse ; reverse 안해주면 set-directory-project 역순으로 나온다 (mapcar #'(lambda(x) (symbol-name (cdr x))) project-directory-alist)))
;;;; c-eldoc-mode ;;; 요즘은 C++ 보다 C 가 더 좋아져서 이놈을 깔아버렸다. ;;; c-eldoc-includes 를 세팅하면 라이브러리 함수들에도 적용이 ;;; 가능하겠지만 적용 안했다. (when unixp (load "c-eldoc") (add-hook 'c-mode-hook 'c-turn-on-eldoc-mode))
;;;; doc-mode ;;; http://nschum.de/src/emacs/doc-mode/ ;;; 자주 쓸만한 커맨드는 ;;; C-c d d : 문서 작성 ;;; C-c d n : 문서 작성중 다음 수정항목으로 ;;; C-c d t : 폴딩 토글 ;;; C-c d C-f : 버퍼 전체 폴드 ;;; C-c d C-u : 버퍼 전체 언폴드 ;; (when unixp ;; (require 'doc-mode) ;; (add-hook 'c++-mode-hook 'doc-mode) ;; (add-hook 'c-mode-hook 'doc-mode) ;; (add-hook 'java-mode-hook 'doc-mode))
;;;; mercurial ;; C-c h h 로 도움말을 읽어보자. ;; mercurial 패키지를 세가지를 섞어쓰다보니 코드가 요꼴이됐다. 언젠가 하나로 통일되면 나머진 지우자. (when win32p (load "C:/Program Files/TortoiseHg/Contrib/mercurial" t) (load "C:/Program Files/Mercurial/Contrib/mercurial" t))
;; 이거 좀 오버스런 코드인데 내 .emacs 에 condition-case 쓴적이 없길래 이걸로 적어둔다. (when unixp (condition-case nil (load-library "mercurial") (error nil))) (setq hg-outgoing-repository "default")
;;;; C-x m 을 누르면 gmail compose 창이 뜨도록 했다. (defunyoonkn-compose-mail() (interactive) (browse-url "http://mail.google.com/mail/?account_id=yoonkn%40gmail.com&view=comp&extsrc=ig")) (global-set-key (kbd "C-x m") 'yoonkn-compose-mail)
;;;; google code search ;; http://www.hoetzel.info/Hacking/emacs/codesearch.el ;; 이거 정말 편하구나 M-x codesearch 로 검색어를 넣으면 현재 모드에 맞는 언어로 검색을 해준다. (load-library "codesearch")
;;;; dired-x ;; dired-omit-files 를 쓰기 위해서.. (require 'dired-x) (defunadd-to-dired-omit-files(pattern) (setq dired-omit-files (concat dired-omit-files "\\|" pattern))) (mapc #'add-to-dired-omit-files '(;; . 으로 시작하는놈들 "\\.hg\\'" "\\.svn\\'" "\\`\\."; . 으로 시작하는놈은 걍 죄다 숨기자 ;; emacs 가 만드는 파일들 "\\`semantic.cache\\'" "\\.elc\\'" ;; 각종 태그 유틸리티들이 만드는 파일들 "\\`tags\\'" "\\`TAGS\\'" "\\`GPATH\\'" "\\`GRTAGS\\'" "\\`GSYMS\\'" "\\`GTAGS\\'" "\\`cscope.out\\'" "\\`cscope.files\\'" "\\`cscope.index\\'" ;; 몇몇 언어들이 만드는 중간파일들 (c/c++ 은 out of source build 를 하니 제외) "\\.fas\\'" "\\.fasl\\'" "\\.pyc\\'" "\\.pyo\\'" "\\.beam\\'" )) (add-hook 'dired-mode-hook '(lambda()(dired-omit-mode 1))); 단축키는 M-o
;;;; rectangle ;;; * M-x delete-rectangle 직사각형 영역을 지운다. ;;; * M-x kill-rectangle 위의 명령과 비슷하다. 그러나, 지워지는 내용을 "last killed rectangle" 로 저장한다. ;;; * M-x yank-rectangle ``last killed rectangle''을 그것의 위 왼쪽 끝이 포인트 위치에 오도록 삽입한다. ;;; * M-x open-rectangle 직사각형영역을 빈 공간으로 채운다. 원래의 내용은 직사각형 영역 오른쪽으로 밀려난다. ;;; * M-x clear-rectangle 직사각형영역의 내용을 없에고 스페이스를 채운다. ;;; * M-x string-insert-rectangle 스트링 추가 ;;; C-x r k 킬 ;;; C-x r d 딜리트 ;;; C-x r y yank ;;; C-x r o 빈공간 추가 (global-set-key (kbd "C-x r RET") 'string-insert-rectangle); 자주 쓸만한 놈이니 바인딩 해놓는다. C-x r i 를 하고 싶었는데 이미 쓰이길래 우선 엔터로.
;;;; smerge-mode ;; 이런것도 있구나. 현재 작업환경상 머지를 할일이 별로 없어서 당장 ;; 이모드를 사용할 생각은 없는데 아래 코드는 여러가지로 응용이 가능할듯 ;; 하다. find-file-hook 에 적당한 함수를 집어넣고 모드를 ;; 제어하는것.. 언젠가 쓸날이 올것같다. ;; (defun sm-try-smerge () ;; (save-excursion ;; (goto-char (point-min)) ;; (when (re-search-forward "^<<<<<<< " nil t) ;; (smerge-mode 1)))) ;; (add-hook 'find-file-hook 'sm-try-smerge t)
;;;; etags-select ;; 이거 희한하네. 태그를 찾으면 그 태그위치로 가는게 아니고 해당 ;; 파일에서 그 태그와 같은 단어가 나오는 첫번째 위치로 간다. 설마 이거 ;; 의도한건가? 어쨌건 난 못쓰겠다. ;; ;; (require 'etags-select) ;; (global-set-key "\M-." 'etags-select-find-tag)
;;;; 정규식 ;; http://www.emacswiki.org/emacs/RegularExpression ;; 를 참고하자. 헷갈리는걸 적어둘까 ;; \\`README\\' \` 와 \' 의 사용을 봐두자 ;; \\.org\\' \. 을 봐두자 ;; ;; http://www.emacswiki.org/emacs/ReplaceRegexp ;; 치환을 할때는 위링크 참고 ;; (\.*\) 로.. \( 와 \) 로 묶어서 그룹을 만들고 이 그룹을 \1 또는 \2 ;; 식으로 지칭할수 있다는정도만 머리에 넣어두자.
접어두기..
흠. 그나저나 예전에는 여러가지로 불편해서 남들 elisp 도 뒤져보고 내가 직접 만들어보는 삽질도 하고 했는데 요즘은 그야말로 불편한게 없어서 더이상 발전이 없네. 오랜만에 emacswiki 좀 구경가야겠다... 음 내일.. ㅎㅎ
aliasenscript='/opt/local/bin/enscript' manenscript enscript--help enscript--list-media enscript--help-highlight|less enscript--help-pretty-print|less # list available fonts for man enscript cat-n/usr/share/enscript/font.map manpstopdf# cf. http://codesnippets.joyent.com/posts/show/1601
; vim o 키 흉내내기 ; 함수 선언 후 키 맵핑
(defun my-insert-line ()
"Insert blank line below the cursor."
(interactive)
(end-of-line)
(newline-and-indent))
(global-set-key "\M-o" 'my-insert-line);M-o 는 원래 face바꾸기 임
모드 활성화 시키기(.emacs에 추가)
;; hideshow for programming
(load-library "hideshow")
(add-hook 'c-mode-hook 'hs-minor-mode)
(add-hook 'c++-mode-hook 'hs-minor-mode)
(add-hook 'emacs-lisp-mode-hook 'hs-minor-mode)
;(add-hook 'java-mode-hook 'hs-minor-mode)
;(add-hook 'perl-mode-hook 'hs-minor-mode)
; hide상태에서 goto-line했을 때 자동으로 show로 변경
(defadvice goto-line (after expand-after-goto-line
activate compile)
"hideshow-expand affected block when using goto-line in a collapsed buffer"
(save-excursion
(hs-show-block)))
기본 키
For Emacs 20:
* C-c S show all
* C-c H hide all
* C-c s show block
* C-c h hide block
For Emacs 21(이후버전):
* C-c @ ESC C-s show all
* C-c @ ESC C-h hide all
* C-c @ C-s show block
* C-c @ C-h hide block
* C-c @ C-c toggle hide/show
키 복잡하니까
'hs-hide-all
'hs-hide-block
'hs-show-all
'hs-show-block
맵 핑해서 쓸 것.
ex.>
(global-set-key (kbd "ESC <f5>") 'hs-toggle-hiding)
(global-set-key (kbd "ESC <f6>") 'hs-show-all)
(global-set-key (kbd "ESC <f7>") 'hs-hide-all)
Cscope on Win32 http://iamphet.nm.ru/cscope/
윈도우즈용으로 컴파일 된 cscope-16.0a-win32.7static.zip 다운
전역에서 쓸 수 있도록 PATH 처리된 디렉터리에 압축 해제(emacs설치 디렉터리/emacs/bin/)
혹은 아무 폴더에 압축해제후 시스템 환경변수의 PATH에 경로추가
윈도우용 find유틸 설치
GNU Win32 http://gnuwin32.sourceforge.net/
에서 find 다운
설치 후 시스템 환경변수 PATH에 경로 추가
Windows\system32 \find.exe와 겹치므로 GNU Win32 find.exe의 이름을 바꿔서 쓰거나
시스템 변수의 PATH 맨 앞에 추가 할 것
예> C:\Program Files\GnuWin32\bin;%SystemRoot%\system32;……
;emacs 외부에서 파일 변경시 현재 버퍼 자동으로 다시 읽게 하기
.emacs에 다음 내용 추가
(global-auto-revert-mode 1)
무 슨 말?
예를들어, test.txt 라는 파일을 emacs에서도 열고 메모장(notepad)에서도 열었다.
그런데 메모장에서 test.txt를 수정한 후 저장하면 emacs에서 자동으로 test.txt를 다시 읽는다.
그 외...
일회용으로 적용할려면
M-x auto-revert-mode RET
수동으로 버퍼 갱신할려면
M-x revert-buffer RET
참고 emacs 매뉴얼 항목 14.4 Reverting a Buffer
그외 참고해서 추가 할것...
14.5.1 Auto-Save Files
14.5.2 Controlling Auto-Saving
14.5.3 Recovering Data from Auto-Saves
이탈리아에서 개발된 생각으로 움직이는 휠체어KISTI 『글로벌동향브리핑(GTB)』 2009-03-09
이 탈리아 연구팀이 컴퓨터로 보내진 정신적 신호에 복종하는 휠체어를 개발했다고 2009년 3월 6일 발표했다.
이탈리아 밀라노 공대(Milan`s Polytechnical Institute)의 인공지능 및 로봇연구실(artificial intelligence and robotics laboratory)은 이 시스템을 개발하는 데 3년이 걸렸다고 마테오 마테우치(Matteo Matteucci) 교수가 전했다.
사용자는 자신의 두피 상에 설치된 전극으로 컴퓨터와 연결되며, 스크린 상에 표시된 부엌, 침실, 화장실 등과 같은 원하는 목적지의 명칭을 수초 동안 집중함으로써 신호를 보낸다. 다음으로 컴퓨터는 미리 설정된 프로그램을 사용하는 선택된 목적지로 휠체어를 인도한다.
이러한 시스템은 마음을 읽는 것이 아니라, 보내지는 뇌 신호를 읽는 것이다. 휠체어는 장애물을 탐지할 수 있는 2개의 레이저 빔을 갖추었다.
연 구팀은 사지마비 환자를 목표로 하여 상업적 시제품을 생산할 수 있는 회사들과 이미 접촉했으며, 상업화에는 5~10년이 소요될 것이라고 마테오 마테우치 교수가 말했다. 연구팀에 따르면 이러한 휠체어는 전형적 동력 휠체어와 비교하여 비용이 단지 10%정도에 불과할 것이다.
소위 두뇌 컴퓨터 인터페이스(Brain Computer Interface)를 개발하기 위한 연구는 전세계에서 1980년대 초에 시작됐다. 스위스 로잔(Lausanne)에 위치한 공업기술학교(Federal Polytechnic School)를 포함하여 다른 여러 연구자들이 유사한 프로젝트에 종사하고 있다.
결국, 최선의 방법을 찾기 위한 기초로서 이러한 모든 프로젝트를 이용할 수 있는 연구 컨소시엄이 만들어져야 한다고 마테오 마테우치 교수는 주장했다.
마 테오 마테우치 교수 연구팀은 이제 막 GPS(위성위치확인시스템)를 사용하여 야외에서 동작하는 휠체어를 개발하는 연구를 시작했다.
Mac Central: Your place for good, concise, Mac related hints.
Mac Keyboard Shortcuts
I like to figure out the fastest way to do things. I hope these shortcuts will help you become the power user that lies within. These keystrokes should work on Mac OS10.6 Snow Leopard and 10.5 Leopard (many also work on 10.4 Tiger). I add new shortcuts as I find them, so check back!
Please note that Cmd is short for the Command key (otherwise called the Apple key).
Guide to the Mac’s Menu Symbols
Symbol
Key on Keyboard
Symbol
Key on Keyboard
Command/Apple key (like Control on a PC)
Delete
Option (like Alt on a PC)
Escape
Shift
Page Up
Control (Control-click = Right-click)
Page Down
Tab
Home
Return
End
Enter (on Number Pad)
Arrow Keys
Finder Shortcuts
Action
Keystroke
Open Sidebar item in a new window
Cmd-Click it
Switch Finder views (Icon, List, Column, Cover Flow)
Cmd-1, Cmd-2, Cmd-3, Cmd-4
In List view, expand a folder
Right Arrow
In List view, collapse a folder
Left Arrow
Rename the selected file/folder
Press Return (or Enter)
Go into selected folder or open the selected file
Cmd-Down Arrow
Go to parent folder
Cmd-Up Arrow
Go Back
Cmd-[ (that’s left square bracket)
Go Forward
Cmd-] (that’s right square bracket)
Select the next icon in Icon and List views
Tab (Shift-Tab reverses direction)
Alternate columns in Column View
Tab (Shift-Tab reverses direction)
Instantly show long file name (for names condensed with a “...”)
Hold Option while mousing over long filenames
Resize current column to fit the longest file name
Double-Click column resize widget
Resize all columns to fit their longest file names
Option Double-Click resize widget
Copy and Paste files
Cmd-C, then Cmd-V
Move a file instead of copying. (Copies the file to the destination and removes it from the original disk.)
Cmd-Drag file to disk
Move selected files to the Trash
Cmd-Delete
Empty the Trash (with warning)
Cmd-Shift-Delete
Empty the Trash (without warning)
Cmd-Opt-Shift-Delete
Cancel a drag-n-drop action while in the midst of dragging
Esc
Show Inspector (a single, live refreshing Info window)
Cmd-Opt-I
Undo the last action (such as rename file, copy file, etc.)
Cmd-Z
Hide/Show Sidebar (on the left)
Cmd-Opt-T
Move or Remove item in toolbar (at the top of the window).
This works in most programs.
Cmd-drag
Open Quick Look (Mac OS 10.5)
With file selected, tap Spacebar (or Cmd-Y)
Zoom In/Out on a Quick Look Preview
Cmd-Plus(+) or Cmd-Minus(-)
Find by File Name (Mac OS 10.5)
Cmd-Shift-F
Application Switcher
Action
Keystroke
Quickly switch between 2 programs
(such as: InDesign & Photoshop)
Press Cmd-Tab to switch to the last used program.
Press Cmd-Tab again to switch back.
NOTE: Press keys quickly and do NOT hold them down.
Switch between programs (but you choose which program to switch to)
Press Cmd-Tab and continue holding Cmd.
While holding Cmd, to choose which program you want to switch to you can:
• press Tab (several times if needed) to scroll right
• press Shift-Tab or tilde(~) to scroll left
• use the left/right arrow keys
• aim with the mouse
• use end/home keys to just to first/last item
Quit a program using the application switcher
When in the app switcher you’re already holding Cmd.
Once the program is selected hit Q to quit.
Hide a program using the application switcher
When in the app switcher you’re already holding Cmd.
Once the program is selected hit H to hide.
Cancel out of the application switcher once it’s open
When in the app switcher you're already holding Cmd.
Hit Esc or period(.)
Dock Shortcuts
Action
Keystroke
Hide all other applications (except the one you're clicking on)
Command-Option click an App’s icon in Dock
Reveal a Dock item’s location in the Finder
Command Click on the icon in the Dock
Move and a Dock item to somewhere else on the hard drive
Command Drag the icon from the Dock to new destination
Force a file to open in a specific program
While dragging the file onto an app’s icon in the Dock, hold Command-Option
When in an app’s Dock menu, change the Quit to Force Quit
Hold Option while in Dock menu
Force the Dock to only resize to non-interpolated icon sizes
Hold Option while dragging Dock separator
Move Dock to left, bottom, right side of screen
Hold Shift and drag Dock divider
Temporarily turn magnification on (or off) It’s a toggle.
Hold Control-Shift (Mac OS 10.5 and later)
Working with Windows
Action
Keystroke
Switch windows (works in most programs)
Next window: Cmd-tilde(~)
Previous Window: Cmd-Shift-tilde(~)
See where the File/Folder is located (a menu will pop-up displaying the folder hierarchy). This works in “most” programs as well as the Finder.
Cmd-Click on name of the window in its titlebar
Move a window in the background without switching to it.
(Example: You’re in a dialog and can’t move a window in the background, so Cmd-Drag its titlebar.)
Cmd-Drag on a window’s titlebar
Taking Screenshots
Action
Keystroke
Take picture of the entire screen
Cmd-Shift-3
Take picture of a selected area
Cmd-Shift-4 and Drag over desired area
New in Mac OS 10.5: While dragging:
- Hold Spacebar to move selected area.
- Hold Shift to change size in one direction only (horizontal or vertical)
- Hold Option for center-based resizing.
Take picture of a specific window/object
Cmd-Shift-4, then press Spacebar, then Click on the window/object
Copy the screenshot to the clipboard instead of making a file
Hold Control with the above keystrokes
Screenshots are saved to the Desktop as PNG file in OS 10.4 and later (or a PDF file in OS 10.3 and prior).
Startup Commands
Action
Keystroke
Eject CD on boot
Hold Mouse button down immediately after powering on
OS X Safe boot
Hold Shift during startup
Start up in FireWire Target Disk mode
Hold T during startup
Startup from a CD
Hold C during startup
Bypass primary startup volume and seek a different startup volume (CD, etc.)
Hold Cmd-Opt-Shift-Delete during startup
Choose Startup disk before booting
Hold Option during startup
Start up in Verbose mode
Hold Cmd-V during startup
Start up in Single-User mode (command line)
Hold Cmd-S during startup
Force OS X startup
Hold X during startup
Shutdown/Sleep Commands
Action
Keystroke
Shutdown immediately (no confirmation)
Cmd-Opt-Ctrl-Eject
Sleep immediately (no confirmation)
Cmd-Opt-Eject
Restart, Sleep, Shutdown dialog (like hitting the Power button on old Mac keyboards)
Ctrl-Eject
Put display to sleep
Ctrl-Shift-Eject
Dashboard
Action
Keystroke
Open/Close Widget Dock
Cmd-Plus(+)
Cycle to next/previous “page” of widgets in widget dock
Cmd-Right/Left Arrow
Close a widget without having to open the widget dock
Hold Option and hover over widget (close box will appear)
Reload/Refresh a widget
Cmd-R
Spaces Mac OS 10.5 and 10.6
Action
Keystroke
Activate Spaces (birds-eye view of all spaces)
F8
Consolidate all windows into a Single Workspace
After pressing F8, press C to consolidate (press C again to restore)
Move to a neighboring space
Ctrl-arrow key (left, right, up or down)
Move to a specific space
Ctrl-number of the space (1, 2, 3, etc.)
Move all windows of an app to another space
Cmd-Drag in Space’s birds-eye view (Control and Shift also work)
Spotlight
Action
Keystroke
Open Spotlight Menu
Cmd-Space
Open Spotlight Window
Cmd-Option-Space
In Spotlight menu: Launch Top Hit
Return (In Mac OS 10.4 it’s Cmd-Return)
Reveal the selected item in the Finder
In Spotlight Menu: Cmd-click item or press Cmd-Return
In Spotlight Window: Press Cmd-R
Skip to first result in each category
Cmd up/down arrow
Clear Spotlight’s search field
Esc clears to do another search.
Esc a second time closes the spotlight menu.
Working with Text (some only work in Cocoa apps like Safari, Mail, TextEdit, etc.)
Action
Keystroke
Go to end of line
Cmd-right arrow
Go to beginning of line
Cmd-left arrow
Go to end of all the text
Cmd-down arrow
Go to beginning of all the text
Cmd-up arrow
Go to end of current or next word
Option-right arrow
Go to beginning of current or previous word
Option-left arrow
NOTE: Add Shift to any of the above keystrokes to make a selection to that point.
On Laptops: Delete Text to the right of the cursor (like the Del key on a full keyboard)
Function(fn)-Delete
Non-touching (Discontinuous) text selections
Command-drag
Select non-linear areas
Option-drag
Delete entire word to the left
Opt-Delete
Look up word in dictionary
Position mouse over a word and hold Cmd-Ctrl-D
Auto completion word
Start typing the word. Press Esc (or F5) to open suggested word list
Emacs Key Bindings (only work in Cocoa apps like Safari, Mail, TextEdit, iChat, etc.)
Action
Keystroke
Remember As
go to start of line (puts cursor at beginning of current line)
Ctrl-A
A = Start of alphabet
go to end of line (puts cursor at end of current line)
Ctrl-E
E = End
go up one line
Ctrl-P
P = Previous
go down one line
Ctrl-N
N = Next
go back one character (moves cursor left 1 place)
Ctrl-B
B = Back
go forward one character (moves cursor right 1 place)
Ctrl-F
F = Forward
delete the character to the right of the cursor
Ctrl-D
D = Delete
delete the character to the left of the cursor
Ctrl-H
delete to end of the line (or delete the selection)
Ctrl-K
K = Kill rest of line
scroll down
Ctrl-V
center the current line in the window
Ctrl-L
insert line break after the cursor without moving the cursor
Ctrl-O
transpose letters (swaps letter on the left and right of cursor)
Ctrl-T
T = Transpose
Miscellaneous
Action
Keystroke
Force Quit (opens list so you can choose application)
Cmd-Opt-Esc
Force Quit Frontmost Application (without confirmation)
Hold Cmd-Opt-Shift-Escape for about 4 seconds
On Laptops: Scroll (like a mouse’s scroll wheel)
(Works on newer laptops if enabled in System Preferences)
Slide 2 fingers on the trackpad
On Laptops: Right-click (like on a 2 button mouse)
(Works on newer laptops if enabled in System Preferences)
Place 2 fingers on the trackpad and Click
Quickly find any menu item and launch it. (Mac OS 10.5)
1. Press Cmd-? FYI: That’s Cmd-Shift-/
2. In the Help menu Search that opens, start typing a few letters of your desired menu command.
3. Arrow key down to the item you want and press Return to choose it.
Change system volume without the confirmation beeps
Hold Shift while changing volume
Completely smooth scrolling—one pixel at a time.
(Only works in Cocoa apps.)
Hold Option while dragging scrollbar
Open System Preferences:
NOTE: These launch directly into a preference pane.
Two examples are given.
To open “Sound” Preferences:
Hold Option and press any Sound key
(Mute, Volume Up or Down )
To open “Displays” Preferences:
Hold Option and press any Brightness key
Open Front Row
Cmd-Esc
Quickly Exit Front Row
Press any F key, like F5. In 10.5 and later, non F keys also work.
Customize the toolbar at the top of a window.
Works for toolbars like in Safari, Apple Mail, Preview, Finder, etc. But it doesn't work in all programs, like Firefox.
- Rearrange icons:
Hold Cmd and drag the icons around.
- Remove icons:
Hold Cmd and drag icon off toolbar.
- View toolbar options:
Ctrl-click on the toolbar to get a menu.
Go to one of the first 9 bookmarks (not folders) in the Bookmarks Toolbar
Cmd-1 through Cmd-9
Move between found items (in Safari 3 and later)
Cmd-F, enter your search text and Press:
Return to Move Forward
Shift-Return to Move Backward
Cancel current Find
Press Escape or Cmd-Period(.)
Scroll a webpage by a screenful
Scroll Down: Spacebar or Option-Down Arrow
Scroll Up: Shift-Spacebar or Option-Up Arrow
Apple’s Mail.app
Action
Keystroke
Reply to Message
Cmd–R or
Option-Double Click Message
Go to the next/previous email in a thread even if you haven’t organized by threads
Option-Up/Down Arrow
Scroll the listing of emails at the top (not the actual contents of an email)
Ctrl-Page Up/Down
Apple’s Preview.app
Action
Keystroke
Choose the Scroll/Move tool
Cmd-1
Choose the Text tool
Cmd-2
Choose the Select tool
Cmd-3
Zoom in or out
Cmd-Plus(+) or Cmd-Minus(-)
Scroll Large Images
Hold Spacebar and drag on the image (like you do in Photoshop)
“Thanks Dan!” If you like this site, making a donation will:
Encourage Dan to keep adding useful information.
Make you (and Dan) feel warm and fuzzy inside.
Secure transactions by PayPal. No PayPal account required.
Specify the generator for this project는 Xcode, 그리고 Use default native compilers 선택합니다. Where is the source code에서 다운 받은 opencv 경로를 작성, Where to build the binaries에 원하는 경로를 작성합니다. (여 기선, source code 경로로 '/Users/bkim/opencv', binaries 경로로 '/Users/bkim/opencv/_make'로 설정하였습니다.) 경 로 설정 후, 'Configure' 버튼을 누르면, 아래와 같은 화면이 나타납니다.
붉 게 표시된 목록에서,
BUILD_NEW_PYTHON_SUPPORT = OFF ENABLE_OPENMP = ON
두 가지 옵션을 선택 후, 다시 한번 'Configure'버튼을 클릭합니다. 클릭 후 조금 기다리면 'Generate'을 누를 수있게 됩니다. 'Generate' 클릭 후 또한 조금 기다리면 성공을 알리는 메시지가 나타납니다. 최 종적으로 잘 마무리 되었는지는 설정한 binaries 경로에 OpenCV.xcodeproj이 존재하는지 확인합니다. (여 기서는, /Users/bkim/opencv/_make/)
4. Xcode 컴파일 생성된 OpenCV.xcodeproj 파일을 열면 XCode가 시작됩니다. 아래와 같이 설정 후, 컴파일(⌘B)을 합니다.
Active Configuration = Release Active Architecture = i386
5. OpenCV.framework 만들기 쉘스크립트를 통해서framework를 만들 수 있습니다.opencv를 다운 받은 경로에서 (여기서는 /Users/bkim/opencv),
$ sh make_frameworks.sh
다소 시간이 흐른 뒤, opencv 경로에 'OpenCV.framework'가 생성되며, 그것을 '/Library/Framework'로 복사합니다. framework이 잘 만들어졌는지 확인을 위해 'opecv/samples/MacOSX/FaceTracker.xcodeproj'를 실행 및 컴파일해봅니다. 향후, 본인만의 OpenCV 프로그래밍시에 Xcode 실행, 아래 그림처럼 'Add'->'Existing Frameworks' 선택, 그리고 'Opencv.Framework'이 존재하는지 확인합니다. 없다면, 'Add Other...'를 통해 '/Library/Framework'안에 존재하는 'opencv.framework'를 추가하시면 됩니다.
6. 예제 코드 컴파일하기 OpenCV에서 제공하는 예제 코드(opencv/samples/c)들을 가지고 놀기 위해서 컴파일을 해줍니다.
OpenCV (Open Source Computer Vision) is “a library of programming functions for real-time computer vision”.
It took me whole day yesterday to build OpenCV for my Snow Leopard. I still need to add the FFMPEG support but for now, it is turned off. I’ve followed the Mac OS X OpenCV Port doc.
svn co https://code.ros.org/svn/opencv/trunk opencv
cd opencv mkdir opencv/build cmake ..
ccmake .
Hit ‘t’ to toggle advanced mode. Set CMAKE_CXX_COMPILER=”/usr/bin/g++-4.0″ and CMAKE_C_COMPILER=”/usr/bin/gcc-4.0″. I also need to turn off FFMPEG and LIBDB1394, because I could not get them to install properly yet on Snow Leopard. Turn on the BUILD_EXAMPLE. Hit ‘c’ to configure and then ‘g’ to generate the config files and exit ccmake. make -j8 su make install To build the example, I need to change the opencv/sample/c/build_all.sh to the following: (change gcc to gcc-4.0 and g++ to g++-4.0, and also add “-arch i386″)