Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
From: Tassilo Horn <tassilo@member.fsf.org>
To: info-gnus-english@gnu.org
Subject: Re: Changing ispell dictionary
Date: Fri, 10 Aug 2007 22:20:58 +0200	[thread overview]
Message-ID: <87vebn9m51.fsf@baldur.tsdh.de> (raw)
In-Reply-To: <87r6mbb25g.fsf@baldur.tsdh.de>

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. 

  reply	other threads:[~2007-08-10 20:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-10 14:51 Sven Joachim
2007-08-10 19:49 ` Tassilo Horn
2007-08-10 20:20   ` Tassilo Horn [this message]
2007-08-10 20:30   ` Reiner Steib
2007-08-10 21:09     ` Tassilo Horn
     [not found]     ` <mailman.4635.1186780214.32220.info-gnus-english@gnu.org>
2007-08-11 18:10       ` Sven Joachim
2007-08-11 18:59         ` Tassilo Horn
     [not found]   ` <mailman.4633.1186777273.32220.info-gnus-english@gnu.org>
2007-08-11 10:31     ` Hadron
2007-10-19 22:37 ` sven.bretfeld
2007-11-03 23:16   ` leandro noferini
2007-11-04 19:35     ` Sven Bretfeld
2007-11-05 16:17       ` leandro noferini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87vebn9m51.fsf@baldur.tsdh.de \
    --to=tassilo@member.fsf.org \
    --cc=info-gnus-english@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).