[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Changing ispell dictionary
From: |
Tassilo Horn |
Subject: |
Re: Changing ispell dictionary |
Date: |
Fri, 10 Aug 2007 21:49:47 +0200 |
User-agent: |
Gnus/5.110007 (No Gnus v0.7) Emacs/22.1.50 (gnu/linux) |
Sven Joachim <svenjoac@gmx.de> writes:
Hi Sven,
> Does somebody have a bright idea how to automatically change the local
> dictionary in the message buffer (assuming that a newsgroup or mail
> recipient is known; of course it cannot be guessed if I just type C-x
> m outside of Gnus)? There are various *message-*hook variables and I
> don't know which to choose.
At least for newsgroups you could do something like this:
--8<---------------cut here---------------start------------->8---
(defun th-switch-ispell-dictionary ()
(save-excursion
(message-goto-newsgroups)
(let ((newsgroups (buffer-substring-no-properties
(line-beginning-position) (line-end-position))))
(cond ((string-match (rx " de.") newsgroups)
(ispell-change-dictionary "german"))
((string-match (rx " fr.") newsgroups)
(ispell-change-dictionary "french"))
(t
(ispell-change-dictionary "english"))))))
--8<---------------cut here---------------end--------------->8---
I didn't test it, but I wouldn't be too surprised if it works. ;-)
For mail recipients you could probably use a field in the bbdb which
indicates the receivers language, or simply guess by the top-level
domain of the email address.
Bye,
Tassilo