1
  1. 问题:

如何通过文件中的 EMACS 变量自动选择 flyspell(而不是通过 .emacs 配置文件!),仅针对该文件,类似于我仅为该文件选择 ispell 字典

示例 abc.tex:

---剪辑---

text text ..

text text ..

<!-- LocalXIspellDict: de -->
<!-- HERE SHOULD GO THE SOLUTION -->

---剪辑---

第二个问题:

我怎样才能做到这一点——每当我打开一个 TeX 文件,即 XXX.tex——通过配置我的 init.el 文件自动选择 flyspell?意思是,flyspell 是根据文件扩展名选择的。

4

3 回答 3

4

第一行文件变量语句的替代方法是注释局部变量块,如下所示:

% Local Variables:
% eval: (flyspell-mode 1)
% ispell-local-dictionary: "german"
% End:

(从 Emacs 24 开始,虽然仍适用于主要模式,但不推荐使用该mode: MINOR-MODE语法,eval应改为使用该语法)。

详见手册:
M-: (info "(emacs) Specifying File Variables") RET

另外:http ://www.emacswiki.org/emacs/FileLocalVariables

于 2012-01-23T20:21:20.573 回答
1

第二部分相当简单:只需将flyspell-mode要使用的mode-hookfor each 模式添加到flyspell.

这会在启用时启用 flyspell text-mode(基本上总是如此):

(add-hook 'text-mode-hook (lambda ()  (flyspell-mode 1)))

您可能想使用tex-mode-hook.

对于文件:把它放在文件的开头,当你找到那个文件时,应该输入flyspell。

-*- mode: flyspell; -*-
于 2012-01-23T17:33:55.507 回答
-1

使用文件本地变量:http ://www.gnu.org/software/emacs/manual/html_node/emacs/File-Variables.html

% Local Variables:
%   ispell-local-dictionary: "american"
% End:
于 2013-05-22T12:51:23.047 回答