[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 22:20:58 +0200 |
User-agent: |
Gnus/5.110007 (No Gnus v0.7) Emacs/22.1.50 (gnu/linux) |
Tassilo Horn <tassilo@member.fsf.org> writes:
Hi again,
> I didn't test it, but I wouldn't be too surprised if it works. ;-)
Well, I thought it could be useful for me, too, so I tried it. It
didn't work. Below is a working version.
> 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.
That's what I do now.
--8<---------------cut here---------------start------------->8---
(defun th-switch-ispell-dictionary ()
(save-excursion
(goto-char (point-min))
(re-search-forward (rx bol (group (or "To:" "Newsgroups:"))))
(if (string= (match-string 1) "Newsgroups:")
(let ((newsgroups (buffer-substring-no-properties
(line-beginning-position) (line-end-position))))
(cond ((string-match (rx " de.") newsgroups)
(ispell-change-dictionary "german"))
(t
(ispell-change-dictionary "english"))))
(let ((to (buffer-substring-no-properties
(line-beginning-position) (line-end-position))))
(cond ((string-match (rx ".de" (not (any word))) to)
(ispell-change-dictionary "german"))
(t
(ispell-change-dictionary "english")))))))
(add-hook 'message-setup-hook 'th-switch-ispell-dictionary)
--8<---------------cut here---------------end--------------->8---
Bye,
Tassilo
--
Chuck Norris' favorite cereal is Kellogg's Nails 'N' Gravel.