'OSX'에 해당되는 글 38건

  1. 2011.08.04 Compile issues of PCL 1.1.0 (with VTK+X11) on OSX 3
  2. 2011.07.25 [Shell programming] copy files that are interested in
  3. 2011.06.30 svn server on OSX
  4. 2011.06.20 SYNTAX EXAMPLES FOR R STATISTICAL PROGRAM
  5. 2011.06.20 R in Emacs
  6. 2011.06.20 GCC 4.6 on OSX 8
  7. 2011.05.26 Latex on OSX 에서 맑은 고딕 쓰기 1
  8. 2011.05.18 CEDET/ECB for Aquamacs 5
  9. 2010.06.10 .emacs
  10. 2010.06.06 Mac Keyboard Shortcuts

Compile issues of PCL 1.1.0 (with VTK+X11) on OSX

OSX 2011. 8. 4. 14:10

sudo ./bootstrap.sh --prefix=/usr/local/boost_1_42_0

bjam toolset=darwin variant=release threading=multi link=static

bjam toolset=darwin variant=release threading=multi link=shared

sudo bjam install

1. Download and install all dependencies: http://pointclouds.org/downloads/macosx.html

  • boost 1.46.1 (MacPorts)
  • Eigen 3.0.0
  • FLANN 1.6.8
  • CMinPack 1.1.3
  • QHull 2010.1.3 (MacPorts)
  • OpenNI
    • LibUSB (MacPorts)
    • OpenNI 1.1.0.41 (patched) Note: This is a command-line install and permissions need to be fixed before running ./install
    • Sensor 5.0.1.32 (patched) Note: This is a command-line install and permissions need to be fixed before running ./install
      Otherwise the libraries can't be loaded and you get the following error:
      $ /usr/local/bin/octree_viewer
      dyld: Library not loaded: ../../Bin/Release/libOpenNI.dylib
      Referenced from: /usr/local/bin/octree_viewer
      Reason: no suitable image found.  Did find:
      /usr/lib/libOpenNI.dylib: open() failed with errno=13
      Trace/BPT trap
      
  • wxgtk (MacPorts)
    $ sudo port install wxgtk
    

2. Download VTK source, compile and install it: http://www.vtk.org/VTK/resources/software.html

Follow README.html for compiling on UNIX / Cygwin / Mac OSX:

$ ls -d VTK
VTK/
$ mkdir VTK-build
$ cd VTK-build
$ ccmake ../VTK

Within the CMake configuration:

------------------------------------------------------------

CMAKE options;
OPENGL_INCLUDE_DIR = /usr/X11R6/include
OPENGL_gl_LIBRARY = -L/usr/X11/lib/ -lGL
OPENGL_glu_LIBRARY = -L/usr/X11/lib/ -lGLU
OPENGL_xmesa_INCLUDE_DIR = /usr/X11R6/include
CMAKE_OSX_ARCHITECTURES:STRING = i386;x86_64
VTK_USE_CARBON = OFF
VTK_USE_COCOA = OFF
VTK_USE_X = ON

------------------------------------------------------------

3. Configure PCL (compiled with gcc-4.2.1/g++-4.2.1)

Within the CMake configuration:

VTK_DIR:/usr/local/lib/vtk-5.6
wxWidgets_CONFIG_EXECUTABLE:/opt/local/bin/wx-config
wxWidgets_wxrc_EXECUTABLE:/opt/local/bin/wxrc
OPENNI_INCLUDE_DIR = /usr/include/ni/
CMAKE_CXX_LFAGS = -I/usr/include/ni/
CMAKE_C_LFAGS = -I/usr/include/ni/

:

[Shell programming] copy files that are interested in

OSX 2011. 7. 25. 13:53

#!/bin/sh

path="rgbd_data"

cd ~/data
# pwd ~/data

for str in "ball" "food_box"
do
	for index in $(ls ./rgbd_data/$str/)
	do
		mkdir $str/$index
		cp ./rgbd_data/$str/$index/$index\_1_[1-9]_*.png ./$str/$index/
	done
done

:

svn server on OSX

OSX 2011. 6. 30. 17:46

1. Snowleopard includes apache

- just run

sudo apachectl start

