From: yamaoka Date: Sat, 11 Jan 2003 05:31:24 +0000 (+0000) Subject: Synch with Oort Gnus. X-Git-Tag: t-gnus-6_15_12-00-quimby~7 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=5f2cb826cc3c1a31302765225ec5dd76c20c7a10;p=elisp%2Fgnus.git- Synch with Oort Gnus. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d930374..995ce95 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,18 @@ +2003-01-10 Lars Magne Ingebrigtsen + + * gnus-cite.el (gnus-cite-delete-overlays): Protect against + errors when deleting overlays. + + * gnus-score.el (gnus-score-followup): Allow tracing. + + * gnus-art.el (gnus-treat-display-face): New variable. + (article-display-face): New command. + + * gnus-fun.el (gnus-face-from-file): New function. + (gnus-convert-face-to-png): Ditto. + + * gnus-art.el (gnus-ignored-headers): Added Face. + 2003-01-10 Simon Josefsson * nndraft.el (nndraft-request-group): Avoid crash in @@ -46,6 +61,13 @@ db parameter only if it's set (spam-ifile-register-with-ifile): ditto +2003-01-09 Alex Schroeder + + * spam-stat.el (spam-stat-save): Set spam-stat-ngood and + spam-stat-nbad before creating the hash table. + (spam-stat-reset): Set spam-stat-ngood and spam-stat-nbad to 0. + Changed copyright statement to FSF. + 2002-01-09 Kevin Greiner * gnus-agent.el (gnus-agent-catchup): Do not mark cached nor diff --git a/lisp/gnus-art.el b/lisp/gnus-art.el index 4e784ff..1853644 100644 --- a/lisp/gnus-art.el +++ b/lisp/gnus-art.el @@ -151,7 +151,7 @@ "^X-Request-PGP:" "^X-Fingerprint:" "^X-WRIEnvto:" "^X-WRIEnvfrom:" "^X-Virus-Scanned:" "^X-Delivery-Agent:" "^Posted-Date:" "^X-Gateway:" "^X-Local-Origin:" "^X-Local-Destination:" "^X-UserInfo1:" - "^X-Received-Date:" "^X-Hashcash:") + "^X-Received-Date:" "^X-Hashcash:" "^Face:") "*All headers that start with this regexp will be hidden. This variable can also be a list of regexps of headers to be ignored. If `gnus-visible-headers' is non-nil, this variable will be ignored." @@ -1224,6 +1224,24 @@ even if you are using Emacs 21+. It has no effect on XEmacs." "Internal variable used to say whether `smiley-mule' is loaded (whether smiley functions are not overridden by `smiley').") +(defcustom gnus-treat-display-face + (and (not noninteractive) + (or (and (fboundp 'image-type-available-p) + (image-type-available-p 'png)) + (and (featurep 'xemacs) + (featurep 'png))) + 'head) + "Display Face headers. +Valid values are nil, t, `head', `last', an integer or a predicate. +See Info node `(gnus)Customizing Articles' and Info node +`(gnus)X-Face' for details." + :group 'gnus-article-treat + :version "21.1" + :link '(custom-manual "(gnus)Customizing Articles") + :link '(custom-manual "(gnus)X-Face") + :type gnus-article-treat-head-custom) +(put 'gnus-treat-display-xface 'highlight t) + (defcustom gnus-treat-display-grey-xface (and (not noninteractive) (or (featurep 'xemacs) @@ -1433,6 +1451,7 @@ It is a string, such as \"PGP\". If nil, ask user." (gnus-treat-date-original gnus-article-date-original) (gnus-treat-date-user-defined gnus-article-date-user) (gnus-treat-date-iso8601 gnus-article-date-iso8601) + (gnus-treat-display-face gnus-article-display-face) (gnus-treat-hide-headers gnus-article-maybe-hide-headers) (gnus-treat-hide-boring-headers gnus-article-hide-boring-headers) (gnus-treat-hide-signature gnus-article-hide-signature) @@ -2044,6 +2063,28 @@ unfolded." (forward-line 1) (point)))))) +(defun article-display-face () + "Display any Face headers in the header." + (interactive) + (gnus-with-article-headers + (let ((face nil)) + (save-excursion + (when (gnus-buffer-live-p gnus-original-article-buffer) + (set-buffer gnus-original-article-buffer) + (setq face (message-fetch-field "face")))) + (when face + (let ((png (gnus-convert-face-to-png face)) + image) + (when png + (setq image (gnus-create-image png 'png t)) + (gnus-article-goto-header "from") + (when (bobp) + (insert "From: [no `from' set]\n") + (forward-char -17)) + (gnus-add-wash-type 'face) + (gnus-add-image 'face image) + (gnus-put-image image))))))) + (defun article-display-x-face (&optional force) "Look for an X-Face header and display it if present." (interactive (list 'force)) @@ -3527,6 +3568,7 @@ If variable `gnus-use-long-file-name' is non-nil, it is article-remove-cr article-remove-leading-whitespace article-display-x-face + article-display-face article-de-quoted-unreadable article-de-base64-unreadable article-decode-HZ diff --git a/lisp/gnus-cite.el b/lisp/gnus-cite.el index 927abba..ca999e0 100644 --- a/lisp/gnus-cite.el +++ b/lisp/gnus-cite.el @@ -672,7 +672,8 @@ See also the documentation for `gnus-article-highlight-citation'." (and (>= (gnus-overlay-end overlay) (point-min)) (<= (gnus-overlay-end overlay) (point-max)))) (setq gnus-cite-overlay-list (delete overlay gnus-cite-overlay-list)) - (gnus-delete-overlay overlay)))) + (ignore-errors + (gnus-delete-overlay overlay))))) (defun gnus-cite-parse-wrapper () ;; Wrap chopped gnus-cite-parse. diff --git a/lisp/gnus-fun.el b/lisp/gnus-fun.el index fa2b54f..1ee48ce 100644 --- a/lisp/gnus-fun.el +++ b/lisp/gnus-fun.el @@ -40,6 +40,11 @@ :group 'gnus-fun :type 'string) +(defcustom gnus-convert-image-to-face-command "djpeg %s | ppmnorm | pnmscale -width 48 -height 48 | ppmquant %d | pnmtopng" + "Command for converting a GIF to an X-Face." + :group 'gnus-fun + :type 'string) + (defun gnus-shell-command-to-string (command) "Like `shell-command-to-string' except not mingling ERROR." (with-output-to-string @@ -74,6 +79,45 @@ Output to the current buffer, replace text, and don't mingle error." (format gnus-convert-image-to-x-face-command (shell-quote-argument file))))) +(defun gnus-face-from-file (file) + "Return an Face header based on an image file." + (interactive "fImage file name:" ) + (when (file-exists-p file) + (let ((done nil) + (attempt "") + (quant 16)) + (while (and (not done) + (> quant 1)) + (setq attempt + (gnus-shell-command-to-string + (format gnus-convert-image-to-face-command + (shell-quote-argument file) + quant))) + (if (> (length attempt) 740) + (progn + (setq quant (- quant 2)) + (message "Length %d; trying quant %d" + (length attempt) quant)) + (setq done t))) + (if done + (mm-with-unibyte-buffer + (insert attempt) + (base64-encode-region (point-min) (point-max)) + (goto-char (point-min)) + (forward-line 1) + (while (not (eobp)) + (insert " ") + (forward-line 1)) + (buffer-string)) + nil)))) + +;;;###autoload +(defun gnus-convert-face-to-png (face) + (mm-with-unibyte-buffer + (insert face) + (base64-decode-region (point-min) (point-max)) + (buffer-string))) + (defun gnus-convert-image-to-gray-x-face (file depth) (let* ((mapfile (mm-make-temp-file (expand-file-name "gnus." mm-tmp-directory))) diff --git a/lisp/gnus-score.el b/lisp/gnus-score.el index f3582ac..087871e 100644 --- a/lisp/gnus-score.el +++ b/lisp/gnus-score.el @@ -1866,6 +1866,11 @@ score in `gnus-newsgroup-scored' by SCORE." ;; Found a match, update scores. (while (setq art (pop arts)) (setcdr art (+ score (cdr art))) + (when trace + (push (cons + (car-safe (rassq alist gnus-score-cache)) + kill) + gnus-score-trace)) (when (setq new (gnus-score-add-followups (car art) score all-scores thread)) (push new news))))) diff --git a/lisp/gnus.el b/lisp/gnus.el index cf7bdbd..db2405d 100644 --- a/lisp/gnus.el +++ b/lisp/gnus.el @@ -2388,7 +2388,8 @@ gnus-newsrc-hashtb should be kept so that both hold the same information.") ("gnus-demon" :interactive t gnus-demon-init gnus-demon-cancel) ("gnus-fun" gnus-convert-gray-x-face-to-xpm gnus-display-x-face-in-from - gnus-convert-image-to-gray-x-face) + gnus-convert-image-to-gray-x-face gnus-convert-face-to-png + gnus-face-from-file) ("gnus-salt" gnus-highlight-selected-tree gnus-possibly-generate-tree gnus-tree-open gnus-tree-close gnus-carpal-setup-buffer) ("gnus-nocem" gnus-nocem-scan-groups gnus-nocem-close diff --git a/texi/ChangeLog b/texi/ChangeLog index 59b835b..3f686d8 100644 --- a/texi/ChangeLog +++ b/texi/ChangeLog @@ -1,3 +1,10 @@ +2003-01-10 Alex Schroeder + + * gnus.texi (Creating a spam-stat dictionary): Explain how using + the Gnus Agent with nnimap might work to do this. + (Splitting mail using spam-stat): Use nnimap-split-fancy if you + use the nnimap back end. + 2003-01-10 Katsumi Yamaoka * gnus.texi (Filtering Spam Using spam.el): Trivial fix. diff --git a/texi/gnus-ja.texi b/texi/gnus-ja.texi index 1e91529..b53dcdf 100644 --- a/texi/gnus-ja.texi +++ b/texi/gnus-ja.texi @@ -21468,6 +21468,12 @@ nnml バックエンドは一通のメールにつき一つのファイルで、すべてのメールを 常 @samp{nnml:mail.misc} グループに対応) に対し て @code{spam-stat-process-non-spam-directory} を呼ぶでしょう。 +あなたが IMAP を使っているならメールをローカルには持っていないので、それ +は動かないでしょう。一つの解決策は、gnus エージェントで記事をキャッシュ +することです。そうすれば @code{spam-stat-process-spam-directory} とし +て @file{"~/News/agent/nnimap/mail.yourisp.com/personal_spam"} のような +ものが使えます。@xref{Agent as Cache}。 + @defvar spam-stat この変数はすべての統計のハッシュテーブル -- 我々が辞書と言っているも の -- を持ちます。このハッシュテーブルは、双方のコレクションのすべての単 @@ -21515,9 +21521,13 @@ nnml バックエンドは一通のメールにつき一つのファイルで、すべてのメールを これは必要な gnus のコードとあなたが作った辞書を load します。 次に、特級分割の規則を適合させる必要があります: どうやっ -て @code{spam-stat} を使うかを決めて下さい。で -は @samp{mail.misc} と @samp{mail.spam} の二つのグループだけがある最も単 -純な事例ではどうなるか。以下の式はメールが spam であるか、またはそれ +て @code{spam-stat} を使うかを決めて下さい。以下の例は nnml バックエンド +用です。nnimap バックエンドでもまったく同様に動作します。単 +に @code{nnmail-split-fancy} の代わりに @code{nnimap-split-fancy} を使っ +て下さい。 + +では @samp{mail.misc} と @samp{mail.spam} の二つのグループだけがある最も +単純な事例ではどうなるか。以下の式はメールが spam であるか、またはそれ が @samp{mail.misc} に行くべきだと言っています。もし spam だった ら @code{spam-stat-split-fancy} は @samp{mail.spam} を返します。 diff --git a/texi/gnus.texi b/texi/gnus.texi index 8162bb0..a6abec7 100644 --- a/texi/gnus.texi +++ b/texi/gnus.texi @@ -21939,6 +21939,12 @@ the the group @samp{nnml:mail.spam}), and you would call @file{~/Mail/mail/misc} (this usually corresponds the the group @samp{nnml:mail.misc}). +When you are using IMAP, you won't have the mails available locally, +so that will not work. One solution is to use the Gnus Agent to cache +the articles. Then you can use directories such as +@file{"~/News/agent/nnimap/mail.yourisp.com/personal_spam"} for +@code{spam-stat-process-spam-directory}. @xref{Agent as Cache}. + @defvar spam-stat This variable holds the hash-table with all the statistics -- the dictionary we have been talking about. For every word in either @@ -21989,10 +21995,14 @@ This will load the necessary Gnus code, and the dictionary you created. Next, you need to adapt your fancy splitting rules: You need to -determine how to use @code{spam-stat}. In the simplest case, you only have -two groups, @samp{mail.misc} and @samp{mail.spam}. The following expression says -that mail is either spam or it should go into @samp{mail.misc}. If it is -spam, then @code{spam-stat-split-fancy} will return @samp{mail.spam}. +determine how to use @code{spam-stat}. The following examples are for +the nnml back end. Using the nnimap back end works just as well. Just +use @code{nnimap-split-fancy} instead of @code{nnmail-split-fancy}. + +In the simplest case, you only have two groups, @samp{mail.misc} and +@samp{mail.spam}. The following expression says that mail is either +spam or it should go into @samp{mail.misc}. If it is spam, then +@code{spam-stat-split-fancy} will return @samp{mail.spam}. @example (setq nnmail-split-fancy