Emacs, how to auto turn on flyspell for LaTeX file

2019-05-10 18:05发布

I use Emacs only for \LaTeX and python programming. 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? How can I do this in my .emacs file?

2条回答
来,给爷笑一个
2楼-- · 2019-05-10 18:49

Add those functions to hooks of python-mode and 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)
查看更多
Summer. ? 凉城
3楼-- · 2019-05-10 18:55

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))
查看更多
登录 后发表回答