2. Make a repository

mkdir /Users/username/svn    
cd /Users/username/svn
svnadmin create svnfolder
sudo chown -R bong:www /Users/username/svn/*
chmod -R g+w svnfolder/


3. Make a conf file
sudo emacs /etc/apache2/other/svn.conf
-- svn.conf --    
LoadModule dav_svn_module /usr/libexec/apache2/mod_dav_svn.so
   <Location /svn>    DAV svn    SVNParentPath /Users/crazia/svn
   AuthType Basic    AuthName "Subversion repository"    AuthUserFile /etc/apache2/svn-auth-file    Require valid-user
   </Location>

4. create svn account
sudo htpasswd -cm /etc/apache2/svn-auth-file username

5. restart apache

sudo apachectl restart

6. import ur directory into ur repository

:

SYNTAX EXAMPLES FOR R STATISTICAL PROGRAM

OSX 2011. 6. 20. 16:42
:

R in Emacs

OSX 2011. 6. 20. 16:24

USING 64-BIT R FROM WITHIN AQUAMACS


1) Aquamacs is terrific because it comes bundled with about everything you need to start using R with it. No need to separately download ESS (emacs speaks statistics) or mess with the .ess-lisp files. Download Aquamacs from http://aquamacs.org/ and install it.

2) Now any file with an “.R” extension that is opened with aquamacs will automatically have syntax highlighting AND will allow you to start 64-bit R. I highly recommend checking out this page, http://ess.r-project.org/, and downloading the ESS reference card therein if you are new. Emacs has a bit of a learning curve, but you’ll begin loving its capabilities as an aid to programming very soon.

3) To start 64-bit R from within aquamacs hit <Control>-u then <Alt>-x then “R” then <Return>. Aquamacs will ask you for “Starting Args”. Here’s where you tell it you want to run 64-bit R. Type “--arch=x86_64” then <Return>. A new window will open up that is the R session.

4) That’s almost it. Just one more issue: graphing will crash (something to do with the new R and X11). Aquamacs has X11 as the default (null) graphics device. To change this, type in R: “options(device=”quartz”)”. Now your null graphics device is quartz and it should all work out. If you really want to use X11 to write graphics, you can use x11(type="Xlib")' for each new graph. What I do is to set “options(device=”quartz”) within my Rprofile.site file.


USING EMACS TO LOG IN TO A REMOTE SERVER & RUN R INTERACTIVELY

It can be very helpful to run an interactive session of R on a remote server, which may have faster CPUs and more memory than the computer you’re on, or may have datasets on it you don’t have access to otherwise. This is simple to do using aquamacs. Here’ how:

1) Open up your *.R script you’d like to use

2) Open a shell inside Emacs by typing “M-x shell”

3) From within this shell, ssh to the server you want to use. When doing this, you need to make sure to specify two important ssh options: compression (which compress data coming to you, making the connection seem *much* faster) and X11 forwarding (which allows you to use interactive graphing features via X11). E.g.:
ssh -XC username@servername.colorado.edu

4) You should now be logged into the server, just as you wold be if you’d used terminal rather than emacs. Now open up R as you usually would on that server. E.g.:
R --arch=x86_64

5) You should be in R now. To allow this R session to be linked to your *.R script, use this command in the remote R session:
M-x ess-remote
In the Emacs mini-buffer prompt, type:
r

6) Now you should be able to send code from your *.R script to the remote R session as you normally would (e.g., C-c C-j).

7) Last, you need to change the options in your remote R session to graph using X11 rather than whatever default driver is being used. To do this in R, type:
options(device=’x11’)

8) That’s it. Make sure it all works by typing something like:
hist(rnorm(50)) #which should return a histogram of rnorm to your screen!

NEW PACKAGES

$ which R
/usr/bin/R

Install the package:

$ sudo R CMD INSTALL plotrix_2.6-1.tgz
Password:
* Installing to library '/Library/Frameworks/R.framework/Resources/library'
* Installing *binary* package 'plotrix' ...
* DONE (plotrix)

Check that everything is happy:

$ ls -l /Library/Frameworks/R.framework/Resources/library/


BASIC COMMANDS

Basic ESS commands to get started using R/S-Plus under Emacs ( C-c means press the Ctrl key down and then enter c. )

  • Esc-p Previous Command (at command line)
  • Esc-n Next Command (at command line)
  • C-c C-v Get help on R/S object (enter name in
  • C-c C-d Dump object or function to a Emacs buffer for editing
  • C-c C-l Load file from buffer into R
  • C-c C-f submit a Function in current buffer to R
  • C-c C-j submit the current line in buffer to R
  • C-c C-r submit the highlignted or marked region to R
  • C-c TAB complete object/file name
  • C-h m for help on ESS mode
  • More help is available under the iESS menu in emacs:
    • about (Emacs Info system for on-line help for ESS)
    • describe (for Control/Escape sequences and definitions for ESS)


:

GCC 4.6 on OSX

OSX 2011. 6. 20. 16:20

Building GCC [4.6] on MacOSX

The objective here is describe a didactic way to build GNU GCC on MacOSX. In order to compile GCC you need three libraries: GMP, MPFR and MPC. To organize I usually create folders for each purpose. In this case, three, respectively: source, build and install. [It's not a rule]. My original enviroment is MacOSX 10.6.4 and gcc version 4.2.1 (Apple Inc. build 5659). All files will be on GCC folder, the description below shows:


$ mkdir ~/Downloads/GCC/ # gmp, mpfr and mpc
$ mkdir ~/gcc46_64 # store libs objects and include

Step #1 – Download

$ wget ftp://ftp.gmplib.org/pub/gmp-5.0.1/gmp-5.0.1.tar.bz2
$ wget  http://www.mpfr.org/mpfr-3.0.0/mpfr-3.0.0.tar.bz2
$ wget http://www.multiprecision.org/mpc/download/mpc-0.8.2.tar.gz

Step #2 – Unpack


Step #3 – Build: GMP

$ mkdir gmp-build
$ cd gmp-build
$ ../gmp-5.0.1/configure --prefix=$HOME/gcc46_64
$ make install

Note 1: I’m using with ABI=64
Note 2 : Maybe you’ll get some unresolved symbols to GMP and MPFR on linking time, never mind.

Step #4 – Build: MPFR

$ cd ..
$ mkdir mpfr-build  
$ cd mpfr-build
$ ../mpfr-3.0.0/configure --prefix=$HOME/gcc46_64 --with-gmp=$HOME/gcc46_64
$ make install

Step #5 – Build: MPC

$ cd ..

$ mkdir mpc-build
$ cd mpc-build
$ ../mpc-0.8.2/configure --prefix=$HOME/gcc46_64 --with-gmp=$HOME/gcc46_64 --with-mpfr=$HOME/gcc46_64
$ make install

Problems? If something goes wrong…

../../mpc-0.8.2/src/mpc.h:25:17: error: gmp.h: No such file or directory
../../mpc-0.8.2/src/mpc.h:26:18: error: mpfr.h: No such file or directory

I fixed by adding symbolic links:

$ cd ~/Projects/GCC/libs/mpc-0.8.2/src/
$ ln -s ../../install/include/mpf2mpfr.h .
$ ln -s ../../install/include/mpfr.h .
$ ln -s ../../install/include/gmp.h .

Step #6 – Download & Build GCC (~4.6)

I used GCC from git (fda0037801fb258a2191aba59e1e9f0df019e3b6) and I don’t know if it will work on newer versions. You’ll have to try. Sorry. [Howto: GitMirror]. Use git checkout to specify one commit.

$ cd ~/Downloads/GCC/gcc-4.6.0
$ mkdir build
$ cd build
$ ../configure --prefix=$HOME/gcc46_64 --with-gmp=$HOME/gcc46_64 --with-mpfr=$HOME/gcc46_64 --with-mpc=$HOME/gcc46_64 --disable-checking --enable-languages=c --program-prefix=my- --enable-languages=c,c++,fortran

$ make
$ make install




:

Latex on OSX 에서 맑은 고딕 쓰기

OSX 2011. 5. 26. 19:26

LaTex에서 한글을 쓸 수 있도록 하는 ko.tex은 기본적으로 은글꼴을 지원한다. 그런데 만약 은글꼴 이외의 한글 폰트를 사용하고 싶을 경우 아래와 같은 방법으로 임의의 한글 트루타입 폰트로부터 tfm(Tex font metric)을 추출하고 설정을 해주면 된다.

우선 kotex이 당연히 깔려있어야 하고 다음과 같이 font.conf 라는 파일을 만든다.


FOUNDRY: b
FONTmj: m=m=malgun.ttf b=malgunbd.ttf

FOUNDRY: b의 b는 새로 생기는 폰트명의 제일 앞에 붙는다.
둘째줄의 의미는 m=malgun.ttf 라는 폰트를 bmg라는 이름으로 만들겠다는 것인데 FONTmj의 mj는 명조체를 의미하는 것으로 f=bnewname을 지정해주지 않으면 자동으로 mj가 폰트 이름이 된다. mj가 포함된 이 첫 줄은 꼭 있어야하고 폰트 이름을 mj가 아닌 다른 것으로 정하고 싶다면 f=name하고 따로 지정해주면 된다. 폰트 파일이 기본모양 뿐 아니라 볼드체 파일도 있다면 첫 줄 제일 뒤에 b=malgunbd.ttf하고 추가해준다.

그래서 이 파일과 ttf파일들을 같은 폴더에 넣고 터미널에서 다음을 입력하면,
(같은 디렉토리에 UCS2.sfd도 필요한데 Unicode.sfd를 이름바꿔서 사용하면 잘 된다)
ttf2kotexfont -c font.conf

obmj****.tfm 라는 tfm이 붙은 파일이 완전 많이 생성되고 myttf.sty, ttf2pk.cfg, ****.fd 등등의 파일이 생긴다. myttf.sty은 tex 문서 내에서 새로 만든 이 폰트들을 사용을 지정하기 위한 파일이고 ttf2pk.cfg는 (아마도) tex문서 내에서 지정한 폰트 사이즈에 맞는 ****pk파일들을 만들어내기 위한 파일, ****.fd는 새로 생긴 폰트들을 정의해주는 파일이다.

이렇게 만든 폰트를 이용하기 위해 tex문서의 앞부분에 넣어줘야 하는 명령들은 다음과 같다.

\documentclass[10pt,a4paper]{book}
\usepackage[hangul]{kotex}
\usepackage{myttf}
\SetHangulFonts{bmj}{utgt}{uttz} % 한글 기본폰트 윤명조120
\begin{document}
.............

위에서 만든 *.tfm파일들과 myttf.sty 등 새로 만들어진 파일과 이 tex문서는 같은 디렉토리 안에 있어야 하고 \SetHangulFonts에서 한글 기본폰트로 맑은고딕을 설정하였다.
\SetHangulFonts가 필요로 하는 인자는 \SetHangulFonts{명조폰트}{고딕폰트}{타자폰트}인데 이 폰트에 대해서 고딕체과 타자체에 대응하는 폰트가 따로 없으므로 그것들은 그냥 은글꼴을 사용한다는 의미에서 {utgt}{uttz}를 써준것이다.

이렇게 문서를 만들고 컴파일을 하면 ******pk 가 붙은 파일들이 또 마구마구 만들어지면서 원하는 한글 폰트가 들어간 문서가 만들어진다.


http://afnastica.tistory.com/336
를 참조했음
:

CEDET/ECB for Aquamacs

OSX 2011. 5. 18. 17:18

http://docwhat.org/2010/08/cedet-ecb-for-aquamacs/

에서 퍼옴


CEDET

  1. Download the latest CEDET from sourceforge
  2. Untar the file in ~/Library/Application Support/Aquamacs Emacs:
    cd ~/Library/Application Support/Aquamacs Emacs
    tar xf ~/Downloads/cedet-1.0.tar.gz

  3. Run make:
    make EMACS=/Applications/Aquamacs.app/Contents/MacOS/Aquamacs


  4. Create a site-start.el file. This will be loaded automagically by Aquamacs. It should look like this. You should replace YOUR USERNAME with your OS X username.
    (/Applications/Aquamacs.app/Contents/Resources/lisp/aquamacs/site-start.el)

    (load-file "/Users/YOUR USERNAME/Library/Application Support/Aquamacs Emacs/cedet-1.0/common/cedet.el")
    (global-ede-mode 1) ; Enable the Project management system
    (semantic-load-enable-code-helpers) ; Enable prototype help and smart completion
    (global-srecode-minor-mode 1) ; Enable template insertion menu


  5. Now you need to pull all the .info files into a directory called info with a dir file. Aquamacs is smart enough to figure out this is plugin specific info files, and will use it.

    mkdir info
    cd info
    find .. -type f -name '*.info' | while read i; do j="$(basename $i)"; ln -s "$i" "$j"; install-info --info-dir="$(pwd)" "$j"; done


  6. Restart Aquamacs and you should have the full CEDET available, including docs.

ECB

ECB is the Emacs Code Browser. It basically turns Emacs into a full IDE like XCode.

  1. Download the latest ECB from sourceforge
  2. Untar the file in ~/Library/Application Support/Aquamacs Emacs:

    cd ~/Library/Application Support/Aquamacs Emacs
    tar xf ~/Downloads/ecb-2.40.tar.gz


  3. Create a site-start.el file to load up ECB on startup:

    (add-to-list 'load-path
    "/Users/docwhat/Library/Application Support/Aquamacs Emacs/ecb-2.40")

    ;; Choose one of the following...

    ;; If you want to load the complete ECB at (X)Emacs-loadtime
    ;; (Advantage: All ECB-options available after loading
    ;; ECB. Disadvantage: Increasing loadtime2):

    (require 'ecb)

    ;; If you want to load the ECB first after starting it by ecb-activate
    ;; (Advantage: Fast loading3. Disadvantage: ECB- and semantic-options
    ;; first available after starting ECB):

    ;(require 'ecb-autoloads)


  4. Symlink the info-help directory to info and create a dir file.

  5. ln -s info-help info
    cd info
    install-info --info-dir="$(pwd)" ecb.info

  6. Restart aquamacs and you should have ECB available, including docs.

.emacs ————————————————————————————————————————————————————

(set-language-environment “Korean”)

;; (set-terminal-coding-system 'utf-8)

;; (set-keyboard-coding-system 'utf-8)

;; (prefer-coding-system 'utf-8)

;; (set-default-coding-systems 'utf-8)

(set-terminal-coding-system 'euc-kr)

(set-keyboard-coding-system 'euc-kr)

(prefer-coding-system 'euc-kr)

(set-default-coding-systems 'euc-kr)

(set-default-font “apple-Bitstream_Vera_Sans_Mono-medium-normal-normal18-m-0-iso10646-1”)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; cedet 설정파일 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(load-file “~/Library/Application Support/Aquamacs Emacs/cedet/common/cedet.el”)

(global-ede-mode 1) ; Enable the Project management system

(semantic-load-enable-code-helpers) ; Enable prototype help and smart completion

(global-srecode-minor-mode 1) ; Enable template insertion menu

(global-set-key [(control tab)] 'senator-completion-menu-popup)

;; (global-set-key “\M-n” 'semantic-analyze-possible-completions)

;; (global-set-key “\M-n” 'semantic-complete-analyze-inline)

;; 처음 부터 . -> :: 기능을 사용하시려면 아래 “nil” 을 “t” 바꾸세요.

(defvar semantic-complete-self-insert-p t)

(defun semantic-complete-self-insert-toggle-switch ()

  (interactive)

  (if semantic-complete-self-insert-p

   (progn (setq semantic-complete-self-insert-p nil)

(message “semantic-complete-self-insert off”) )

   (progn (setq semantic-complete-self-insert-p t)

(message “semantic-complete-self-insert on”) ) ) )

(defun semantic-complete-self-insert-for-dot-operator (arg)

  (interactive “p”)

  (if semantic-complete-self-insert-p

   (call-interactively 'semantic-complete-self-insert)

   (self-insert-command arg) ) )

(defun semantic-complete-self-insert-for-arrow-operator (arg)

  (interactive “p”)

  (if (and semantic-complete-self-insert-p

(string= “-” (char-to-string (char-before (point)) ) ) )

   (call-interactively 'semantic-complete-self-insert)

   (self-insert-command arg) ) )

(defun semantic-complete-self-insert-for-scope-operator (arg)

  (interactive “p”)

  (if (and semantic-complete-self-insert-p

(string= “:” (char-to-string (char-before (point)) ) ) )

   (call-interactively 'semantic-complete-self-insert)

   (self-insert-command arg) ) )

(defun c++-mode-additional-semantic-keys ()

  “Key bindings to add to `c++-mode'.”

  (define-key c++-mode-map [(control c)(control .)] 'semantic-complete-self-insert-toggle-switch)

  (define-key c++-mode-map “.” 'semantic-complete-self-insert-for-dot-operator)

  (define-key c++-mode-map “>” 'semantic-complete-self-insert-for-arrow-operator)

  (define-key c++-mode-map “:” 'semantic-complete-self-insert-for-scope-operator)

  )

(add-hook 'c++-mode-hook 'c++-mode-additional-semantic-keys)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ECB 설정파일 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(add-to-list 'load-path “~/Library/Application Support/Aquamacs Emacs/ecb-2.40”)

;; Choose one of the following…

;; If you want to load the complete ECB at (X)Emacs-loadtime

;; (Advantage: All ECB-options available after loading

;; ECB. Disadvantage: Increasing loadtime2):

(require 'ecb)

;; If you want to load the ECB first after starting it by ecb-activate

;; (Advantage: Fast loading3. Disadvantage: ECB- and semantic-options

;; first available after starting ECB):

;(require 'ecb-autoloads)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(require 'ido)

(ido-mode t)

(global-auto-revert-mode 1)

(require 'color-theme)

(color-theme-initialize)

(color-theme-arjen)

(add-to-list 'default-frame-alist '(alpha . (95 88)))

:

.emacs

OSX 2010. 6. 10. 16:21

   윈도우용 Emacs 설정

이 문서는 윈도우용 Emacs의 설정에 관한 내용을 요약 한 것이다.


고친 과정
최초 작성 2007-04-30 작성자 kei

1. 설정 기본

emacs의 설정 파일은 .emacs 이고 계정 루트에 있다.

(XP - C:\Documents and Settings\사용자명\Application Data)

EmacsW32 설치시 위의 디렉터리에 .emacs.d 디렉터리 추가됨

설정파일 안에서 세미콜론(;)은 주석 표시이다.


2. 실행시 창 크기/위치 설정

; 창 사이즈
; emacs -g 80x40 or
(set-frame-width (selected-frame) 90)
(set-frame-height (selected-frame) 50)

; 창 생성 위치
(set-frame-position (selected-frame) 10 10)


3. 들여쓰기

;C 들여쓰기 기본 스타일 설정
(setq c-default-style "k&r")
; (setq c-default-style "cc-mode")
; (setq c-default-style "gnu")
; (setq c-default-style "bsd")
; (setq c-default-style "stroustrup")
; (setq c-default-style "whitesmith")

; 엔터 입력시 자동 들여쓰기 다른 방법
(load "cc-mode")
(define-key c++-mode-map "\r" 'reindent-then-newline-and-indent)
(define-key c-mode-map "\r" 'reindent-then-newline-and-indent)
(define-key java-mode-map "\r" 'reindent-then-newline-and-indent)

; 엔터 입력시 자동 들여쓰기 다른 방법
;(require 'cc-mode)
;(define-key c-mode-base-map (kbd "RET") 'newline-and-indent)

; { , ; 입력시 자동 줄 추가
;(add-hook 'c-mode-common-hook '(lambda () (c-toggle-auto-state 1)))


4. 탭 설정

;emacs tab 설정
(setq c-basic-offset 4
tab-width 4
indent-tabs-mode t)
;(add-hook 'c-mode-common-hook '(lambda () (c-toggle-auto-state 1)))

; 탭 대신 공백 넣기
(setq-default indent-tabs-mode nil)

; c-toggle-auto-state 기능에 backspace입력시 모든 공백(줄 바꿈 포함) 삭제
;(add-hook 'c-mode-common-hook '(lambda () (c-toggle-auto-hungry-state 1)))


5. 키 설정

GOTO LINE 키 설정

22버전은 M-g M-g 혹은 M-g g 로 설정되어 있음

; 라인 바로가기
(global-set-key "\M-g" 'goto-line)


6. 단어 자동완성

단어 자동 완성

M-x dynamic-completion-mode

;최근 사용된 word list를 가지고, 자동 완성구현, 3글자 이후에M-RET
(dynamic-completion-mode)


※ 참고
dynamic-completion-mode
http://kltp.kldp.org/stories.php?story=03/11/16/1067964&topic=26


7. vim o 키 흉내내기

; 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바꾸기 임


8. HideShow모드 설정(Folding모드)

모드 활성화 시키기(.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)

※ 참고
http://www.emacswiki.org/cgi-bin/wiki/HideShow


9. cscope 설정

Cscope on Win32
http://iamphet.nm.ru/cscope/
윈도우즈용으로 컴파일 된 cscope-16.0a-win32.7static.zip 다운
전역에서 쓸 수 있도록 PATH 처리된 디렉터리에 압축 해제(emacs설치 디렉터리/emacs/bin/)
혹은 아무 폴더에 압축해제후 시스템 환경변수의 PATH에 경로추가

http://cscope.sourceforge.net/
에서 최신버전 다운
(압축 폴더 안의 contrib\xcscope\xcscope.el 사용하기 위해)

emacs 설치 디렉터리/emacs/site-lisp/에 xcscope.el 복사

.emacs에 다음 줄 추가
(require 'xcscope)


윈도우용 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;……

※ 참고
KLDP Wiki - Emacs Gdb Etags Cscope
http://wiki.kldp.org/wiki.php/EmacsGdbEtagsCscope


10. 라인넘버 표시하기

http://www.wonderworks.com/download/setnu.el.gz 다운.
emacs설치디렉터리/lisp/ 에 압축해제

.emacs(사용자 설정파일) 추가 아래 내용.

(load-library "setnu.el")
(add-hook 'c-mode-hook 'turn-on-setnu-mode)
(add-hook 'text-mode-hook 'turn-on-setnu-mode)
(add-hook 'c++-mode-hook 'turn-on-setnu-mode)

기타 필요한 모드 위의 방식(add-hook 'MODE.....)으로 추가

setnu-mode on/off 토글키
M-x setnu-mode RET

※ 참고
Emacs에서 vi 스타일(: set nu)의 줄 번호
http://kltp.kldp.org/stories.php?story=00/07/01/9629703&topic=26


11. Visual Studio에 emacs 등록하기

External Tools
Title : 이름
Command : C:\Program Files\Emacs\emacs\bin\runemacs.exe
(이맥스 실행파일 경로)

Arguments : +$(CurLine) $(ItemFileName)$(ItemExt)

Initial directory : $(ItemDir)


12. ECB / CEDET(미완성)

ECB
http://ecb.sourceforge.net/
CEDIT
http://cedet.sourceforge.net/



13. 상용구 설정

.abbrev_defs 파일 안에서 설정(.emacs 에서 해도 됨)

("준말" "본말" nil 0) 형태로 삽입. 준말에 특정 기호(@같은···) 및 한글은 안됨.

ex.)
(define-abbrev-table 'c++-mode-abbrev-table '(
("$l1"
"////////////////////////////////////////////////////////////////////////////////"
nil 0)
("$l2"
"//********************************************************************************"
nil 0)
("$h"
"// title :
// Author : "
nil 0)
))


14. ...

;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


※ 참고 사이트

emacs wiki
http://www.emacswiki.org/cgi-bin/wiki


EmacsKR
http://emacs.kldp.org/wiki/doku.php

kldp.org - 검색

http://kldp.org


kldp wiki - 검색

http://wiki.kldp.org/wiki.php

:

Mac Keyboard Shortcuts

OSX 2010. 6. 6. 19:50

Mac Central: Your place for good, concise, Mac related hints.

Keyboard ShortcutsMulti-Touch GesturesTips & TricksRecommended Programs

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 OS 10.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.

Safari

Action Keystroke
Switch Tabs Next Tab: Ctrl-Tab (or Cmd-Shift-Right Arrow)
Previous Tab: Ctrl-Shift-Tab (or Cmd-Shift-Left Arrow)
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)


back to top

“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.

: