Gnus development mailing list
 help / color / mirror / Atom feed
From: Xavier Maillard <zedek@gnu-rox.org>
Subject: [PATCH]: New gnus-parameters variable
Date: Thu, 01 Jan 2004 03:08:26 +0100	[thread overview]
Message-ID: <plop87d6a4e7z9.fsf@gnu-rox.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 2339 bytes --]

Hi and Happy new year !

Following an idea from Alex Schroeder[1], I have hacked something that
could be of interest for people (I guess ;)). As I said in another
post, I am not familiar (yet) to gnus internals and so, my "patch" is
actually some elisp I wrote separately.

What it does is quite simple, it adds a new gnus-parameters variable
(dictionary) which allow to enable flyspell with per-group dictionary.

That way, one can simply use it is to say something like this:

,----
| (setq gnus-parameters 
|       '(("list\\..*april.*" 
|          (dictionary . "francais"))
|         ("list.debian-user-french" 
|          (dictionary . "francais"))))
| 
| 
| (setq gnus-parameter-dictionary-alist
|       '(("ml.emacs.ding" . "american")))
`----

And whenever he enters those groups, and reply or post something, it
will launch flyspell with the right dictionary.

Here us my add-on:

,---- 
| (gnus-define-group-parameter
|  dictionary
|  :function-document
|  "Return the dictionary used for the current group (if any)."
|  :variable-document
|  "Alist of regexps (to match group names) and default dictionary to use when composing a new message."
|  :parameter-type '(string :tag "Dictionary")
|  :parameter-document "\
| The default dictionary to use in the group.")
| 
| 
| (gnus-setup-dictionary "list.debian-user-french")
| 
| (defun gnus-setup-dictionary (group)
|   "Decide wich dictionary to use for group `group`."
|   (let ((group (or group ""))
|         dictionary)
| 
|     (setq dictionary (gnus-parameter-dictionary group))
|     (message "Dictionary used: %s" dictionary)
| 
|     (when dictionary
|       (set (make-local-variable 'ispell-local-dictionary) dictionary))
|     ))
| 
| 
| (add-hook 'gnus-message-setup-hook
|           (lambda ()
|             (gnus-setup-dictionary 
|              (if (boundp 'gnus-newsgroup-name)
|                  gnus-newsgroup-name ""))))
`----

IMO, this code can be enhanced but it works already as-is so feel free
to use/copy/paste/modify/incorporate it in gnus. My work is 
licensed under the GNU General Public License and I also let my
copyrights go to the FSF (if needed).

Cheers,

zeDek

Footnotes: 
[1] http://www.emacswiki.org/cgi-bin/wiki.pl/GnusSpelling
-- 
Xavier MAILLARD (GnuPG: 1024D/1E028EA5)
EmacsOS user (http://emacsfr.org)
APRIL (http://www.april.org)


[-- Attachment #2: Type: application/pgp-signature, Size: 188 bytes --]

             reply	other threads:[~2004-01-01  2:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-01  2:08 Xavier Maillard [this message]
2004-01-02 19:47 ` Lars Magne Ingebrigtsen
2004-01-03  1:49   ` Xavier Maillard
     [not found] ` <plop87d6a4e7z9.fsf-icAv0V0KtPVAfugRpC6u6w@public.gmane.org>
2004-01-05 22:52   ` Jochen Küpper

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=plop87d6a4e7z9.fsf@gnu-rox.org \
    --to=zedek@gnu-rox.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).