Gnus development mailing list
 help / color / mirror / Atom feed
From: Katsumi Yamaoka <yamaoka@jpl.org>
To: Andreas Schwab <schwab@suse.de>
Cc: ding@gnus.org
Subject: Re: Wrong customize type for the "Extra" score entry
Date: Wed, 05 Sep 2007 18:52:58 +0900	[thread overview]
Message-ID: <b4mir6p781x.fsf@jpl.org> (raw)
In-Reply-To: <m2642r8ste.fsf@igel.home>

[-- Attachment #1: Type: text/plain, Size: 541 bytes --]

>>>>> Andreas Schwab wrote:

> The score rule for extra headers is a five element element list (the
> fifth being the actual extra header to match against), unlike the other
> string keys.  But the customize type for the "Extra" entry is the same
> (gnus-score-string) as for the other keys, thus it will not match, and
> you cannot enter such a score entry via customize, and any existing
> entry is presented as a lisp expression.

I've installed a fix in the Gnus trunk and the v5-10 branch.
Here's a patch for No Gnus 0.6 that you use:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 2482 bytes --]

--- gnus-cus.el~	2007-01-24 07:15:37 +0000
+++ gnus-cus.el	2007-09-05 09:47:02 +0000
@@ -766,6 +766,67 @@
 				       ,group))))
   widget)
 
+(define-widget 'gnus-score-extra 'group
+  "Edit score entries for extra headers."
+  :convert-widget 'gnus-score-extra-convert)
+
+(defun gnus-score-extra-convert (widget)
+  ;; Set args appropriately.
+  (let* ((tag (widget-get widget :tag))
+	 (item `(const :format "" :value ,(downcase tag)))
+	 (match '(string :tag "Match"))
+	 (score '(choice :tag "Score"
+			 (const :tag "default" nil)
+			 (integer :format "%v"
+				  :hide-front-space t)))
+	 (expire '(choice :tag "Expire"
+			  (const :tag "off" nil)
+			  (integer :format "%v"
+				   :hide-front-space t)))
+	 (type '(choice :tag "Type"
+			:value s
+			;; I should really create a forgiving :match
+			;; function for each type below, that only
+			;; looked at the first letter.
+			(const :tag "Regexp" r)
+			(const :tag "Regexp (fixed case)" R)
+			(const :tag "Substring" s)
+			(const :tag "Substring (fixed case)" S)
+			(const :tag "Exact" e)
+			(const :tag "Exact (fixed case)" E)
+			(const :tag "Word" w)
+			(const :tag "Word (fixed case)" W)
+			(const :tag "default" nil)))
+	 (header (if gnus-extra-headers
+		     (let (name)
+		       `(choice :tag "Header"
+				,@(mapcar (lambda (h)
+					    (setq name (symbol-name h))
+					    (list 'const :tag name name))
+					  gnus-extra-headers)
+				(string :tag "Other" :format "%v")))
+		   '(string :tag "Header")))
+	 (group `(group ,match ,score ,expire ,type ,header))
+	 (doc (concat (or (widget-get widget :doc)
+			  (concat "Change score based on the " tag
+				  " header.\n")))))
+    (widget-put
+     widget :args
+     `(,item
+       (repeat :inline t
+	       :indent 0
+	       :tag ,tag
+	       :doc ,doc
+	       :format "%t:\n%h%v%i\n\n"
+	       (choice :format "%v"
+		       :value ("" nil nil s
+			       ,(if gnus-extra-headers
+				    (symbol-name (car gnus-extra-headers))
+				  ""))
+		       ,group
+		       sexp)))))
+  widget)
+
 (defvar gnus-custom-scores)
 (defvar gnus-custom-score-alist)
 
@@ -822,7 +883,7 @@
 				     (gnus-score-string :tag "Subject")
 				     (gnus-score-string :tag "References")
 				     (gnus-score-string :tag "Xref")
-				     (gnus-score-string :tag "Extra")
+				     (gnus-score-extra :tag "Extra")
 				     (gnus-score-string :tag "Message-ID")
 				     (gnus-score-integer :tag "Lines")
 				     (gnus-score-integer :tag "Chars")

  reply	other threads:[~2007-09-05  9:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-03 19:14 Andreas Schwab
2007-09-05  9:52 ` Katsumi Yamaoka [this message]
2007-09-05 11:17   ` Andreas Schwab

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=b4mir6p781x.fsf@jpl.org \
    --to=yamaoka@jpl.org \
    --cc=ding@gnus.org \
    --cc=schwab@suse.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).