我想知道是否可以为不同级别的轮廓设置不同的填充列值。目前我将其设置为78,并且看起来如何计算列对于较低级别()是不同的,并且作为结果,较低级别的文本超过78列。
邮件列表中也提出了同样的问题,但没有回复: http://lists.gnu.org/archive/html/emacs-orgmode/2011-05/msg00654.html
最佳, 俊
答案 0 :(得分:0)
我添加了计算apt偏移的函数并调用常规org填充内容:
(defun calc-offset-on-org-level ()
"Calculate offset (in chars) on current level in org mode file."
(* (or (org-current-level) 0) org-indent-indentation-per-level))
(defun my-org-fill-paragraph (&optional JUSTIFY)
"Calculate apt fill-column value and fill paragraph."
(let* ((fill-column (- fill-column (calc-offset-on-org-level))))
(org-fill-paragraph JUSTIFY)))
(defun my-org-auto-fill-function ()
"Calculate apt fill-column value and do auto-fill"
(let* ((fill-column (- fill-column (calc-offset-on-org-level))))
(org-auto-fill-function)))
在我的.emacs中设置org-mode以使用此功能(请参阅org.el,org-setup-filling):
(defun my-org-mode-hook ()
(setq fill-paragraph-function 'my-org-fill-paragraph
normal-auto-fill-function 'my-org-auto-fill-function)
(add-hook 'org-load-hook 'my-org-mode-hook)
(add-hook 'org-mode-hook 'my-org-mode-hook)
结果我得到了(wysiwyg):
* Top level heading
This is sufficiently long string, and, as you see fill-column is not far
from screen edge on the top level. My fill-column value is 77.
* Level 5
Offset is 12 chars on this level, but we set there fill column to
the 78 - 12 = 66 chars.
* Derived 18 (?)
Auto fill mode works too due to function
my-org-auto-fill-function.