2

我知道我可以通过在 org-mode 中添加前缀来将一行标记为注释#。是否可以为以“%”开头的行配置相同的行为?

4

3 回答 3

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

这会显示一个%字符,即使它是一个#字符。您仍然需要使用# 插入注释,但它们会按照您的意愿显示。

于 2013-03-06T00:00:11.353 回答
2

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

不要,只需使用#

于 2013-03-03T00:18:54.090 回答
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 中的许多地方都被硬编码。

于 2013-03-02T19:40:35.240 回答