.emacs.dãæ´çãã
å æ¥ãä¼ç¤¾ã§ãµã¼ãã¹ããªãªã¼ã¹ãã¦ä»äºãä¸æ®µè½ããã®ã§ããã®ã¿ã¤ãã³ã°ã§.emacs.dãä¸æ°ã«æ´çããã
æ®æ®µemacsã使ã£ã¦ãã®ã ãã©ãæ°ããæ¡å¼µå ¥ããããªã£ãæã«åç°å¢ã§å¥åã«å ¥ãã¦ãã£ãããèªå® ã¨ä¼ç¤¾ã®éçºç°å¢ã«ä¹é¢ãçã¾ãã¦ãã¦ãã ãã ãå«ã«ãªã£ã¦ããã®ã§.emacs.dãæ´çãã¦ãåç°å¢éã§åæããããç¶æ ã«ããããã®è¨äºã¯ã.emacs.dãæ´çãã話ããæ¸ãã¦ãªããå®éã«ä½¿ã£ã¦ã便å©ãªæ¡å¼µã®è©±ã¯ã¾ãå¥éè¨äºã«ããäºå®ã
ãããããªãåæã§ããªãã£ããï¼
æ®æ®µç¤¾å ã§ã¯ã社å ã§Perlæ¸ãæå°ç¨ã®æ¡å¼µãªã©ãå©ç¨ãã¦ãããããgithubã«ç´æ¥.emacs.dãå ¨é¨ä¸ãããªã©ãåºæ¥ãããã¨ãã£ã¦privateãªãªãã¸ããªã«å ¨é¨ç½®ããã¨ãã¦ãèªå® ç°å¢ã§ã¯ãã®å°ç¨æ¡å¼µã¯å¿ è¦ãªããã¾ããå°ç¨æ¡å¼µã¾ã§è¡ããªãã¦ãããã¨ãã°migemoã®ãã¹ã¨ãå®å ¨ã«åãè¨å®ã使ããªãç®æããã£ããããã
gitã§è¨å®ãã¡ã¤ã«ã管çãããã¨ãããã®ã®ãæåããã®ãããªç°å¢ä¾åã®æ¡å¼µããã©ã³ãåãæ¿ãã§å¯¾å¿ãããã¨ãã¦ãã¦ãæ´æ°ãã¦ããã®ãéçã«ãªã£ã¦ãªã¢ã¼ããªãã¸ããªã«åæ ãã¦ããã®ããããã
ãããé端ãã©ãã©ã家ã¨ä¼ç¤¾ã§ç°å¢ãå¤ãã£ã¦ãã£ã¦æ¥ã ææªãªã¨ãã£ã¿ä½é¨ãå³ããäºã¨ãªã£ãã
æ´ç
âã«æ´çå¾ã®ãªãã¸ããªãç½®ãã¨ããã https://github.com/ainame/emacs-d
æ´çã«ã¯ããã¤ãã³ãããã£ãã®ã§æ¸ãã¦ããã大ããåé¡ããã¨ä»¥ä¸ã®2ã¤ã®æ¹éã§ä»åã¯æ´çããã
- æ§è¨å®ã»æ°è¨å®ãç°¡åã«åãæ¿ããããããã«ãã¦ãã
- ç°å¢ä¾åã»èªã¿è¾¼ã¿é çªä¾åé¨åãå¯è½ãªéãæé¤ãã
1. æ§è¨å®ã»æ°è¨å®ãç°¡åã«åãæ¿ããããããã«ãã¦ãã
emacsã®è¨å®ãã¡ã¤ã«ãæ¸ãã¨ãã«vimã使ã人ã¯ãããªã«å± ãªãã¨æããã§ãã.emacs.dãå¤§å¹ ã«å¤æ´ãããã¨ããæã«ä¸éå端ãªè¨å®ã®emacsã§emacs lispã¯ããã¾ãæ¸ããããªããããã¯emacsè¨å®ããããã¨ãã«çµæ§ã¿ããªå°ã£ã¦ããããªæ°ããããã¨ã ã¨æãã
ããã§ãã¡ãã£ã¨ãã¤.emacs.dã®è¨å®ã移è¡ããããã«æ§è¨å®ã»æ°è¨å®ãç°¡åã«åãæ¿ããããããã«ãã¦ããã¨è¯ããèªåã¯ç¹å®ã®ãã£ã¬ã¯ããªã«å¤ã.emacs.dãã³ãã¼ãã¦ããã¦ã~/.emacs.dã«ã·ã³ããªãã¯ãªã³ã¯ãç½®ãã¦ããã®åç §å ãå¤æ´ã§ããããã«rakeã¿ã¹ã¯ãæ¸ãã¦ãããã
âã®ãããªæã
$ rake copy # copy ~/.emacs.d into `pwd`/old $ rake new # create symbolic link to `pwd`/src $ rake old # you can revert src settings
ããæå¤ã«ãemacsã«ã¯èµ·åæã®ãªãã·ã§ã³ã§èªã¿è¾¼ã¿elãã¡ã¤ã«ãæå®ã§ããã®ã§ä»¥ä¸ã®ããã«emacsãèµ·åãã¦ãæ°ããè¨å®ã確èªã§ããã
$ emacs -Q -L /path/to/load-path -l /path/to/new/init.el
âã®ãããªèµ·åã®ä»æ¹ãããæã«ãinit.elãªã©ã§è¿½å ã§ãã¼ããã¹ã~/.emacs.dãã¼ã¹ã®ãã¹ã§æå®ããã¨ãæ£ãããªããã¹ã¨ãã¦æ±ããã¦ãã¾ãç¹ã ã
(add-to-list 'load-path "~/.emacs.d/el-get/el-get")
ã¨ãã£ã¦ãã¾ãã¨ãã·ã³ããªãã¯ãªã³ã¯ã~/.emacs.dã«ç½®ãã¦ãªãæã¯ãæ£ãã解éãããªãã
ãã®å ´åãuser-emacs-directory
ã¨ããå¤æ°ã®å¤ãåºæºã«ãã¹ãè¨å®ã§ããããã«ããã¨è¯ãã
(defun my-abs-path (path) (expand-file-name (concat user-emacs-directory path))) (add-to-list 'load-path (my-abs-path "el-get/el-get"))
ã¨ããããã«æ¸ããã»ããå¤ã«å°ããªãã¦ä¾¿å©ã
2. ç°å¢ä¾åã»èªã¿è¾¼ã¿é çªä¾åé¨åãå¯è½ãªéãæé¤ãã
emacsã®è¨å®ãæ¸ãã¨ãã«æ¬¡ã«å°ãã®ã¯ç°å¢ã¨ãè¨å®ãã¡ã¤ã«ãåå²ããæã®èªã¿è¾¼ã¿é çªä¾åã®åé¡ã¨ãã ã¨æãã
init-loader.elã£ã¦ãã便å©ãªæ¡å¼µãããã®ã ãã©ãããã¯è¨å®ãã¡ã¤ã«ã®ãã¡ã¤ã«åãããããé å¼µããã¨ã§ãemacsã®ç¨®é¡ãã¨ã«ãã¡ã¤ã«ãèªã¿ãã¾ãããã¨ãåºæ¥ããããã¡ã¤ã«åã®å é ã«ä»ããé çªéãã«æ¡å¼µãèªã¿ãã¾ãããã¨ãåºæ¥ãã
ã ãã©èªåã¯ä½¿ã£ã¦ãªããçç±ã¨ãã¦ã¯ã
- è¥å¹²èµ·åãéããªãæ°ãããï¼ãããã¼ãããã®ããã°ãèªãã§ç¥ã£ã http://d.hatena.ne.jp/sugyan/20120104/1325683745ï¼
- ãã¡ã¤ã«ã®çªå·ç®¡çãå«ãï¼èªã¿è¾¼ã¿é çªåé¡ã®æ ¹æ¬è§£æ±ºã«ã¯ãªã£ã¦ãªããã¡ã³ãè¾ãï¼
- emacsã¯åºæ¬çã«ã¿ã¼ããã«ã®ä¸ã§ãã使ã£ã¦ãªãã®ã§GUIãã¨ã®ä¾åããªã
ã£ã¦ã®ãããã
ãã¨ãçªå·è¨å®ãã¡ã¤ã«ãã¬ã·ã¬ã·æ¸ãã¦ããã¦ããã®ä¸ã§ã©ãã©ãrequireãããã¨ãããªãã¦ããæã«requireããã¦ãã¾ããããã¯package.el以éã®autoloadã®ä»çµã¿ããã£ãããªãæ°ããã¦ããã(æ¯åeval-after-loadã¨ã使ã£ã¦æ¸ãã°ããã®ã ãã©)
ãªã®ã§ãèªåã¯init-loader.elã使ããã«ä»¥ä¸ã®ãããªæ¹æ³ã§è¨å®ãèªã¿è¾¼ã¾ãã¦ãã
el-getã§è½ã¨ãæ¡å¼µã«ä¾åããªãè¨å®ã¯ãpersonal-dirã«ä¿åãã¦*.elc
ãã¡ã¤ã«ã ããèªã¿è¾¼ã
ããã¯ãã£ã¡ãã·ã³ãã«ã§ãæå®ãããã£ã¬ã¯ããªä»¥ä¸ã®ã³ã³ãã¤ã«æ¸ã¿ã®è¨å®ãã¡ã¤ã«ã ããã²ãããèªã¿è¾¼ãã ããèªã¿è¾¼ã¿é çªã«ã¤ãã¦ã¯requireãã»ã¼æ¸ããªãã§æ¸ãè¨å®ããç½®ããªããã¨ã§è§£æ±ºã
(defvar personal-dir (my-abs-path "personal-conf")) (when (file-directory-p personal-dir) (mapc 'load (directory-files personal-dir 't "^[^#].*elc$")))
el-getã§è½ã¨ãæ¡å¼µã«ä¾åããè¨å®ã¯ãel-get-user-package-directoryã«ä¿åãã¦èªã¿è¾¼ã
el-getã®ããã©ã§ã¯æå¹ã«ãªã£ã¦ãªãè¨å®ã®1ã¤ã«Package Setupæ©è½ãããï¼READMEã«æ¸ãã¦ããï¼ãel-get-user-package-directory
ã¨ããå¤æ°ããã£ã¦ããã®å¤æ°ã«ãã¹ãæå®ãã¦ããã¨ããã®ãã£ã¬ã¯ããªä»¥ä¸ã«init-<package name>.el
ã¨åã¥ãããã¡ã¤ã«ãç½®ããã¨ã§ã(è¯ãæãã®ã¿ã¤ãã³ã°)https://github.com/dimitri/el-get/blob/master/el-get.el#L545ã§èªã¿è¾¼ã¾ããããã«ãªãã
èªã¿è¾¼ã¾ããé çªã§ã¨ã©ã¼ãèµ·ããããããããªåé¡ã¯åºæ¬çã«åããã±ã¼ã¸ãrequireãããã¨ã§èµ·ããã¨æãã®ã§ãèªåã§ã¯requireã¯æ¥µåæ¸ããã«å¿ è¦ãªæã®ã¿æ¸ãããã«ãããåºæ¬çã«ã¯el-get使ã£ã¦ãã®ã§autoloadãè¨å®ãããã®ã§èªåã§requireãããã¨ã¯ãªããã©ããã¾ã«ãã¾ããããªãæãããã®ã§åããªãã£ããèªåã§requireæ¸ãã¦ã¨ããããåé¿ãããããã®ããªã§è¨å®ãæ¸ãã¦ãã
ã©ããã¦ãç°å¢ã«ä¾åãã¦ãã¾ããã¡ã¤ã«ã¯.gitignoreã«è¿½å ãããã¡ã¤ã«ã«è¿½å ãã
èªå® ã§ã¯Macãä¼ç¤¾ã®éçºç°å¢ã§ã¯ç®¡çè 権éããªãéMacã®OSã¿ãããªã¨ãã«ãmigemoã¨ããè¨ç½®ãããã¹ã®åé¡ãçºçããã¨æããããããã©ããããããªããã¤ã¯æä½éã«ãã¼ã£ã¦.gitignoreã«è¿½å ãããã¡ã¤ã«ã«å®ç¾©ãããæä½éã£ã¦ããã®ã¯ããã¨ãã°migemoã®ä¾ã ã¨ãmigemoã®è¨å®å ¨ä½ã¯å ±éåãã¦ããã¦ãmigemoã®ãã¹ã ãå¥ãã¡ã¤ã«ã®å¤æ°ãåç §ããããã«ãã¦ããã¨ãããããæãã
ãã ãä½ããã¡ã¤ã«ãåå¨ãã¦ãªãã¨ä»ã®ãã·ã³ã«å ¥ãããã¨ããæã«è¨å®æãåºãã®è¾ãã®ã§.sampleãã¡ã¤ã«ã¿ãããªã®ã¯ç¨æãã¦ããã https://github.com/ainame/emacs-d/blob/master/src/init/my-environment.el.sample
ãã¨ã¯âã®ãã¡ã¤ã«ã«ã¯ã社å å°ç¨ã®æ¡å¼µã«ã¾ã¤ããè¨å®ãæ¸ããããã¦ããã
ã¾ã¨ã
ãããä¸è¦ãéããæ¥æ¬äººã¯çµæ§init-loader.elã使ã£ã¦ã人ãå¤ãã¦ãèªåã®å ´åãinit-loader.elã使ããã«è¨å®ãã¦ãè¥å¹²çããæãã«ãªã£ã¦ããã¨æããã©ãããããè¨å®ã®ä»æ¹ãåºæ¥ããã ããã¿ãããªãã¨ãè¨ãããã£ããemacsã®è¨å®ã¯æ¡å¼µç¶ããã¨ãã¤ãå£ãã¦ä½ãåå ã§ãããªã£ãã®ãåãããªãäºãå¤ãã£ãããæ¡å¼µå ¥ãããã¦ä½ããªãã ãåãããªããªã£ãããããã¨ãããã®ã§ãå¹´ã«1åãããè¨å®ãã¡ã¤ã«ãè¦ç´ãã¦æ´çããã®ã¯ããããªâã¨æã£ããä»åãã§ããéãããããªä¾åé¢ä¿ãã§ããéãæé¤ããè¨å®ãå¿ãããã®ã§ã次ã«ä½ãæ¡å¼µãããã¨æã£ãæã«ã¯ããããããæãã«ãªã£ã¦ããã¨æãã
ãã¨ãemacs24ã«ãªã£ã¦package.elã使ããããã«ãªã£ãã®ã§ãæ´çããã¨æ´çåã«ä½¿ã£ã¦ãæ¡å¼µããã¼ã¸ã§ã³ã¢ããããã®ãããã楽ãªã®ã§ãã¬ã³ã¬ã³ææ°ã®æ©è½ã使ããããã«ãªã£ããç¹ã«emacsã®gitãã¼ã«ã®magitã¯ãã¼ã¸ã§ã³ã¢ãããããæ©è½å¢ãã¾ãã£ã¦ãã¦ãã£ã¡ã便å©ã«ãªã£ã¦ãã
ãããªæãã§åã®èããæå¼·ã®.emacs.dã¿ãããªãã®ãåºæ¥ä¸ãã£ãã®ã ãã©ãããããã¦ãã¦ã®å¡ã¿ãããªæããªã®ã§ãã¿ããªç´ ç´ã«Sublime textã¨ãEclipseã¨ããã£ã¨ä½¿ãã°ããã¨æãã
Emacs Lispãã¯ããã¯ãã¤ãã«
- ä½è : ãã³ãã¡
- åºç社/ã¡ã¼ã«ã¼: æè¡è©è«ç¤¾
- çºå£²æ¥: 2011/11/26
- ã¡ãã£ã¢: åè¡æ¬ï¼ã½ããã«ãã¼ï¼
- è³¼å ¥: 5人 ã¯ãªãã¯: 220å
- ãã®ååãå«ãããã°ãè¦ã