Gnus development mailing list
 help / color / mirror / Atom feed
* Wrong customize type for the "Extra" score entry
@ 2007-09-03 19:14 Andreas Schwab
  2007-09-05  9:52 ` Katsumi Yamaoka
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Schwab @ 2007-09-03 19:14 UTC (permalink / raw)
  To: ding

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.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




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

* Re: Wrong customize type for the "Extra" score entry
  2007-09-03 19:14 Wrong customize type for the "Extra" score entry Andreas Schwab
@ 2007-09-05  9:52 ` Katsumi Yamaoka
  2007-09-05 11:17   ` Andreas Schwab
  0 siblings, 1 reply; 3+ messages in thread
From: Katsumi Yamaoka @ 2007-09-05  9:52 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: ding

[-- 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")

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

* Re: Wrong customize type for the "Extra" score entry
  2007-09-05  9:52 ` Katsumi Yamaoka
@ 2007-09-05 11:17   ` Andreas Schwab
  0 siblings, 0 replies; 3+ messages in thread
From: Andreas Schwab @ 2007-09-05 11:17 UTC (permalink / raw)
  To: Katsumi Yamaoka; +Cc: ding

Katsumi Yamaoka <yamaoka@jpl.org> writes:

>>>>>> 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:

Thanks, works fine.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



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

end of thread, other threads:[~2007-09-05 11:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-03 19:14 Wrong customize type for the "Extra" score entry Andreas Schwab
2007-09-05  9:52 ` Katsumi Yamaoka
2007-09-05 11:17   ` Andreas Schwab

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