![]() |
![]() |
![]() |
![]() |
(comment-out [key-out] [key-in] [n-columns] ([mode-name-1] [start-string-1] [bol-char-1] [end-string-1]) ([mode-name-2] [start-string-2] [bol-char-2] [end-string-2]) ........................................................ ([mode-name-n] [start-string-n] [bol-char-n] [end-string-n]) )
(comment-out #\M-o #\M-p 40 (lisp-mode ";") (c-mode "/*" #\* "*/") (c++-mode "//") (perl-mode "#") (LaTeX-mode "%") (html-mode "<!--" #\- "-->") )
モード | 一行 | 複数行 |
---|---|---|
変換前 | something |comment (| はカーソルの位置) |
This is comment 1. This is comment 2. This is comment 3. |
lisp-mode | something ; comment |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; This is comment 1. ; This is comment 2. ; This is comment 3. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
c-mode | something /* comment*/ |
/***************************************** * This is comment 1. * This is comment 2. * This is comment 3. *****************************************/ |
c++-mode | something // comment |
////////////////////////////////////////// // This is comment 1. // This is comment 2. // This is comment 3. ////////////////////////////////////////// |
perl-mode | something # comment |
######################################### # This is comment 1. # This is comment 2. # This is comment 3. ######################################### |
LaTeX-mode | something % comment |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % This is comment 1. % This is comment 2. % This is comment 3. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
html-mode | something <!-- comment--> |
<!------------------------------------------ - This is comment 1. - This is comment 2. - This is comment 3. -------------------------------------------> |
関数をモードごとに分けないで、1つの関数で全てのモードをカバーすることも 可能だと思いますが、複雑になりそうですし、実行時の処理が多くなりそうなので モードごとの関数を定義するマクロを書いてみました。
![]() |
![]() |
![]() |
![]() |