info-gnus-english
[Top][All Lists]
Advanced

[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 23:09:53 +0200
User-agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.1.50 (gnu/linux)

Reiner Steib <reinersteib+gmane@imap.cc> writes:

Hi Reiner,

>>     (message-goto-newsgroups)
>>     (let ((newsgroups (buffer-substring-no-properties
>>                        (line-beginning-position) (line-end-position))))
>
> `message-fetch-field'

Oh, much easier.  Thanks for that pointer.  Now that's what I use:

--8<---------------cut here---------------start------------->8---
(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)
--8<---------------cut here---------------end--------------->8---

Bye,
Tassilo





reply via email to

[Prev in Thread] Current Thread [Next in Thread]