対å¿ããæ¬å¼§ãèªåæ¿å ¥ãã
.emacs ãã´ãã£ã´ãã£ãã¦ãã®ã§, ããã±ã¼ã¸ã«ã§ããããªã®ã¯, ãã¦ã¿ããã¨ã«ãã¦ä½æ.
対å¿ããæ¬å¼§ãèªåæ¿å
¥.
æåã¯, brackets.el ã¨ãããã®ã使ã£ã¦ããã©, ããã®ä¸æºãªç¹ãæ¹é ããã®ã .emacs å
ã«ãã£ã¦,
ãã£ãããªéã«ãªã£ã¦ãããã, ã¾ã¨ãã¦ã¿ã.
ã¾ã , .emacså
ã§ã¯, ã³ã¡ã³ãã¢ã¦ããã¦æ®ãã¦ãããã©, ããã±ã¼ã¸ã«ãã¨ãã°, ä¿å®ã®ç¹ã§éãããªï¼éãã¨ãããª.
ãã¦ã³ãã¼ã
以ä¸ããã©ã.
è¨å®ä¾
text-mode ã¸ã®è¨å®ä¾ã示ãã¾ã.
ãã®ããã±ã¼ã¸ã¯, é¢æ°ãæä¾ãã¦ãã ããªã®ã§, ãã¼ãå²å½ã¦ãå¿
è¦ãããã¾ã.
# ææ°çã§ã¯, ã¾ã¨ãã¦ãã¼ãå²ãå½ã¦ãé¢æ°ãç¨æãã¦ãã¾ã. 詳ããã¯, ãã©ãã¯ããã¯å
ã®ã¨ã³ããªãè¦ã¦ä¸ãã.
(add-hook 'text-mode-hook '(lambda() (define-key text-mode-map "{" 'insert-braces) (define-key text-mode-map "(" 'insert-parens) (define-key text-mode-map "\'" 'insert-single-quotation) (define-key text-mode-map "\"" 'insert-double-quotation) (define-key text-mode-map "[" 'insert-brackets)))
ä»ã®ã¢ã¼ãã¸ã¯, text-mode-hook, text-mode-map ãå¥ã®ã¢ã¼ãã®ããã«ç½®ãæããã°å¤§ä¸å¤«ãªã¯ãã§ã.
(*追è¨*)
æ¸ãã®å¿ãã¦ã¾ããã, ãã®ããã±ã¼ã¸ã®é¢æ°ã使ç¨ããã«ã¯, 使ç¨åã«ä»¥ä¸ã®ããã« require ãã¦èªã¿è¾¼ãã§ããå¿
è¦ãããã¾ã.
(require 'parenthesis)
é¢æ°
- insert-braces
- insert-brackets
- insert-parens
- insert-single-quotation
- insert-double-quotation
- insert-angle
ä¸è¨ã®ãã®ã¯, ãããã, {}, [], (), '', "", <> ã§ã.
- insert-grave-and-quotation
ããã¯, `' ã®ã¹ã¿ã¤ã«ãæä¾ãã¾ã.
- insert-braces2
- insert-brackets2
- insert-parens2
- insert-single-quotation2
- insert-double-quotation2
- insert-angle2
ããã¯, ããã«ã¯ãªã¼ãã¼ã·ã§ã³ãªãã°,
" " ã®ããã«, éå§ã®ã"ã ã®å¾ã«1ã¤ç©ºç½ã, çµäºã®ã"ãã®åã«1ã¤ç©ºç½ãç½®ããå½¢å¼ã®ãã®ãæ¿å
¥ãã¾ã.
ãµãã¾ã
åç½®å¼æ°ãä¸ããå ´åã¨, ãã¼ã¯ãã¢ã¯ãã£ããªã¨ãã¨ã§, åä½ãå¤ããã¾ã.
æ£ã®å¤ãåç½®å¼æ°ã¨ãã¦ä¸ããå ´å, ä¾ãã°, C-4 insert-paren ã¨ãããªãã°, (((()))) ã®ããã«æ¿å
¥ããã¾ã.
è² ã®å¤ãåç½®å¼æ°ã¨ãã¦ä¸ããå ´å, ä¾ãã°, C- - C-4 insert-paren ã¨ãããªãã°, (((( ã®ããã«æ¿å
¥ããã¾ã.
åç½®å¼æ°ã¨ã㦠0 ãä¸ããå ´å, ( ã®ããã«éå§ã®ãã®ã ãæ¿å
¥ããã¾ã.
ãã¼ã¯ãã¢ã¯ãã£ããªãã°, ãã®ç¯å²ãå²ãããã«æ¬å¼§ãæ¿å
¥ãã¾ã.
ä¾ãã°, ãtestãã¨ããåèªããã¤ã³ãã¨ãã¼ã¯ã¨ã§å²ã£ã¦ãããªãã°, insert-paren ã®å ´å, ã(test)ãã®ããã«æ¿å
¥ããã¾ã.
ã³ã¡ã³ã
brackets.el ãåèã«ä½æãã¾ãã.
ã¾ã, æã®ã¨ã³ããªã§ä¼¼ããããªãã®ãæ¸ããã¨ãã«é ãã plus ããä½æã®é¢æ°ãã³ã¡ã³ããåèã«ãªã£ã¦ãã¾ã.
ãããã¨ããããã¾ã.
ä¼¼ããããªé¢æ°ã§, Emacs ã«ã¯, insert-pair ã¨ãããã®ãåå¨ãã¾ãã,
ãã¾ãã¡æ¯ãèããããããããªã(ãã調ã¹ã¦ãªã)ã®ã§, ä»åã¯ä½¿ç¨ãã¾ããã§ãã.
# å¼æ°ã«æå®ããã®ã, æåå(string)ã§ã¯ãªã, æå(char)ã¨ããã®ã, 使ç¨ããªãã£ãçç±ã«ãã£ãããã¾ã. ãã¾ã好ãã«ãªããªãã¦.
å
é¨ã§, dotimes ã使ç¨ãã¦ãã¾ãã, Emacs 22 以ä¸ãªãã°, subr.el ã«ãã¯ãã¨ãã¦å®ç¾©ããã¦ãã¾ã.
emacs 21 ãªãã°, cl-macs.el ã«å®ç¾©ããã¦ãã¾ã.
ãã®ããã±ã¼ã¸ã«ã¤ãã¦ä½ãåé¡ãããã°, é æ ®ãªãã³ã¡ã³ã, ã¡ã¼ã«ãã¦é ããã¨å¬ããã§ã.
æ´æ°æå»
- 1ããã 2007å¹´, 11æ1æ¥, 2:21
- 2ããã 2007å¹´, 11æ1æ¥, 21:11
- 3ããã 2008å¹´, 1æ19æ¥, 1:18