2009-01-31 80 views
7

什麼是在emacs模式下定義多行註釋的正確方法 (如C的/ * * /)?我看到的elisp示例是以單個分隔符開始並在行尾結束的註釋(如C++的或Perl的#)。Emacs模式多行註釋

回答

13

是這樣的:

(define-derived-mode my-mode 
    awk-mode "my" 
    "My mode" 
    (setq comment-multi-line nil) ; maybe 
    (setq comment-start "/* ") 
    (setq comment-end "*/")) 

但也有細微之處;也許你想

/* line one */ 
/* line two */ 
/* line three */ 

或者也許你想

/* 
    line one 
    line two 
    line three 
*/ 

這是由您comment-style,您可以自定義(M-x customize-variable comment-style)的影響。對於第一個示例,選擇indent,對於第二個示例,extra-line

它的全部定義在newcomment.el,你可以閱讀關於如果你M-x describe-variable comment-start