[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Changing ispell dictionary
From: |
Hadron |
Subject: |
Re: Changing ispell dictionary |
Date: |
Sat, 11 Aug 2007 12:31:28 +0200 |
User-agent: |
Gnus/5.110006 (No Gnus v0.6) Emacs/23.0.0 (gnu/linux) |
Tassilo Horn <tassilo@member.fsf.org> writes:
> 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.
>
> (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)
>
> Bye,
> Tassilo
I would be very interested in this code using the bbdb idea instead (top
level domains are not indicative of persons real or favorite language in
this global world) - look for existence of a bbdb alias called
"language" and if it exists then switch to it with
ispell-change-dictionary
... :-;
--