* trouble with gnus-define-group-parameter
@ 2003-03-10 18:19 Ted Zlatanov
2003-03-11 20:25 ` Kevin Greiner
0 siblings, 1 reply; 5+ messages in thread
From: Ted Zlatanov @ 2003-03-10 18:19 UTC (permalink / raw)
I'm defining these two group parameters:
(gnus-define-group-parameter
ham-marks
:parameter-type '(choice :tag "Ham marks"
:value nil
(list :tag "Ham mark choices"
(set
(variable-item gnus-del-mark)
(variable-item gnus-read-mark)
(variable-item gnus-killed-mark)
(variable-item gnus-kill-file-mark)
(variable-item gnus-low-score-mark))))
:parameter-document
"Marks considered ham (positively not spam). Such articles will be
processed as ham (non-spam) on group exit. When nil, the global
spam-ham-marks variable takes precedence.")
(gnus-define-group-parameter
spam-marks
:parameter-type '(choice :tag "Spam marks"
:value nil
(list :tag "Spam mark choices"
(set
(variable-item gnus-spam-mark)
(variable-item gnus-killed-mark)
(variable-item gnus-kill-file-mark)
(variable-item gnus-low-score-mark))))
:parameter-document
"Marks considered spam.
Such articles will be processed as spam on group exit. When nil, the global
spam-spam-marks variable takes precedence."))
I can customize the parameter just fine, but then
(gnus-parameter-ham-marks gnus-newsgroup-name)
returns nil no matter what. Anyone with a clue as to what I'm doing wrong?
Thanks
Ted
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: trouble with gnus-define-group-parameter
2003-03-10 18:19 trouble with gnus-define-group-parameter Ted Zlatanov
@ 2003-03-11 20:25 ` Kevin Greiner
2003-03-19 22:55 ` Ted Zlatanov
0 siblings, 1 reply; 5+ messages in thread
From: Kevin Greiner @ 2003-03-11 20:25 UTC (permalink / raw)
Ted Zlatanov <tzz@lifelogs.com> writes:
> I'm defining these two group parameters:
>
> (gnus-define-group-parameter
> ham-marks
> :parameter-type '(choice :tag "Ham marks"
> :value nil
> (list :tag "Ham mark choices"
> (set
> (variable-item gnus-del-mark)
> (variable-item gnus-read-mark)
> (variable-item gnus-killed-mark)
> (variable-item gnus-kill-file-mark)
> (variable-item gnus-low-score-mark))))
>
> :parameter-document
> "Marks considered ham (positively not spam). Such articles will be
> processed as ham (non-spam) on group exit. When nil, the global
> spam-ham-marks variable takes precedence.")
>
> (gnus-define-group-parameter
> spam-marks
> :parameter-type '(choice :tag "Spam marks"
> :value nil
> (list :tag "Spam mark choices"
> (set
> (variable-item gnus-spam-mark)
> (variable-item gnus-killed-mark)
> (variable-item gnus-kill-file-mark)
> (variable-item gnus-low-score-mark))))
>
> :parameter-document
> "Marks considered spam.
> Such articles will be processed as spam on group exit. When nil, the global
> spam-spam-marks variable takes precedence."))
>
> I can customize the parameter just fine, but then
>
> (gnus-parameter-ham-marks gnus-newsgroup-name)
>
> returns nil no matter what. Anyone with a clue as to what I'm doing wrong?
Not really. The gnus-define-group-parameter macro expanded to include
this definition for ham-marks. Perhaps you can eval it then step
through it with the debugger.
(defun gnus-parameter-ham-marks (name)
""
(and name
(or (gnus-group-find-parameter name (quote ham-marks) nil)
(let ((alist gnus-parameter-ham-marks-alist) elem value)
(while (setq elem (pop alist))
(when (and name (string-match (car elem) name))
(setq alist nil value (cdr elem))))
(if (consp value)
(car value)
value)))))
Kevin
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: trouble with gnus-define-group-parameter
2003-03-11 20:25 ` Kevin Greiner
@ 2003-03-19 22:55 ` Ted Zlatanov
2003-03-20 4:11 ` Kevin Greiner
0 siblings, 1 reply; 5+ messages in thread
From: Ted Zlatanov @ 2003-03-19 22:55 UTC (permalink / raw)
Cc: ding
On Tue, 11 Mar 2003, kgreiner@xpediantsolutions.com wrote:
> Not really. The gnus-define-group-parameter macro expanded to
> include this definition for ham-marks. Perhaps you can eval it then
> step through it with the debugger.
>
> (defun gnus-parameter-ham-marks (name)
> ""
> (and name
> (or (gnus-group-find-parameter name (quote ham-marks) nil)
> (let ((alist gnus-parameter-ham-marks-alist) elem value)
> (while (setq elem (pop alist))
> (when (and name (string-match (car elem) name))
> (setq alist nil value (cdr elem))))
> (if (consp value)
> (car value)
> value)))))
Out of curiosity, how did you obtain this macro expansion?
The problem is this line:
> (or (gnus-group-find-parameter name (quote ham-marks) nil)
The allow-list parameter is nil. When it's t, I get the parameter
correctly. I was not setting the :type parameter to 'list. But it
had worked just fine for all my previous parameter definitions.
Puzzling.
I think I have things working, I'll do a commit with the fixed and
revised code.
Ted
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: trouble with gnus-define-group-parameter
2003-03-19 22:55 ` Ted Zlatanov
@ 2003-03-20 4:11 ` Kevin Greiner
2003-03-20 4:45 ` Jesper Harder
0 siblings, 1 reply; 5+ messages in thread
From: Kevin Greiner @ 2003-03-20 4:11 UTC (permalink / raw)
Ted Zlatanov <tzz@lifelogs.com> writes:
> On Tue, 11 Mar 2003, kgreiner@xpediantsolutions.com wrote:
>> Not really. The gnus-define-group-parameter macro expanded to
>> include this definition for ham-marks. Perhaps you can eval it then
>> step through it with the debugger.
>>
>> (defun gnus-parameter-ham-marks (name)
>> ""
>> (and name
>> (or (gnus-group-find-parameter name (quote ham-marks) nil)
>> (let ((alist gnus-parameter-ham-marks-alist) elem value)
>> (while (setq elem (pop alist))
>> (when (and name (string-match (car elem) name))
>> (setq alist nil value (cdr elem))))
>> (if (consp value)
>> (car value)
>> value)))))
>
> Out of curiosity, how did you obtain this macro expansion?
Well, I'm sure that there is a better way but...
I eval'd this:
(progn (debug)
(gnus-define-group-parameter
ham-marks
:parameter-type '(choice :tag "Ham marks"
:value nil
(list :tag "Ham mark choices"
(set
(variable-item gnus-del-mark)
(variable-item gnus-read-mark)
(variable-item gnus-killed-mark)
(variable-item gnus-kill-file-mark)
(variable-item gnus-low-score-mark))))
:parameter-document
"Marks considered ham (positively not spam). Such articles will be
processed as ham (non-spam) on group exit. When nil, the global
spam-ham-marks variable takes precedence."))
If you step over the macro expansion, you see a return value that is
the expanded form. Normally, that gets executed so it is hidden.
Since you're in the debugger, you can cut-and-paste it to another
buffer for detailed reflection.
> The problem is this line:
>
>> (or (gnus-group-find-parameter name (quote ham-marks) nil)
>
> The allow-list parameter is nil. When it's t, I get the parameter
> correctly. I was not setting the :type parameter to 'list. But it
> had worked just fine for all my previous parameter definitions.
> Puzzling.
>
> I think I have things working, I'll do a commit with the fixed and
> revised code.
Glad to see it working.
Kevin
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: trouble with gnus-define-group-parameter
2003-03-20 4:11 ` Kevin Greiner
@ 2003-03-20 4:45 ` Jesper Harder
0 siblings, 0 replies; 5+ messages in thread
From: Jesper Harder @ 2003-03-20 4:45 UTC (permalink / raw)
Kevin Greiner <kgreiner@xpediantsolutions.com> writes:
> Ted Zlatanov <tzz@lifelogs.com> writes:
>
>> Out of curiosity, how did you obtain this macro expansion?
>
> Well, I'm sure that there is a better way but...
The better way is `macroexpand' :-) And optionally `pp' to prettyprint
it as well. E.g.
(pp (macroexpand
'(gnus-define-group-parameter
[...])))
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2003-03-20 4:45 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-10 18:19 trouble with gnus-define-group-parameter Ted Zlatanov
2003-03-11 20:25 ` Kevin Greiner
2003-03-19 22:55 ` Ted Zlatanov
2003-03-20 4:11 ` Kevin Greiner
2003-03-20 4:45 ` Jesper Harder
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).