Emacs:从文件头中禁用次要模式

Dmi*_*tri 8 emacs elisp autofill org-mode

虽然我主要讨厌自动填充模式,但是组织模式是使用它的好例子,所以我不想在默认情况下为Org模式禁用它.但是,我确实有一些Org文件,我绝对不想要它,并且M-x auto-etc每次打开它时都不会打字.

我知道你可以从文件头传递变量到Emacs,经过一些搜索,我想出了这个文件,我从中推断出我想要这样的东西:

-*- mode: Org; auto-fill-mode 0 -*-
Run Code Online (Sandbox Code Playgroud)

作为我文件的第一行.但不是这个,因为这给了我一个错误:

Malformed mode-line: "auto-fill-mode 0"
Run Code Online (Sandbox Code Playgroud)

和自动填充模式无法启动.

我确信这是一个简单的语法错误,但知道正确的方法来做这件事会很好.

nis*_*pio 10

这是我使用的:

# -*- mode: Org; eval: (auto-fill-mode 0) -*- #
Run Code Online (Sandbox Code Playgroud)

请注意,这些#字符是可选的,我只是因为样式原因而更喜欢它们.

$ info emacs

48.2.4.1 Specifying File Variables:

Do not use the `mode' keyword for minor modes.  To enable or disable 
a minor mode in a local variables list, use the `eval' keyword with a
Lisp expression that runs the mode command (*note Minor Modes::).`
Run Code Online (Sandbox Code Playgroud)


abo*_*abo 5

根据文档的这一部分,将其附加到文件末尾:

# Local Variables:
# eval: (auto-fill-mode 0)
# End: 
Run Code Online (Sandbox Code Playgroud)

  • 为了清楚地表明您的 Org 文件末尾有“系统设置”,您可以添加一个 Org 部分,例如“* Local Variables”并对其进行注释,这样它就永远不会被导出。 (2认同)