简体   繁体   English

Emacs,如何为LaTeX文件自动打开flyspell

[英]Emacs, how to auto turn on flyspell for LaTeX file

I use Emacs only for \\LaTeX and python programming. 我只将Emacs用于\\ LaTeX和python编程。 Is there a way to automatically turn on flyspell-mode when I work on a .tex file, and turn on flyspell-prog-mode when I work on a .py file? 当我处理.tex文件时,有没有办法自动打开flyspell-mode当我处理.py文件时打开flyspell-prog-mode How can I do this in my .emacs file? 我怎么能在我的.emacs文件中这样做?

Add those functions to hooks of python-mode and latex-mode 将这些函数添加到python-mode和latex-mode的钩子中

(require 'python)

;; If you use tex-mode
(require 'tex-mode)`
(add-hook 'latex-mode-hook 'flyspell-mode)

;; If you use AUCTeX
(load "auctex.el" nil t t)`
(add-hook 'LaTeX-mode-hook 'flyspell-mode)


(add-hook 'python-mode-hook 'flyspell-prog-mode)

Something like this should work. 这样的事情应该有效。

(setq auto-mode-alist (cons '("\\.tex\\'" . flyspell-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.py\\'" . flyspell-prog-mode) auto-mode-alist))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM