Gnus development mailing list
 help / color / mirror / Atom feed
* [PATCH]: New gnus-parameters variable
@ 2004-01-01  2:08 Xavier Maillard
  2004-01-02 19:47 ` Lars Magne Ingebrigtsen
       [not found] ` <plop87d6a4e7z9.fsf-icAv0V0KtPVAfugRpC6u6w@public.gmane.org>
  0 siblings, 2 replies; 4+ messages in thread
From: Xavier Maillard @ 2004-01-01  2:08 UTC (permalink / 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 --]

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

end of thread, other threads:[~2004-01-05 22:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-01  2:08 [PATCH]: New gnus-parameters variable Xavier Maillard
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

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