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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Getting the right dictionary for e-mail and newsgroup messages


From: Cecil Westerhof
Subject: Getting the right dictionary for e-mail and newsgroup messages
Date: Fri, 25 Dec 2009 11:08:27 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.3 (gnu/linux)

At the moment I use two languages for my messages: Dutch and English. So
I need to have the dictionary to be set correctly. Therefore I wrote the
following code:
    (defvar gnus-dictionaries
      '(
        ("^nl\\.\\|\\.nl\\.\\|\\.nl$"  . "dutch")
        )
    "A list of group names and dictionaries to use.")

    (defun gnus-set-dictionary ()
      "Determine what dictionary to use based on the current message."
      (let ((dictionary))
        (if (message-news-p)
            (setq dictionary "british")
          (setq dictionary "dutch"))
        (dolist (item gnus-dictionaries)
          (when (string-match (car item) gnus-newsgroup-name)
            (setq dictionary (cdr item))))
        (ispell-change-dictionary dictionary)))

    (add-hook 'message-mode-hook 'gnus-set-dictionary)

Default e-mail is in Dutch and newsgroup messages in English. But
sometimes it could be that it is otherwise. For example Dutch newsgroups
wants Dutch Messages. That is why I use gnus-dictionaries to check
for an exception.

I only have one problem. At the moment I need to use:
    "^nl\\.\\|\\.nl\\.\\|\\.nl$" 
for the regular expression. I would prefer to use something like:
    "[\\.^]nl[\\.$]"

But that does not work. Is there another way to make the regular
expression simpler?

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof


reply via email to

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