Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
* Getting the right dictionary for e-mail and newsgroup messages
@ 2009-12-25 10:08 Cecil Westerhof
  2010-01-05 19:12 ` Ted Zlatanov
  0 siblings, 1 reply; 5+ messages in thread
From: Cecil Westerhof @ 2009-12-25 10:08 UTC (permalink / raw)
  To: info-gnus-english

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-01-06 15:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-25 10:08 Getting the right dictionary for e-mail and newsgroup messages Cecil Westerhof
2010-01-05 19:12 ` Ted Zlatanov
2010-01-05 20:47   ` Cecil Westerhof
2010-01-06 15:21     ` Ted Zlatanov
2010-01-06 15:47       ` Cecil Westerhof

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).