Gnus development mailing list
 help / color / mirror / Atom feed
* Custom group or topic parameters
@ 2014-05-13 13:31 Alexander Baier
  2014-05-13 14:02 ` Peter Münster
  0 siblings, 1 reply; 5+ messages in thread
From: Alexander Baier @ 2014-05-13 13:31 UTC (permalink / raw)
  To: ding

[ I have sent this message before, but it does not seem to go through
despite the gmane authorizer telling me it "will be posted within ten
minutes".  So I am trying it again.]


Hello,

Is there a way to set custom group parameters? What do I mean by
"custom"? A custom group parameter would simply be parameter that is not
yet defined by gnus (e.g. foo is no documented group parameter).

The followup question to this: How do I access the group parameters in
message mode?  I want to do certain things based on the parameters of
the group I was "in" when I started to compose a new mail thus entering
message mode.

The concrete functionality I want to achieve is outlined by this
example:

Group Parameters for group "org.group.example":
#+BEGIN_SRC emacs-lisp
  ((subscribed . t)
   (to-list . "foo@example-list.org")
   (lang . "en_GB"))
#+END_SRC 

And then somewhere in a message-mode hook:
#+BEGIN_SRC emacs-lisp
  (ispell-change-dictionary (gnus-get-group-param 'lang))
#+END_SRC

Note, a function like "gnus-get-group-param" is what I was referring to
in the second paragraph.


Regards,
-- 
Alexander Baier




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

* Re: Custom group or topic parameters
  2014-05-13 13:31 Custom group or topic parameters Alexander Baier
@ 2014-05-13 14:02 ` Peter Münster
  2014-05-13 14:18   ` Alexander Baier
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Münster @ 2014-05-13 14:02 UTC (permalink / raw)
  To: ding

On Tue, May 13 2014, Alexander Baier wrote:

> Group Parameters for group "org.group.example":
> 
> #+BEGIN_SRC emacs-lisp
>   ((subscribed . t)
>    (to-list . "foo@example-list.org")
>    (lang . "en_GB"))
> #+END_SRC 

(defvar my-language "my-default-language")
(make-variable-buffer-local 'my-language)

(setq gnus-parameters
      '(("org.group.example"
         (subscribed . t)
         (to-list . "foo@example-list.org")
         (my-language "en_GB"))))           ; Without the dot here!


> #+BEGIN_SRC emacs-lisp
>   (ispell-change-dictionary (gnus-get-group-param 'lang))
> #+END_SRC

(ispell-change-dictionary my-language)


Or check out this page: http://www.emacswiki.org/emacs/AutoDictionaryMode

-- 
           Peter




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

* Re: Custom group or topic parameters
  2014-05-13 14:02 ` Peter Münster
@ 2014-05-13 14:18   ` Alexander Baier
  2014-05-13 14:50     ` Peter Münster
  0 siblings, 1 reply; 5+ messages in thread
From: Alexander Baier @ 2014-05-13 14:18 UTC (permalink / raw)
  To: ding

On 2014-05-13 16:02 Peter Münster wrote:
> On Tue, May 13 2014, Alexander Baier wrote:
> (defvar my-language "my-default-language")
> (make-variable-buffer-local 'my-language)
>
> (setq gnus-parameters
>       '(("org.group.example"
>          (subscribed . t)
>          (to-list . "foo@example-list.org")
>          (my-language "en_GB"))))           ; Without the dot here!
>
> (ispell-change-dictionary my-language)

So gnus or message-mode will set all variables in gnus-parameters given
as a two-element list?

> Or check out this page:
> http://www.emacswiki.org/emacs/AutoDictionaryMode

Thank you for this pointer! It solves the problem I was trying to solve
way more elegantly.

Thanks,
-- 
Alexander Baier




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

* Re: Custom group or topic parameters
  2014-05-13 14:18   ` Alexander Baier
@ 2014-05-13 14:50     ` Peter Münster
  2014-05-14 21:32       ` Alexander Baier
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Münster @ 2014-05-13 14:50 UTC (permalink / raw)
  To: ding

On Tue, May 13 2014, Alexander Baier wrote:

>> (setq gnus-parameters
>>       '(("org.group.example"
>>          (subscribed . t)
>>          (to-list . "foo@example-list.org")
>>          (my-language "en_GB"))))           ; Without the dot here!
>>
>> (ispell-change-dictionary my-language)
>
> So gnus or message-mode will set all variables in gnus-parameters given
> as a two-element list?

Yes, see also here: http://www.gnus.org/manual/gnus_28.html

Sorry, my example won't work in message-mode: the variable has the value
only in the summary buffer.

Here a work-around:

(setq gnus-parameters
      '(("org.group.example"
         (subscribed . t)
         (to-list . "foo@example-list.org")
         (my-language "en_GB")
         (posting-style (eval (setq my-language "en_GB"))))))

Another work-around is in the manual.

-- 
           Peter




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

* Re: Custom group or topic parameters
  2014-05-13 14:50     ` Peter Münster
@ 2014-05-14 21:32       ` Alexander Baier
  0 siblings, 0 replies; 5+ messages in thread
From: Alexander Baier @ 2014-05-14 21:32 UTC (permalink / raw)
  To: ding

On 2014-05-13 16:50 Peter Münster wrote:
> On Tue, May 13 2014, Alexander Baier wrote:
>
>>> (setq gnus-parameters
>>>       '(("org.group.example"
>>>          (subscribed . t)
>>>          (to-list . "foo@example-list.org")
>>>          (my-language "en_GB"))))           ; Without the dot here!
>>>
>>> (ispell-change-dictionary my-language)
>>
>> So gnus or message-mode will set all variables in gnus-parameters given
>> as a two-element list?
>
> Yes, see also here: http://www.gnus.org/manual/gnus_28.html
>
> Sorry, my example won't work in message-mode: the variable has the value
> only in the summary buffer.

I see.

> Here a work-around:
>
> (setq gnus-parameters
>       '(("org.group.example"
>          (subscribed . t)
>          (to-list . "foo@example-list.org")
>          (my-language "en_GB")
>          (posting-style (eval (setq my-language "en_GB"))))))

Ah, this is neat, thank you!

> Another work-around is in the manual.

I will have a look.

Regards,
-- 
Alexander Baier




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

end of thread, other threads:[~2014-05-14 21:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-13 13:31 Custom group or topic parameters Alexander Baier
2014-05-13 14:02 ` Peter Münster
2014-05-13 14:18   ` Alexander Baier
2014-05-13 14:50     ` Peter Münster
2014-05-14 21:32       ` Alexander Baier

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