From: sigurd@12move.de (Karl Pflästerer)
Subject: Bug in expansion of gnus-parametrs
Date: Thu, 04 Mar 2004 01:53:35 +0100 [thread overview]
Message-ID: <m3d67t1mek.fsf@hamster.pflaesterer.de> (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)
next reply other threads:[~2004-03-04 0:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-03-04 0:53 Karl Pflästerer [this message]
2004-05-16 14:56 ` Lars Magne Ingebrigtsen
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=m3d67t1mek.fsf@hamster.pflaesterer.de \
--to=sigurd@12move.de \
/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).