From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/56536 Path: main.gmane.org!not-for-mail From: sigurd@12move.de (=?iso-8859-1?q?Karl_Pfl=E4sterer?=) Newsgroups: gmane.emacs.gnus.general Subject: Bug in expansion of gnus-parametrs Date: Thu, 04 Mar 2004 01:53:35 +0100 Organization: Lemis World Sender: ding-owner@lists.math.uh.edu Message-ID: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1078361723 9059 80.91.224.253 (4 Mar 2004 00:55:23 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 4 Mar 2004 00:55:23 +0000 (UTC) Original-X-From: ding-owner+M5077=ding+2Daccount=gmane.org@lists.math.uh.edu Thu Mar 04 01:55:16 2004 Return-path: Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1Ayh8u-0003BD-00 for ; Thu, 04 Mar 2004 01:55:16 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by malifon.math.uh.edu with smtp (Exim 3.20 #1) id 1Ayh8t-00039c-02 for ding-account@gmane.org; Wed, 03 Mar 2004 18:55:15 -0600 Original-Received: from justine.libertine.org ([66.139.78.221] ident=postfix) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 1Ayh8l-00039U-00 for ding@lists.math.uh.edu; Wed, 03 Mar 2004 18:55:07 -0600 Original-Received: from quimby.gnus.org (quimby.gnus.org [80.91.224.244]) by justine.libertine.org (Postfix) with ESMTP id 9090D3A020E for ; Wed, 3 Mar 2004 18:55:06 -0600 (CST) Original-Received: from news by quimby.gnus.org with local (Exim 3.35 #1 (Debian)) id 1Ayh8k-0006T9-00 for ; Thu, 04 Mar 2004 01:55:06 +0100 Original-To: ding@gnus.org Original-Path: wintendo.pflaesterer.de!not-for-mail Original-Newsgroups: gnus.ding Original-Lines: 81 Original-NNTP-Posting-Host: p62.246.40.27.tisdip.tiscali.de Original-X-Trace: quimby.gnus.org 1078361705 24870 62.246.40.27 (4 Mar 2004 00:55:05 GMT) Original-X-Complaints-To: usenet@quimby.gnus.org Original-NNTP-Posting-Date: Thu, 4 Mar 2004 00:55:05 +0000 (UTC) X-Face: #iIcL\6>Qj/G*F@AL9T*v/R$j@7Q`6#FU&Flg6u6aVsLdWf(H$U5>:;&*>oy>jOIWgA%8w* A!V7X`\fEGoQ[@D'@i^*p3FCC6&Rg~JT/H_*MOX;"o~flADb8^ Mail-Copies-To: never User-Agent: Gnus/5.110002 (No Gnus v0.2) Hamster/2.0.4.0 Cancel-Lock: sha1:BUQ5t7702FHPYTwHCa+KFBLMXjY= Precedence: bulk Xref: main.gmane.org gmane.emacs.gnus.general:56536 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:56536 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)