可以使用emacs组织模式来处理以%开头的行作为注释吗?

时间:2013-03-02 11:24:32

标签: emacs comments org-mode

我知道我可以在org-mode中将一行标记为#前缀。是否可以为以'%'开头的行配置相同的行为?

3 个答案:

答案 0 :(得分:2)

我刚试过修改org.el中的以下函数:

(defun org-at-comment-p nil
  "Is cursor in a line starting with a # character?"
  (save-excursion
    (beginning-of-line)
    (looking-at "^#")))

通过更改^[#%]之类的正则表达式,没有运气。

#字符在org-mode中的许多位置进行了硬编码。

答案 1 :(得分:2)

你可能不认为这是一个真正的答案,但它是......

请勿使用#

答案 2 :(得分:2)

(font-lock-add-keywords
  'org-mode `(("^[ \t]*\\(#\\)[ +\n].*$"
      (0 (compose-region
      (match-beginning 1) (match-end 1) ?%)))))

即使它是%字符,也会显示#个字符。您仍需要使用#插入注释,但它们将按您的要求显示。

相关问题