emacsã®æ©è½ãé§ä½¿ãã¦ï¼ã½ã¼ã¹ã³ã¼ããåèªåçã«æ´å½¢ããæ¹æ³ï¼
æé ã¯ãã£ãã®2stepã§ãï¼å ·ä½çã«ã¯
- step-1 C-c C-q ã§èªåã¤ã³ãã³ã
- step-2 M-x align-regex ã§ãã¼ã¯ã¼ããæå®ãã¦ããã¹ããæ´å
ã¨ããæµãã«ãªãã¾ãï¼
以ä¸ä¾ã¨ãã¦Cè¨èªã§è¨è¿°ãããã½ã¼ã¹ã³ã¼ãã使ãã¾ããï¼åãæé ã§C以å¤ã®ä»ã®è¨èª(C++ã¯ãã¡ããphp,ruby,lispãªã©)ã§ãæ´å½¢ã§ãã¾ãï¼
å ã®ã½ã¼ã¹
const char* foo(int code) { const char *msg = NULL; switch (code) { case LS_SUCCESS: msg = "success";break; case LS_NO_RECORD: msg = "no record";break; case LS_NO_TOKEN: msg = "no token";break; } return msg; }
step-1 ã¤ã³ãã³ãããããã
é¢æ°å ã«ã«ã¼ã½ã«ã移åããã¦ï¼C-c C-q
const char* foo(int code) { const char *msg = NULL; switch (code) { case LS_SUCCESS: msg = "success";break; case LS_NO_RECORD: msg = "no record";break; case LS_NO_TOKEN: msg = "no token";break; } return msg; }
C-c C-q ãè¦ãã«ããã£ãã M-x indent-region ã使ãã¾ãããï¼
step-2 M-x align-regex ã§æ´å
M-x align-regex ã使ãã¨ï¼æå®ããåèª(å³å¯ã«ã¯æ£è¦è¡¨ç¾)ã§ããã¹ããæ´åã§ãã¾ãï¼
ãã¨ãã°ï¼å¤æ°å msg ã§æ´åãããå ´åã¯ï¼M-x align-regex ãã¦ï¼"msg" ã¨å
¥åãã¾ãï¼
const char* foo(int code) { const char *msg = NULL; switch (code) { case LS_SUCCESS: msg = "success";break; case LS_NO_RECORD: msg = "no record";break; case LS_NO_TOKEN: msg = "no token";break; } return msg; }
ç¶ãã¦ï¼break ã§ãæ´åãããã¨ä»¥ä¸ã®ãããªãã£ããã¨ããã³ã¼ãã«ãªãã¾ãï¼
const char* foo(int code) { const char *msg = NULL; switch (code) { case LS_SUCCESS: msg = "success"; break; case LS_NO_RECORD: msg = "no record"; break; case LS_NO_TOKEN: msg = "no token"; break; } return msg; }
ãªã©ã¤ãªã¼ã»ã¸ã£ãã³
売ãä¸ãã©ã³ãã³ã°: 390213
æå¿«ãªèªãå£èª¿ã§ã»ã»ã»
ãªã©ã¤ãªã¼ã»ã¸ã£ãã³
売ãä¸ãã©ã³ãã³ã°: 72135