emacs orgmode 不在 headers 之间插入行?

emacs orgmode do not insert line between headers?

在 emacs org-mode 中,当我创建一个新的 sub-heading,(org-insert-subheading) 时,有时它会添加一个空行,有时它不基于文本中的某些模式多于。

我可以强制 emacs 从不插入换行符吗?

* Heading 1
** Heading 2  #no line breaks.

这个由变量控制org-blank-before-new-entry:

Should `org-insert-heading' leave a blank line before new heading/item?
The value is an alist, with `heading' and `plain-list-item' as CAR, and a boolean flag as CDR. The cdr may also be the symbol `auto', in which case Org will look at the surrounding headings/items and try to make an intelligent decision whether to insert a blank line or not.

在我的 emacs 版本中,这两项的默认值为 auto。要从不插入空行,请将两者都设置为 nil:

(setf org-blank-before-new-entry '((heading . nil) (plain-list-item . nil)))

我认为这是由变量org-blank-before-new-entry控制的。根据组织文档:

Should org-insert-heading leave a blank line before new heading/item? The value is an alist, with heading and plain-list-item as CAR, and a boolean flag as CDR. The cdr may also be the symbol `auto', in which case Org will look at the surrounding headings/items and try to make an intelligent decision whether to insert a blank line or not.

For plain lists, if org-list-empty-line-terminates-plain-lists is set, the setting here is ignored and no empty line is inserted to avoid breaking the list structure.

默认值为'((heading . auto) (plain-list-item . auto)),所以它通常会在标题前插入一个换行符(heading中的auto部分)。自定义变量时可以指定Never,不会插入换行符