Hello Tassilo,
many thanks for your suggestions. I'm using your last code snippet
now, with one correction:
> (defun th-message-switch-ispell-dictionary ()
> (save-excursion
> (message-narrow-to-headers-or-head)
> (let ((newsgroups (message-fetch-field "Newsgroups"))
> (to (message-fetch-field "To")))
> (message "newsgroup or to = %s." (or newsgroups to))
> (if newsgroups
> (cond ((string-match (rx bol (or "de." "infko.")) newsgroups)
> (ispell-change-dictionary "german"))
> (t
> (ispell-change-dictionary "english")))
> (cond ((string-match (rx ".de" (or (not (any word)) eol)) to)
> (ispell-change-dictionary "german"))
> (t
> (ispell-change-dictionary "english")))))))
>
> (add-hook 'message-setup-hook 'th-message-switch-ispell-dictionary)
This has the problem that both newsgroups and to can be nil, e.g. when
composing a brand new message outside Gnus with C-x m. In this case
an error occurs in the second string-match. Here is a corrected
version:
(defun th-message-switch-ispell-dictionary ()
(save-excursion
(message-narrow-to-headers-or-head)
(let ((newsgroups (message-fetch-field "Newsgroups"))
(to (message-fetch-field "To")))
(message "newsgroup or to = %s." (or newsgroups to))
(if newsgroups
(cond ((string-match (rx bol (or "de." "infko.")) newsgroups)
(ispell-change-dictionary "german"))
(t
(ispell-change-dictionary "english")))
(cond ((and to (string-match (rx ".de" (or (not (any word)) eol)) to))
(ispell-change-dictionary "german"))
(t
(ispell-change-dictionary "english")))))))
Cheers,
Sven
_______________________________________________
info-gnus-english mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/info-gnus-english