10

I write mostly my documentation in HTML using emacs as my main editor. Emacs let you interactively spell-check the current buffer with the command ispell-buffer.

Since I switch between a number of languages, I have an HTML comment at the end of the file specifying the main dictionary and personal dictionary for that file, E.g. for Norwegian (norsk) I use the following pair of dictionaries:

<!-- Local IspellDict: norsk -->
<!-- Local IspellPersDict: ~/.aspell/personal.dict -->

This works great.

However, sometimes I have a paragraph in another language (e.g. English) embedded in an otherwise Norwegian document. Example:

<p xml:lang="en">This paragraph is in English.</p>

The spell-checker naturally flag all the words in such a paragraph as misspellings (since the dictionary only contain Norwegian words).

To avoid this, I've tried to add a "british" dictionary to the document, like this:

<!-- Local IspellDict: british -->
<!-- Local IspellDict: norsk -->
<!-- Local IspellPersDict: ~/.aspell/personal.dict -->

Unfortunately, this does not work. The "british" dictionary is simply ignored.

My prefered solution would to load an additional dictionary and use this, toghether with the primary dictionary, for spell-checking. Is this possible?

However, I am also interested in a solution that let me mark paragraphs for not being spell checked. It is not ideal, but it would stop valid English words from being flagged as misspellings.

PS: I have also looked at the answer to this question: Multilingual spell checking with language detection, but it is much broader and does not address the specific use emacs ispell for doing the spell-check.

Community
  • 1
  • 1
Free Radical
  • 2,052
  • 1
  • 21
  • 35
  • 1
    possible duplicate of [How to define two ispell dictionaries in Emacs for LaTeX mode?](http://stackoverflow.com/questions/11361603/how-to-define-two-ispell-dictionaries-in-emacs-for-latex-mode) – imz -- Ivan Zakharyaschev Apr 20 '15 at 14:01

1 Answers1

1

Try ispell-multi and flyspell-xml-lang http://www.dur.ac.uk/p.j.heslin/Software/Emacs/

You can spawn multiple instances of ispell, and use the xml:lang tag to decide which language to check for.

grm
  • 5,197
  • 5
  • 29
  • 35
  • 1
    Thanks for the suggestion. I've loaded `ispell-multi` and `flyspell-xml-lang` and tagged the English paragraphs with `xml:lang="en"`, but it still ignores the "british" dictonary. There seem to be some piece missing. – Free Radical Jun 02 '13 at 11:58