Gnus development mailing list
 help / color / mirror / Atom feed
* Bug in expansion of gnus-parametrs
@ 2004-03-04  0:53 Karl Pflästerer
  2004-05-16 14:56 ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 2+ messages in thread
From: Karl Pflästerer @ 2004-03-04  0:53 UTC (permalink / raw)


Hi,
I played a bit with gnus-paramters and found a bug (or very odd
behaviour).  The docs say (info://gnus/Group+Parameters)

     (setq gnus-parameters
           '(("mail\\..*"
              (gnus-show-threads nil)
              (gnus-use-scoring nil)
              (gnus-summary-line-format
               "%U%R%z%I%(%[%d:%ub%-23,23f%]%) %s\n")
              ^^^^^^^^^^^^^^^^^^^
              (gcc-self . t)
              (display . all))
     
             ("^nnimap:\\(foo.bar\\)$"
              (to-group . "\\1"))
              ^^^^^^^^^^^^^^

Here's the first not really logic point: we have proper and improper
lists, where the car of the list is a variable we want to set and the
c(a)d)r a string.  There's no explaination why we have these
differences.  Then I tried that my own.

I created a custom variable `foo' and defined the `gnus-parameters:

        (setq gnus-parameters
                '(("^nnml\\(.*\\)"
                   (foo   "abc-\\1-def")
                   (gnus-use-cache nil)
                   (posting-style
                    (signature foo)))))

I added `foo' to `gnus-newsgroup-variables' so its expansion could be
seen also in the message buffer.  But it didn't work.  Then I tried the
expansion functions.

(gnus-expand-group-parameters "^nnml\\(.*\\)" '((foo  "abc-\\1-def") (gnus-use-cache nil)) "nnml.private")
=> ((gnus-use-cache nil) (foo "abc-\\1-def"))

So that seemed to be the wrong format.  let's try an improper list.

(gnus-expand-group-parameters "^nnml\\(.*\\)" '((foo . "abc-\\1-def") (gnus-use-cache nil)) "nnml.private")
=> ((gnus-use-cache nil) (foo "abc-.private-def"))

That looks better, but it does not yet work.

        (defun gnus-expand-group-parameters (match parameters group)
          "Go through PARAMETERS and expand them according to the match data."
          (let (new)
            (dolist (elem parameters)
              (if (and (stringp (cdr elem))
                       (string-match "\\\\[0-9&]" (cdr elem)))
                  (push (cons (car elem)
                         ^^^^
                              (gnus-expand-group-parameter match (cdr elem) group))
                        new)
                (push elem new)))
            new))


Now we see why the string in the proper list did not get expanded; the
function looks in the cdr of the list.  So an improper list seems to be
correct.  But now the weird behaviour: to assign the value of the
expanded string to the var in the car of the list we need a proper list.
So I changed the marked `cons' in the above function to a `list' and I
had the right functionality; the value got assigned and the signature
had the value of the var.


So is it safe to change the `cons' to a `list'?  Are proper or improper
lists the right for vars that hold strings?  At the moment I can't say
what's right.



   KP

-- 
"Programs must be written for people to read, and only incidentally
for machines to execute."
                -- Abelson & Sussman, SICP (preface to the first edition)



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

* Re: Bug in expansion of gnus-parametrs
  2004-03-04  0:53 Bug in expansion of gnus-parametrs Karl Pflästerer
@ 2004-05-16 14:56 ` Lars Magne Ingebrigtsen
  0 siblings, 0 replies; 2+ messages in thread
From: Lars Magne Ingebrigtsen @ 2004-05-16 14:56 UTC (permalink / raw)


sigurd@12move.de (Karl Pflästerer) writes:

> So is it safe to change the `cons' to a `list'?  Are proper or improper
> lists the right for vars that hold strings?  At the moment I can't say
> what's right.

Improper lists are for parameters, while proper lists are for
variables.  Which leads to problems for parameters that really are
lists, which is why the [...] syntax was introduced.

Anyway, I'm not quite sure I follow you here.  :-)

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen




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

end of thread, other threads:[~2004-05-16 14:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-04  0:53 Bug in expansion of gnus-parametrs Karl Pflästerer
2004-05-16 14:56 ` Lars Magne Ingebrigtsen

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