I want to load flyspell-mode and execute flyspell-buffer automatically after emacs loaded a tex file. I tried the following which loads flyspell-mode but doesn't seem to execute flyspell-buffer. What would be the proper way to to this? How do I have to change it if I want it on every file not just on LaTeX-files?

(setq ispell-program-name "hunspell")
(setq ispell-local-dictionary "de_DE")
(setq ispell-local-dictionary-alist
      '(("de_DE" "[[:alpha:]]" "[^[:alpha:]]" "[']" nil nil nil utf-8)
    ("en_US" "[[:alpha:]]" "[^[:alpha:]]" "[']" nil nil nil utf-8)

(add-hook 'LaTeX-mode-hook 'turn-on-flyspell)
(add-hook 'LaTeX-mode-hook 'flyspell-buffer)
  • 1
    I have similar problems, flyspell checks for errors but asynchronously (it does not immediately flag errors but only if I scroll to a nearby location). Maybe you can try one from the following to see if it helps: find-file-hooks, after-save-hook, before-save-hook, and auto-save-hook? I have the following but it is often very slow: (add-hook 'before-save-hook #'flyspell-buffer). – Swarnendu Biswas Feb 10 '16 at 17:36
  • @SwarnenduBiswas What does the # mean in this context? – student Feb 10 '16 at 17:47
  • @student See emacs.stackexchange.com/questions/3595/… – JeanPierre Feb 10 '16 at 19:28
  • @student This post explains why is it beneficial to sharp-quote symbols that are functions endlessparentheses.com/…. – Swarnendu Biswas Feb 11 '16 at 17:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.