diff options
| author | Lars Magne Ingebrigtsen | 2010-09-02 00:28:01 +0000 |
|---|---|---|
| committer | Katsumi Yamaoka | 2010-09-02 00:28:01 +0000 |
| commit | f736244589204741532ab6a0f9a9ebf324d5dbde (patch) | |
| tree | c87f0453ace8895d129c283c1d4a24298a5ab11a | |
| parent | d743e0d118ef6a5d0312226e1da5b87173c752a3 (diff) | |
| download | emacs-f736244589204741532ab6a0f9a9ebf324d5dbde.tar.gz emacs-f736244589204741532ab6a0f9a9ebf324d5dbde.zip | |
Remove nndb, nnkiboze and related code.
| -rw-r--r-- | doc/misc/gnus.texi | 74 | ||||
| -rw-r--r-- | lisp/gnus/ChangeLog | 4 | ||||
| -rw-r--r-- | lisp/gnus/gnus-group.el | 38 | ||||
| -rw-r--r-- | lisp/gnus/gnus.el | 1 | ||||
| -rw-r--r-- | lisp/gnus/nndb.el | 325 | ||||
| -rw-r--r-- | lisp/gnus/nnir.el | 8 | ||||
| -rw-r--r-- | lisp/gnus/nnkiboze.el | 391 |
7 files changed, 11 insertions, 830 deletions
diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index 7cce8d139f6..783a785bb70 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi | |||
| @@ -721,7 +721,6 @@ Document Groups | |||
| 721 | Combined Groups | 721 | Combined Groups |
| 722 | 722 | ||
| 723 | * Virtual Groups:: Combining articles from many groups. | 723 | * Virtual Groups:: Combining articles from many groups. |
| 724 | * Kibozed Groups:: Looking through parts of the newsfeed for articles. | ||
| 725 | 724 | ||
| 726 | Email Based Diary | 725 | Email Based Diary |
| 727 | 726 | ||
| @@ -2624,15 +2623,6 @@ default a group pointing to the most recent articles will be created | |||
| 2624 | (@code{gnus-group-recent-archive-directory}), but given a prefix, a full | 2623 | (@code{gnus-group-recent-archive-directory}), but given a prefix, a full |
| 2625 | group will be created from @code{gnus-group-archive-directory}. | 2624 | group will be created from @code{gnus-group-archive-directory}. |
| 2626 | 2625 | ||
| 2627 | @item G k | ||
| 2628 | @kindex G k (Group) | ||
| 2629 | @findex gnus-group-make-kiboze-group | ||
| 2630 | @cindex nnkiboze | ||
| 2631 | Make a kiboze group. You will be prompted for a name, for a regexp to | ||
| 2632 | match groups to be ``included'' in the kiboze group, and a series of | ||
| 2633 | strings to match on headers (@code{gnus-group-make-kiboze-group}). | ||
| 2634 | @xref{Kibozed Groups}. | ||
| 2635 | |||
| 2636 | @item G D | 2626 | @item G D |
| 2637 | @kindex G D (Group) | 2627 | @kindex G D (Group) |
| 2638 | @findex gnus-group-enter-directory | 2628 | @findex gnus-group-enter-directory |
| @@ -4420,8 +4410,7 @@ which point to the ``real'' message files (if mbox is used, copies are | |||
| 4420 | made). Since mairix already presents search results in such a virtual | 4410 | made). Since mairix already presents search results in such a virtual |
| 4421 | mail folder, it is very well suited for using it as an external program | 4411 | mail folder, it is very well suited for using it as an external program |
| 4422 | for creating @emph{smart} mail folders, which represent certain mail | 4412 | for creating @emph{smart} mail folders, which represent certain mail |
| 4423 | searches. This is similar to a Kiboze group (@pxref{Kibozed Groups}), | 4413 | searches. |
| 4424 | but much faster. | ||
| 4425 | 4414 | ||
| 4426 | @node nnmairix requirements | 4415 | @node nnmairix requirements |
| 4427 | @subsubsection nnmairix requirements | 4416 | @subsubsection nnmairix requirements |
| @@ -18933,7 +18922,6 @@ groups. | |||
| 18933 | 18922 | ||
| 18934 | @menu | 18923 | @menu |
| 18935 | * Virtual Groups:: Combining articles from many groups. | 18924 | * Virtual Groups:: Combining articles from many groups. |
| 18936 | * Kibozed Groups:: Looking through parts of the newsfeed for articles. | ||
| 18937 | @end menu | 18925 | @end menu |
| 18938 | 18926 | ||
| 18939 | 18927 | ||
| @@ -19023,58 +19011,6 @@ from component groups---group parameters, for instance, are not | |||
| 19023 | inherited. | 19011 | inherited. |
| 19024 | 19012 | ||
| 19025 | 19013 | ||
| 19026 | @node Kibozed Groups | ||
| 19027 | @subsection Kibozed Groups | ||
| 19028 | @cindex nnkiboze | ||
| 19029 | @cindex kibozing | ||
| 19030 | |||
| 19031 | @dfn{Kibozing} is defined by the @acronym{OED} as ``grepping through | ||
| 19032 | (parts of) the news feed''. @code{nnkiboze} is a back end that will | ||
| 19033 | do this for you. Oh joy! Now you can grind any @acronym{NNTP} server | ||
| 19034 | down to a halt with useless requests! Oh happiness! | ||
| 19035 | |||
| 19036 | @kindex G k (Group) | ||
| 19037 | To create a kibozed group, use the @kbd{G k} command in the group | ||
| 19038 | buffer. | ||
| 19039 | |||
| 19040 | The address field of the @code{nnkiboze} method is, as with | ||
| 19041 | @code{nnvirtual}, a regexp to match groups to be ``included'' in the | ||
| 19042 | @code{nnkiboze} group. That's where most similarities between | ||
| 19043 | @code{nnkiboze} and @code{nnvirtual} end. | ||
| 19044 | |||
| 19045 | In addition to this regexp detailing component groups, an | ||
| 19046 | @code{nnkiboze} group must have a score file to say what articles are | ||
| 19047 | to be included in the group (@pxref{Scoring}). | ||
| 19048 | |||
| 19049 | @kindex M-x nnkiboze-generate-groups | ||
| 19050 | @findex nnkiboze-generate-groups | ||
| 19051 | You must run @kbd{M-x nnkiboze-generate-groups} after creating the | ||
| 19052 | @code{nnkiboze} groups you want to have. This command will take time. | ||
| 19053 | Lots of time. Oodles and oodles of time. Gnus has to fetch the | ||
| 19054 | headers from all the articles in all the component groups and run them | ||
| 19055 | through the scoring process to determine if there are any articles in | ||
| 19056 | the groups that are to be part of the @code{nnkiboze} groups. | ||
| 19057 | |||
| 19058 | Please limit the number of component groups by using restrictive | ||
| 19059 | regexps. Otherwise your sysadmin may become annoyed with you, and the | ||
| 19060 | @acronym{NNTP} site may throw you off and never let you back in again. | ||
| 19061 | Stranger things have happened. | ||
| 19062 | |||
| 19063 | @code{nnkiboze} component groups do not have to be alive---they can be dead, | ||
| 19064 | and they can be foreign. No restrictions. | ||
| 19065 | |||
| 19066 | @vindex nnkiboze-directory | ||
| 19067 | The generation of an @code{nnkiboze} group means writing two files in | ||
| 19068 | @code{nnkiboze-directory}, which is @file{~/News/kiboze/} by default. | ||
| 19069 | One contains the @acronym{NOV} header lines for all the articles in | ||
| 19070 | the group, and the other is an additional @file{.newsrc} file to store | ||
| 19071 | information on what groups have been searched through to find | ||
| 19072 | component articles. | ||
| 19073 | |||
| 19074 | Articles marked as read in the @code{nnkiboze} group will have | ||
| 19075 | their @acronym{NOV} lines removed from the @acronym{NOV} file. | ||
| 19076 | |||
| 19077 | |||
| 19078 | @node Email Based Diary | 19014 | @node Email Based Diary |
| 19079 | @section Email Based Diary | 19015 | @section Email Based Diary |
| 19080 | @cindex diary | 19016 | @cindex diary |
| @@ -27423,10 +27359,6 @@ You can set the process mark on both groups and articles and perform | |||
| 27423 | operations on all the marked items (@pxref{Process/Prefix}). | 27359 | operations on all the marked items (@pxref{Process/Prefix}). |
| 27424 | 27360 | ||
| 27425 | @item | 27361 | @item |
| 27426 | You can grep through a subset of groups and create a group from the | ||
| 27427 | results (@pxref{Kibozed Groups}). | ||
| 27428 | |||
| 27429 | @item | ||
| 27430 | You can list subsets of groups according to, well, anything | 27362 | You can list subsets of groups according to, well, anything |
| 27431 | (@pxref{Listing Groups}). | 27363 | (@pxref{Listing Groups}). |
| 27432 | 27364 | ||
| @@ -29134,8 +29066,8 @@ As the variables for the other back ends, there are | |||
| 29134 | @code{nnfolder-nov-is-evil}, @code{nnimap-nov-is-evil}, | 29066 | @code{nnfolder-nov-is-evil}, @code{nnimap-nov-is-evil}, |
| 29135 | @code{nnml-nov-is-evil}, and @code{nnspool-nov-is-evil}. Note that a | 29067 | @code{nnml-nov-is-evil}, and @code{nnspool-nov-is-evil}. Note that a |
| 29136 | non-@code{nil} value for @code{gnus-nov-is-evil} overrides all those | 29068 | non-@code{nil} value for @code{gnus-nov-is-evil} overrides all those |
| 29137 | variables.@footnote{Although the back ends @code{nnkiboze}, and | 29069 | variables.@footnote{Although the back end @code{nnwfm} doesn't have |
| 29138 | @code{nnwfm} don't have their own nn*-nov-is-evil.} | 29070 | its own nn*-nov-is-evil.} |
| 29139 | @end table | 29071 | @end table |
| 29140 | 29072 | ||
| 29141 | 29073 | ||
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 1ca717a01eb..0993d93ddbe 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog | |||
| @@ -5,6 +5,10 @@ | |||
| 5 | 5 | ||
| 6 | 2010-09-01 Lars Magne Ingebrigtsen <larsi@gnus.org> | 6 | 2010-09-01 Lars Magne Ingebrigtsen <larsi@gnus.org> |
| 7 | 7 | ||
| 8 | * nnkiboze.el: Removed. | ||
| 9 | |||
| 10 | * nndb.el: Removed. | ||
| 11 | |||
| 8 | * gnus-html.el (gnus-html-put-image): Use the deleted text as the image | 12 | * gnus-html.el (gnus-html-put-image): Use the deleted text as the image |
| 9 | alt text. | 13 | alt text. |
| 10 | (gnus-html-rescale-image): Try to get the rescaling logic right for | 14 | (gnus-html-rescale-image): Try to get the rescaling logic right for |
diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el index b12d76b4618..b59407d1302 100644 --- a/lisp/gnus/gnus-group.el +++ b/lisp/gnus/gnus-group.el | |||
| @@ -660,7 +660,6 @@ simple manner.") | |||
| 660 | "h" gnus-group-make-help-group | 660 | "h" gnus-group-make-help-group |
| 661 | "u" gnus-group-make-useful-group | 661 | "u" gnus-group-make-useful-group |
| 662 | "a" gnus-group-make-archive-group | 662 | "a" gnus-group-make-archive-group |
| 663 | "k" gnus-group-make-kiboze-group | ||
| 664 | "l" gnus-group-nnimap-edit-acl | 663 | "l" gnus-group-nnimap-edit-acl |
| 665 | "m" gnus-group-make-group | 664 | "m" gnus-group-make-group |
| 666 | "E" gnus-group-edit-group | 665 | "E" gnus-group-edit-group |
| @@ -931,7 +930,6 @@ simple manner.") | |||
| 931 | ["Add the archive group" gnus-group-make-archive-group t] | 930 | ["Add the archive group" gnus-group-make-archive-group t] |
| 932 | ["Make a doc group..." gnus-group-make-doc-group t] | 931 | ["Make a doc group..." gnus-group-make-doc-group t] |
| 933 | ["Make a web group..." gnus-group-make-web-group t] | 932 | ["Make a web group..." gnus-group-make-web-group t] |
| 934 | ["Make a kiboze group..." gnus-group-make-kiboze-group t] | ||
| 935 | ["Make a virtual group..." gnus-group-make-empty-virtual t] | 933 | ["Make a virtual group..." gnus-group-make-empty-virtual t] |
| 936 | ["Add a group to a virtual..." gnus-group-add-to-virtual t] | 934 | ["Add a group to a virtual..." gnus-group-add-to-virtual t] |
| 937 | ["Make an ephemeral group..." gnus-group-read-ephemeral-group t] | 935 | ["Make an ephemeral group..." gnus-group-read-ephemeral-group t] |
| @@ -982,7 +980,6 @@ simple manner.") | |||
| 982 | ["Browse foreign server..." gnus-group-browse-foreign-server t] | 980 | ["Browse foreign server..." gnus-group-browse-foreign-server t] |
| 983 | ["Enter server buffer" gnus-group-enter-server-mode t] | 981 | ["Enter server buffer" gnus-group-enter-server-mode t] |
| 984 | ["Expire all expirable articles" gnus-group-expire-all-groups t] | 982 | ["Expire all expirable articles" gnus-group-expire-all-groups t] |
| 985 | ["Generate any kiboze groups" nnkiboze-generate-groups t] | ||
| 986 | ["Gnus version" gnus-version t] | 983 | ["Gnus version" gnus-version t] |
| 987 | ["Save .newsrc files" gnus-group-save-newsrc t] | 984 | ["Save .newsrc files" gnus-group-save-newsrc t] |
| 988 | ["Suspend Gnus" gnus-group-suspend t] | 985 | ["Suspend Gnus" gnus-group-suspend t] |
| @@ -3116,41 +3113,6 @@ mail messages or news articles in files that have numeric names." | |||
| 3116 | (gnus-group-real-name group) | 3113 | (gnus-group-real-name group) |
| 3117 | (list 'nndir (gnus-group-real-name group) (list 'nndir-directory dir))))) | 3114 | (list 'nndir (gnus-group-real-name group) (list 'nndir-directory dir))))) |
| 3118 | 3115 | ||
| 3119 | (defvar nnkiboze-score-file) | ||
| 3120 | (declare-function nnkiboze-score-file "nnkiboze" (group)) | ||
| 3121 | |||
| 3122 | (defun gnus-group-make-kiboze-group (group address scores) | ||
| 3123 | "Create an nnkiboze group. | ||
| 3124 | The user will be prompted for a name, a regexp to match groups, and | ||
| 3125 | score file entries for articles to include in the group." | ||
| 3126 | (interactive | ||
| 3127 | (list | ||
| 3128 | (read-string "nnkiboze group name: ") | ||
| 3129 | (read-string "Source groups (regexp): ") | ||
| 3130 | (let ((headers (mapcar 'list | ||
| 3131 | '("subject" "from" "number" "date" "message-id" | ||
| 3132 | "references" "chars" "lines" "xref" | ||
| 3133 | "followup" "all" "body" "head"))) | ||
| 3134 | scores header regexp regexps) | ||
| 3135 | (while (not (equal "" (setq header (completing-read | ||
| 3136 | "Match on header: " headers nil t)))) | ||
| 3137 | (setq regexps nil) | ||
| 3138 | (while (not (equal "" (setq regexp (read-string | ||
| 3139 | (format "Match on %s (regexp): " | ||
| 3140 | header))))) | ||
| 3141 | (push (list regexp nil nil 'r) regexps)) | ||
| 3142 | (push (cons header regexps) scores)) | ||
| 3143 | scores))) | ||
| 3144 | (gnus-group-make-group group "nnkiboze" address) | ||
| 3145 | (let* ((nnkiboze-current-group group) | ||
| 3146 | (score-file (car (nnkiboze-score-file ""))) | ||
| 3147 | (score-dir (file-name-directory score-file))) | ||
| 3148 | (unless (file-exists-p score-dir) | ||
| 3149 | (make-directory score-dir)) | ||
| 3150 | (with-temp-file score-file | ||
| 3151 | (let (emacs-lisp-mode-hook) | ||
| 3152 | (gnus-pp scores))))) | ||
| 3153 | |||
| 3154 | (defun gnus-group-add-to-virtual (n vgroup) | 3116 | (defun gnus-group-add-to-virtual (n vgroup) |
| 3155 | "Add the current group to a virtual group." | 3117 | "Add the current group to a virtual group." |
| 3156 | (interactive | 3118 | (interactive |
diff --git a/lisp/gnus/gnus.el b/lisp/gnus/gnus.el index 25c1bc44296..6ce133c2fb7 100644 --- a/lisp/gnus/gnus.el +++ b/lisp/gnus/gnus.el | |||
| @@ -1740,7 +1740,6 @@ slower." | |||
| 1740 | ("nneething" none address prompt-address physical-address) | 1740 | ("nneething" none address prompt-address physical-address) |
| 1741 | ("nndoc" none address prompt-address) | 1741 | ("nndoc" none address prompt-address) |
| 1742 | ("nnbabyl" mail address respool) | 1742 | ("nnbabyl" mail address respool) |
| 1743 | ("nnkiboze" post virtual) | ||
| 1744 | ("nndraft" post-mail) | 1743 | ("nndraft" post-mail) |
| 1745 | ("nnfolder" mail respool address) | 1744 | ("nnfolder" mail respool address) |
| 1746 | ("nngateway" post-mail address prompt-address physical-address) | 1745 | ("nngateway" post-mail address prompt-address physical-address) |
diff --git a/lisp/gnus/nndb.el b/lisp/gnus/nndb.el deleted file mode 100644 index 2ba7f2901a6..00000000000 --- a/lisp/gnus/nndb.el +++ /dev/null | |||
| @@ -1,325 +0,0 @@ | |||
| 1 | ;;; nndb.el --- nndb access for Gnus | ||
| 2 | |||
| 3 | ;; Copyright (C) 1997, 1998, 2000, 2002, 2003, 2004, 2005, 2006, 2007, | ||
| 4 | ;; 2008, 2009, 2010 Free Software Foundation, Inc. | ||
| 5 | |||
| 6 | ;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet> | ||
| 7 | ;; Kai Grossjohann <grossjohann@ls6.informatik.uni-dortmund.de> | ||
| 8 | ;; Joe Hildebrand <joe.hildebrand@ilg.com> | ||
| 9 | ;; David Blacka <davidb@rwhois.net> | ||
| 10 | ;; Keywords: news | ||
| 11 | |||
| 12 | ;; This file is part of GNU Emacs. | ||
| 13 | |||
| 14 | ;; GNU Emacs is free software: you can redistribute it and/or modify | ||
| 15 | ;; it under the terms of the GNU General Public License as published by | ||
| 16 | ;; the Free Software Foundation, either version 3 of the License, or | ||
| 17 | ;; (at your option) any later version. | ||
| 18 | |||
| 19 | ;; GNU Emacs is distributed in the hope that it will be useful, | ||
| 20 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 21 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 22 | ;; GNU General Public License for more details. | ||
| 23 | |||
| 24 | ;; You should have received a copy of the GNU General Public License | ||
| 25 | ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | ||
| 26 | |||
| 27 | ;;; Commentary: | ||
| 28 | |||
| 29 | ;;; This was based upon Kai Grossjohan's shamessly snarfed code and | ||
| 30 | ;;; further modified by Joe Hildebrand. It has been updated for Red | ||
| 31 | ;;; Gnus. | ||
| 32 | |||
| 33 | ;; TODO: | ||
| 34 | ;; | ||
| 35 | ;; * Fix bug where server connection can be lost and impossible to regain | ||
| 36 | ;; This hasn't happened to me in a while; think it was fixed in Rgnus | ||
| 37 | ;; | ||
| 38 | ;; * make it handle different nndb servers seemlessly | ||
| 39 | ;; | ||
| 40 | ;; * Optimize expire if FORCE | ||
| 41 | ;; | ||
| 42 | ;; * Optimize move (only expire once) | ||
| 43 | ;; | ||
| 44 | ;; * Deal with add/deletion of groups | ||
| 45 | ;; | ||
| 46 | ;; * make the backend TOUCH an article when marked as expireable (will | ||
| 47 | ;; make article expire 'expiry' days after that moment). | ||
| 48 | |||
| 49 | ;;; Code: | ||
| 50 | |||
| 51 | ;; For Emacs < 22.2. | ||
| 52 | (eval-and-compile | ||
| 53 | (unless (fboundp 'declare-function) (defmacro declare-function (&rest r)))) | ||
| 54 | |||
| 55 | ;;- | ||
| 56 | ;; Register nndb with known select methods. | ||
| 57 | |||
| 58 | (require 'gnus-start) | ||
| 59 | (unless (assoc "nndb" gnus-valid-select-methods) | ||
| 60 | (gnus-declare-backend "nndb" 'mail 'respool 'address 'prompt-address)) | ||
| 61 | |||
| 62 | (require 'nnmail) | ||
| 63 | (require 'nnheader) | ||
| 64 | (require 'nntp) | ||
| 65 | (eval-when-compile (require 'cl)) | ||
| 66 | |||
| 67 | ;; Declare nndb as derived from nntp | ||
| 68 | |||
| 69 | (nnoo-declare nndb nntp) | ||
| 70 | |||
| 71 | ;; Variables specific to nndb | ||
| 72 | |||
| 73 | ;;- currently not used but just in case... | ||
| 74 | (defvoo nndb-deliver-program "nndel" | ||
| 75 | "*The program used to put a message in an NNDB group.") | ||
| 76 | |||
| 77 | (defvoo nndb-server-side-expiry nil | ||
| 78 | "If t, expiry calculation will occur on the server side.") | ||
| 79 | |||
| 80 | (defvoo nndb-set-expire-date-on-mark nil | ||
| 81 | "If t, the expiry date for a given article will be set to the time | ||
| 82 | it was marked as expireable; otherwise the date will be the time the | ||
| 83 | article was posted to nndb") | ||
| 84 | |||
| 85 | ;; Variables copied from nntp | ||
| 86 | |||
| 87 | (defvoo nndb-server-opened-hook '(nntp-send-authinfo-from-file) | ||
| 88 | "Like nntp-server-opened-hook." | ||
| 89 | nntp-server-opened-hook) | ||
| 90 | |||
| 91 | (defvoo nndb-address "localhost" | ||
| 92 | "*The name of the NNDB server." | ||
| 93 | nntp-address) | ||
| 94 | |||
| 95 | (defvoo nndb-port-number 9000 | ||
| 96 | "*Port number to connect to." | ||
| 97 | nntp-port-number) | ||
| 98 | |||
| 99 | ;; change to 'news if you are actually using nndb for news | ||
| 100 | (defvoo nndb-article-type 'mail) | ||
| 101 | |||
| 102 | (defvoo nndb-status-string nil "" nntp-status-string) | ||
| 103 | |||
| 104 | |||
| 105 | |||
| 106 | (defconst nndb-version "nndb 0.7" | ||
| 107 | "Version numbers of this version of NNDB.") | ||
| 108 | |||
| 109 | |||
| 110 | ;;; Interface functions. | ||
| 111 | |||
| 112 | (nnoo-define-basics nndb) | ||
| 113 | |||
| 114 | ;;------------------------------------------------------------------ | ||
| 115 | |||
| 116 | ;; this function turns the lisp list into a string list. There is | ||
| 117 | ;; probably a more efficient way to do this. | ||
| 118 | (defun nndb-build-article-string (articles) | ||
| 119 | (let (art-string art) | ||
| 120 | (while articles | ||
| 121 | (setq art (pop articles)) | ||
| 122 | (setq art-string (concat art-string art " "))) | ||
| 123 | art-string)) | ||
| 124 | |||
| 125 | (defun nndb-build-expire-rest-list (total expire) | ||
| 126 | (let (art rest) | ||
| 127 | (while total | ||
| 128 | (setq art (pop total)) | ||
| 129 | (if (memq art expire) | ||
| 130 | () | ||
| 131 | (push art rest))) | ||
| 132 | rest)) | ||
| 133 | |||
| 134 | |||
| 135 | ;; | ||
| 136 | (deffoo nndb-request-type (group &optional article) | ||
| 137 | nndb-article-type) | ||
| 138 | |||
| 139 | ;; nndb-request-update-info does not exist and is not needed | ||
| 140 | |||
| 141 | ;; nndb-request-update-mark does not exist; it should be used to TOUCH | ||
| 142 | ;; articles as they are marked exipirable | ||
| 143 | (defun nndb-touch-article (group article) | ||
| 144 | (nntp-send-command nil "X-TOUCH" article)) | ||
| 145 | |||
| 146 | (deffoo nndb-request-update-mark | ||
| 147 | (group article mark) | ||
| 148 | "Sets the expiry date for ARTICLE in GROUP to now, if the mark is 'E'" | ||
| 149 | (if (and nndb-set-expire-date-on-mark (string-equal mark "E")) | ||
| 150 | (nndb-touch-article group article)) | ||
| 151 | mark) | ||
| 152 | |||
| 153 | ;; nndb-request-create-group -- currently this isn't necessary; nndb | ||
| 154 | ;; creates groups on demand. | ||
| 155 | |||
| 156 | ;; todo -- use some other time than the creation time of the article | ||
| 157 | ;; best is time since article has been marked as expirable | ||
| 158 | |||
| 159 | (defun nndb-request-expire-articles-local | ||
| 160 | (articles &optional group server force) | ||
| 161 | "Let gnus do the date check and issue the delete commands." | ||
| 162 | (let (msg art delete-list (num-delete 0) rest) | ||
| 163 | (nntp-possibly-change-group group server) | ||
| 164 | (while articles | ||
| 165 | (setq art (pop articles)) | ||
| 166 | (nntp-send-command "^\\([23]\\|^423\\).*\n" "X-DATE" art) | ||
| 167 | (setq msg (nndb-status-message)) | ||
| 168 | (if (string-match "^423" msg) | ||
| 169 | () | ||
| 170 | (or (string-match "'\\(.+\\)'" msg) | ||
| 171 | (error "Not a valid response for X-DATE command: %s" | ||
| 172 | msg)) | ||
| 173 | (if (nnmail-expired-article-p | ||
| 174 | group | ||
| 175 | (date-to-time (substring msg (match-beginning 1) (match-end 1))) | ||
| 176 | force) | ||
| 177 | (progn | ||
| 178 | (setq delete-list (concat delete-list " " (int-to-string art))) | ||
| 179 | (setq num-delete (1+ num-delete))) | ||
| 180 | (push art rest)))) | ||
| 181 | (if (> (length delete-list) 0) | ||
| 182 | (progn | ||
| 183 | (nnheader-message 5 "Deleting %s article(s) from %s" | ||
| 184 | (int-to-string num-delete) group) | ||
| 185 | (nntp-send-command "^[23].*\n" "X-DELETE" delete-list)) | ||
| 186 | ) | ||
| 187 | |||
| 188 | (nnheader-message 5 "") | ||
| 189 | (nconc rest articles))) | ||
| 190 | |||
| 191 | (defun nndb-get-remote-expire-response () | ||
| 192 | (let (list) | ||
| 193 | (set-buffer nntp-server-buffer) | ||
| 194 | (goto-char (point-min)) | ||
| 195 | (if (looking-at "^[34]") | ||
| 196 | ;; x-expire returned error--presume no articles were expirable) | ||
| 197 | (setq list nil) | ||
| 198 | ;; otherwise, pull all of the following numbers into the list | ||
| 199 | (re-search-forward "follows\r?\n?" nil t) | ||
| 200 | (while (re-search-forward "^[0-9]+$" nil t) | ||
| 201 | (push (string-to-number (match-string 0)) list))) | ||
| 202 | list)) | ||
| 203 | |||
| 204 | (defun nndb-request-expire-articles-remote | ||
| 205 | (articles &optional group server force) | ||
| 206 | "Let the nndb backend expire articles" | ||
| 207 | (let (days art-string delete-list (num-delete 0)) | ||
| 208 | (nntp-possibly-change-group group server) | ||
| 209 | |||
| 210 | ;; first calculate the wait period in days | ||
| 211 | (setq days (or (and nnmail-expiry-wait-function | ||
| 212 | (funcall nnmail-expiry-wait-function group)) | ||
| 213 | nnmail-expiry-wait)) | ||
| 214 | ;; now handle the special cases | ||
| 215 | (cond (force | ||
| 216 | (setq days 0)) | ||
| 217 | ((eq days 'never) | ||
| 218 | ;; This isn't an expirable group. | ||
| 219 | (setq days -1)) | ||
| 220 | ((eq days 'immediate) | ||
| 221 | (setq days 0))) | ||
| 222 | |||
| 223 | |||
| 224 | ;; build article string | ||
| 225 | (setq art-string (concat days " " (nndb-build-article-string articles))) | ||
| 226 | (nntp-send-command "^\.\r?\n\\|^[345].*\n" "X-EXPIRE" art-string) | ||
| 227 | |||
| 228 | (setq delete-list (nndb-get-remote-expire-response)) | ||
| 229 | (setq num-delete (length delete-list)) | ||
| 230 | (if (> num-delete 0) | ||
| 231 | (nnheader-message 5 "Deleting %s article(s) from %s" | ||
| 232 | (int-to-string num-delete) group)) | ||
| 233 | |||
| 234 | (nndb-build-expire-rest-list articles delete-list))) | ||
| 235 | |||
| 236 | (deffoo nndb-request-expire-articles | ||
| 237 | (articles &optional group server force) | ||
| 238 | "Expires ARTICLES from GROUP on SERVER. | ||
| 239 | If FORCE, delete regardless of exiration date, otherwise use normal | ||
| 240 | expiry mechanism." | ||
| 241 | (if nndb-server-side-expiry | ||
| 242 | (nndb-request-expire-articles-remote articles group server force) | ||
| 243 | (nndb-request-expire-articles-local articles group server force))) | ||
| 244 | |||
| 245 | ;; _Something_ defines it... | ||
| 246 | (declare-function nndb-request-article "nndb" t t) | ||
| 247 | |||
| 248 | (deffoo nndb-request-move-article | ||
| 249 | (article group server accept-form &optional last move-is-internal) | ||
| 250 | "Move ARTICLE (a number) from GROUP on SERVER. | ||
| 251 | Evals ACCEPT-FORM in current buffer, where the article is. | ||
| 252 | Optional LAST is ignored." | ||
| 253 | ;; we guess that the second arg in accept-form is the new group, | ||
| 254 | ;; which it will be for nndb, which is all that matters anyway | ||
| 255 | (let ((new-group (nth 1 accept-form)) result) | ||
| 256 | (nntp-possibly-change-group group server) | ||
| 257 | |||
| 258 | ;; use the move command for nndb-to-nndb moves | ||
| 259 | (if (string-match "^nndb" new-group) | ||
| 260 | (let ((new-group-name (gnus-group-real-name new-group))) | ||
| 261 | (nntp-send-command "^[23].*\n" "X-MOVE" article new-group-name) | ||
| 262 | (cons new-group article)) | ||
| 263 | ;; else move normally | ||
| 264 | (let ((artbuf (get-buffer-create " *nndb move*"))) | ||
| 265 | (and | ||
| 266 | (nndb-request-article article group server artbuf) | ||
| 267 | (save-excursion | ||
| 268 | (set-buffer artbuf) | ||
| 269 | (insert-buffer-substring nntp-server-buffer) | ||
| 270 | (setq result (eval accept-form)) | ||
| 271 | (kill-buffer (current-buffer)) | ||
| 272 | result) | ||
| 273 | (nndb-request-expire-articles (list article) | ||
| 274 | group | ||
| 275 | server | ||
| 276 | t)) | ||
| 277 | result) | ||
| 278 | ))) | ||
| 279 | |||
| 280 | (deffoo nndb-request-accept-article (group server &optional last) | ||
| 281 | "The article in the current buffer is put into GROUP." | ||
| 282 | (nntp-possibly-change-group group server) | ||
| 283 | (let (art msg) | ||
| 284 | (when (nntp-send-command "^[23].*\r?\n" "ACCEPT" group) | ||
| 285 | (nnheader-insert "") | ||
| 286 | (nntp-send-buffer "^[23].*\n")) | ||
| 287 | |||
| 288 | (set-buffer nntp-server-buffer) | ||
| 289 | (setq msg (buffer-string)) | ||
| 290 | (or (string-match "^\\([0-9]+\\)" msg) | ||
| 291 | (error "nndb: %s" msg)) | ||
| 292 | (setq art (substring msg (match-beginning 1) (match-end 1))) | ||
| 293 | (nnheader-message 5 "nndb: accepted %s" art) | ||
| 294 | (list art))) | ||
| 295 | |||
| 296 | (deffoo nndb-request-replace-article (article group buffer) | ||
| 297 | "ARTICLE is the number of the article in GROUP to be replaced with the contents of the BUFFER." | ||
| 298 | (set-buffer buffer) | ||
| 299 | (when (nntp-send-command "^[23].*\r?\n" "X-REPLACE" (int-to-string article)) | ||
| 300 | (nnheader-insert "") | ||
| 301 | (nntp-send-buffer "^[23.*\n") | ||
| 302 | (list (int-to-string article)))) | ||
| 303 | |||
| 304 | ; nndb-request-delete-group does not exist | ||
| 305 | ; todo -- maybe later | ||
| 306 | |||
| 307 | ; nndb-request-rename-group does not exist | ||
| 308 | ; todo -- maybe later | ||
| 309 | |||
| 310 | ;; -- standard compatibility functions | ||
| 311 | |||
| 312 | (deffoo nndb-status-message (&optional server) | ||
| 313 | "Return server status as a string." | ||
| 314 | (set-buffer nntp-server-buffer) | ||
| 315 | (buffer-string)) | ||
| 316 | |||
| 317 | ;; Import stuff from nntp | ||
| 318 | |||
| 319 | (nnoo-import nndb | ||
| 320 | (nntp)) | ||
| 321 | |||
| 322 | (provide 'nndb) | ||
| 323 | |||
| 324 | ;; arch-tag: 83bd6fb4-58d9-4fed-a901-c6c625ad5f8a | ||
| 325 | ;;; nndb.el ends here | ||
diff --git a/lisp/gnus/nnir.el b/lisp/gnus/nnir.el index c14d9a1b6aa..f348a13795f 100644 --- a/lisp/gnus/nnir.el +++ b/lisp/gnus/nnir.el | |||
| @@ -263,10 +263,10 @@ | |||
| 263 | 263 | ||
| 264 | ;; I have tried to make the code expandable. Basically, it is divided | 264 | ;; I have tried to make the code expandable. Basically, it is divided |
| 265 | ;; into two layers. The upper layer is somewhat like the `nnvirtual' | 265 | ;; into two layers. The upper layer is somewhat like the `nnvirtual' |
| 266 | ;; or `nnkiboze' backends: given a specification of what articles to | 266 | ;; backend: given a specification of what articles to show from |
| 267 | ;; show from another backend, it creates a group containing exactly | 267 | ;; another backend, it creates a group containing exactly those |
| 268 | ;; those articles. The lower layer issues a query to a search engine | 268 | ;; articles. The lower layer issues a query to a search engine and |
| 269 | ;; and produces such a specification of what articles to show from the | 269 | ;; produces such a specification of what articles to show from the |
| 270 | ;; other backend. | 270 | ;; other backend. |
| 271 | 271 | ||
| 272 | ;; The interface between the two layers consists of the single | 272 | ;; The interface between the two layers consists of the single |
diff --git a/lisp/gnus/nnkiboze.el b/lisp/gnus/nnkiboze.el deleted file mode 100644 index 17a10e66191..00000000000 --- a/lisp/gnus/nnkiboze.el +++ /dev/null | |||
| @@ -1,391 +0,0 @@ | |||
| 1 | ;;; nnkiboze.el --- select virtual news access for Gnus | ||
| 2 | |||
| 3 | ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, | ||
| 4 | ;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. | ||
| 5 | |||
| 6 | ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org> | ||
| 7 | ;; Keywords: news | ||
| 8 | |||
| 9 | ;; This file is part of GNU Emacs. | ||
| 10 | |||
| 11 | ;; GNU Emacs is free software: you can redistribute it and/or modify | ||
| 12 | ;; it under the terms of the GNU General Public License as published by | ||
| 13 | ;; the Free Software Foundation, either version 3 of the License, or | ||
| 14 | ;; (at your option) any later version. | ||
| 15 | |||
| 16 | ;; GNU Emacs is distributed in the hope that it will be useful, | ||
| 17 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 18 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 19 | ;; GNU General Public License for more details. | ||
| 20 | |||
| 21 | ;; You should have received a copy of the GNU General Public License | ||
| 22 | ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | ||
| 23 | |||
| 24 | ;;; Commentary: | ||
| 25 | |||
| 26 | ;; The other access methods (nntp, nnspool, etc) are general news | ||
| 27 | ;; access methods. This module relies on Gnus and can't be used | ||
| 28 | ;; separately. | ||
| 29 | |||
| 30 | ;;; Code: | ||
| 31 | |||
| 32 | (require 'nntp) | ||
| 33 | (require 'nnheader) | ||
| 34 | (require 'gnus) | ||
| 35 | (require 'gnus-score) | ||
| 36 | (require 'nnoo) | ||
| 37 | (require 'mm-util) | ||
| 38 | (eval-when-compile (require 'cl)) | ||
| 39 | |||
| 40 | (nnoo-declare nnkiboze) | ||
| 41 | (defvoo nnkiboze-directory (nnheader-concat gnus-directory "kiboze/") | ||
| 42 | "nnkiboze will put its files in this directory.") | ||
| 43 | |||
| 44 | (defvoo nnkiboze-level 9 | ||
| 45 | "The maximum level to be searched for articles.") | ||
| 46 | |||
| 47 | (defvoo nnkiboze-remove-read-articles t | ||
| 48 | "If non-nil, nnkiboze will remove read articles from the kiboze group.") | ||
| 49 | |||
| 50 | (defvoo nnkiboze-ephemeral nil | ||
| 51 | "If non-nil, don't store any data anywhere.") | ||
| 52 | |||
| 53 | (defvoo nnkiboze-scores nil | ||
| 54 | "Score rules for generating the nnkiboze group.") | ||
| 55 | |||
| 56 | (defvoo nnkiboze-regexp nil | ||
| 57 | "Regexp for matching component groups.") | ||
| 58 | |||
| 59 | (defvoo nnkiboze-file-coding-system mm-text-coding-system | ||
| 60 | "Coding system for nnkiboze files.") | ||
| 61 | |||
| 62 | |||
| 63 | |||
| 64 | (defconst nnkiboze-version "nnkiboze 1.0") | ||
| 65 | |||
| 66 | (defvoo nnkiboze-current-group nil) | ||
| 67 | (defvoo nnkiboze-status-string "") | ||
| 68 | |||
| 69 | (defvoo nnkiboze-headers nil) | ||
| 70 | |||
| 71 | |||
| 72 | |||
| 73 | ;;; Interface functions. | ||
| 74 | |||
| 75 | (nnoo-define-basics nnkiboze) | ||
| 76 | |||
| 77 | (deffoo nnkiboze-retrieve-headers (articles &optional group server fetch-old) | ||
| 78 | (nnkiboze-possibly-change-group group) | ||
| 79 | (unless gnus-nov-is-evil | ||
| 80 | (if (stringp (car articles)) | ||
| 81 | 'headers | ||
| 82 | (let ((nov (nnkiboze-nov-file-name))) | ||
| 83 | (when (file-exists-p nov) | ||
| 84 | (save-excursion | ||
| 85 | (set-buffer nntp-server-buffer) | ||
| 86 | (erase-buffer) | ||
| 87 | (let ((nnheader-file-coding-system nnkiboze-file-coding-system)) | ||
| 88 | (nnheader-insert-file-contents nov)) | ||
| 89 | (nnheader-nov-delete-outside-range | ||
| 90 | (car articles) (car (last articles))) | ||
| 91 | 'nov)))))) | ||
| 92 | |||
| 93 | (deffoo nnkiboze-request-article (article &optional newsgroup server buffer) | ||
| 94 | (nnkiboze-possibly-change-group newsgroup) | ||
| 95 | (if (not (numberp article)) | ||
| 96 | ;; This is a real kludge. It might not work at times, but it | ||
| 97 | ;; does no harm I think. The only alternative is to offer no | ||
| 98 | ;; article fetching by message-id at all. | ||
| 99 | (nntp-request-article article newsgroup gnus-nntp-server buffer) | ||
| 100 | (let* ((header (gnus-summary-article-header article)) | ||
| 101 | (xref (mail-header-xref header)) | ||
| 102 | num group) | ||
| 103 | (unless xref | ||
| 104 | (error "nnkiboze: No xref")) | ||
| 105 | (unless (string-match " \\([^ ]+\\):\\([0-9]+\\)" xref) | ||
| 106 | (error "nnkiboze: Malformed xref")) | ||
| 107 | (setq num (string-to-number (match-string 2 xref)) | ||
| 108 | group (match-string 1 xref)) | ||
| 109 | (or (with-current-buffer buffer | ||
| 110 | (or (and gnus-use-cache (gnus-cache-request-article num group)) | ||
| 111 | (gnus-agent-request-article num group))) | ||
| 112 | (gnus-request-article num group buffer))))) | ||
| 113 | |||
| 114 | (deffoo nnkiboze-request-scan (&optional group server) | ||
| 115 | (nnkiboze-possibly-change-group group) | ||
| 116 | (nnkiboze-generate-group (concat "nnkiboze:" group))) | ||
| 117 | |||
| 118 | (deffoo nnkiboze-request-group (group &optional server dont-check) | ||
| 119 | "Make GROUP the current newsgroup." | ||
| 120 | (nnkiboze-possibly-change-group group) | ||
| 121 | (if dont-check | ||
| 122 | t | ||
| 123 | (let ((nov-file (nnkiboze-nov-file-name)) | ||
| 124 | beg end total) | ||
| 125 | (save-excursion | ||
| 126 | (set-buffer nntp-server-buffer) | ||
| 127 | (erase-buffer) | ||
| 128 | (unless (file-exists-p nov-file) | ||
| 129 | (nnkiboze-request-scan group)) | ||
| 130 | (if (not (file-exists-p nov-file)) | ||
| 131 | (nnheader-report 'nnkiboze "Can't select group %s" group) | ||
| 132 | (let ((nnheader-file-coding-system nnkiboze-file-coding-system)) | ||
| 133 | (nnheader-insert-file-contents nov-file)) | ||
| 134 | (if (zerop (buffer-size)) | ||
| 135 | (nnheader-insert "211 0 0 0 %s\n" group) | ||
| 136 | (goto-char (point-min)) | ||
| 137 | (when (looking-at "[0-9]+") | ||
| 138 | (setq beg (read (current-buffer)))) | ||
| 139 | (goto-char (point-max)) | ||
| 140 | (when (re-search-backward "^[0-9]" nil t) | ||
| 141 | (setq end (read (current-buffer)))) | ||
| 142 | (setq total (count-lines (point-min) (point-max))) | ||
| 143 | (nnheader-insert "211 %d %d %d %s\n" total beg end group))))))) | ||
| 144 | |||
| 145 | (deffoo nnkiboze-close-group (group &optional server) | ||
| 146 | (nnkiboze-possibly-change-group group) | ||
| 147 | ;; Remove NOV lines of articles that are marked as read. | ||
| 148 | (when (and (file-exists-p (nnkiboze-nov-file-name)) | ||
| 149 | nnkiboze-remove-read-articles) | ||
| 150 | (let ((coding-system-for-write nnkiboze-file-coding-system)) | ||
| 151 | (with-temp-file (nnkiboze-nov-file-name) | ||
| 152 | (let ((cur (current-buffer)) | ||
| 153 | (nnheader-file-coding-system nnkiboze-file-coding-system)) | ||
| 154 | (nnheader-insert-file-contents (nnkiboze-nov-file-name)) | ||
| 155 | (goto-char (point-min)) | ||
| 156 | (while (not (eobp)) | ||
| 157 | (if (not (gnus-article-read-p (read cur))) | ||
| 158 | (forward-line 1) | ||
| 159 | (gnus-delete-line)))))) | ||
| 160 | (setq nnkiboze-current-group nil))) | ||
| 161 | |||
| 162 | (deffoo nnkiboze-open-server (server &optional defs) | ||
| 163 | (unless (assq 'nnkiboze-regexp defs) | ||
| 164 | (push `(nnkiboze-regexp ,server) | ||
| 165 | defs)) | ||
| 166 | (nnoo-change-server 'nnkiboze server defs)) | ||
| 167 | |||
| 168 | (deffoo nnkiboze-request-delete-group (group &optional force server) | ||
| 169 | (nnkiboze-possibly-change-group group) | ||
| 170 | (when force | ||
| 171 | (let ((files (nconc | ||
| 172 | (nnkiboze-score-file group) | ||
| 173 | (list (nnkiboze-nov-file-name) | ||
| 174 | (nnkiboze-nov-file-name ".newsrc"))))) | ||
| 175 | (while files | ||
| 176 | (and (file-exists-p (car files)) | ||
| 177 | (file-writable-p (car files)) | ||
| 178 | (delete-file (car files))) | ||
| 179 | (setq files (cdr files))))) | ||
| 180 | (setq nnkiboze-current-group nil) | ||
| 181 | t) | ||
| 182 | |||
| 183 | (nnoo-define-skeleton nnkiboze) | ||
| 184 | |||
| 185 | |||
| 186 | ;;; Internal functions. | ||
| 187 | |||
| 188 | (defun nnkiboze-possibly-change-group (group) | ||
| 189 | (setq nnkiboze-current-group group)) | ||
| 190 | |||
| 191 | (defun nnkiboze-prefixed-name (group) | ||
| 192 | (gnus-group-prefixed-name group '(nnkiboze ""))) | ||
| 193 | |||
| 194 | ;;;###autoload | ||
| 195 | (defun nnkiboze-generate-groups () | ||
| 196 | "\"Usage: emacs -batch -l nnkiboze -f nnkiboze-generate-groups\". | ||
| 197 | Finds out what articles are to be part of the nnkiboze groups." | ||
| 198 | (interactive) | ||
| 199 | (let ((mail-sources nil) | ||
| 200 | (gnus-use-dribble-file nil) | ||
| 201 | (gnus-read-active-file t) | ||
| 202 | (gnus-expert-user t)) | ||
| 203 | (gnus)) | ||
| 204 | (let* ((gnus-newsrc-alist (gnus-copy-sequence gnus-newsrc-alist)) | ||
| 205 | (newsrc (cdr gnus-newsrc-alist)) | ||
| 206 | gnus-newsrc-hashtb info) | ||
| 207 | (gnus-make-hashtable-from-newsrc-alist) | ||
| 208 | ;; We have copied all the newsrc alist info over to local copies | ||
| 209 | ;; so that we can mess all we want with these lists. | ||
| 210 | (while (setq info (pop newsrc)) | ||
| 211 | (when (string-match "nnkiboze" (gnus-info-group info)) | ||
| 212 | ;; For each kiboze group, we call this function to generate | ||
| 213 | ;; it. | ||
| 214 | (nnkiboze-generate-group (gnus-info-group info) t)))) | ||
| 215 | (save-excursion | ||
| 216 | (set-buffer gnus-group-buffer) | ||
| 217 | (gnus-group-list-groups))) | ||
| 218 | |||
| 219 | (defun nnkiboze-score-file (group) | ||
| 220 | (list (expand-file-name | ||
| 221 | (concat (file-name-as-directory gnus-kill-files-directory) | ||
| 222 | (nnheader-translate-file-chars | ||
| 223 | (concat (nnkiboze-prefixed-name nnkiboze-current-group) | ||
| 224 | "." gnus-score-file-suffix)))))) | ||
| 225 | |||
| 226 | (defun nnkiboze-generate-group (group &optional inhibit-list-groups) | ||
| 227 | (let* ((info (gnus-get-info group)) | ||
| 228 | (newsrc-file (concat nnkiboze-directory | ||
| 229 | (nnheader-translate-file-chars | ||
| 230 | (concat group ".newsrc")))) | ||
| 231 | (nov-file (concat nnkiboze-directory | ||
| 232 | (nnheader-translate-file-chars | ||
| 233 | (concat group ".nov")))) | ||
| 234 | method nnkiboze-newsrc gname newsrc active | ||
| 235 | ginfo lowest glevel orig-info nov-buffer | ||
| 236 | ;; Bind various things to nil to make group entry faster. | ||
| 237 | (gnus-expert-user t) | ||
| 238 | (gnus-large-newsgroup nil) | ||
| 239 | (gnus-score-find-score-files-function 'nnkiboze-score-file) | ||
| 240 | ;; Use only nnkiboze-score-file! | ||
| 241 | (gnus-score-use-all-scores nil) | ||
| 242 | (gnus-use-scoring t) | ||
| 243 | (gnus-verbose (min gnus-verbose 3)) | ||
| 244 | gnus-select-group-hook gnus-summary-prepare-hook | ||
| 245 | gnus-thread-sort-functions gnus-show-threads | ||
| 246 | gnus-visual gnus-suppress-duplicates num-unread) | ||
| 247 | (unless info | ||
| 248 | (error "No such group: %s" group)) | ||
| 249 | ;; Load the kiboze newsrc file for this group. | ||
| 250 | (when (file-exists-p newsrc-file) | ||
| 251 | (load newsrc-file)) | ||
| 252 | (let ((coding-system-for-write nnkiboze-file-coding-system)) | ||
| 253 | (gnus-make-directory (file-name-directory nov-file)) | ||
| 254 | (with-temp-file nov-file | ||
| 255 | (mm-disable-multibyte) | ||
| 256 | (when (file-exists-p nov-file) | ||
| 257 | (insert-file-contents nov-file)) | ||
| 258 | (setq nov-buffer (current-buffer)) | ||
| 259 | ;; Go through the active hashtb and add new all groups that match the | ||
| 260 | ;; kiboze regexp. | ||
| 261 | (mapatoms | ||
| 262 | (lambda (group) | ||
| 263 | (and (string-match nnkiboze-regexp | ||
| 264 | (setq gname (symbol-name group))) ; Match | ||
| 265 | (not (assoc gname nnkiboze-newsrc)) ; It isn't registered | ||
| 266 | (numberp (car (symbol-value group))) ; It is active | ||
| 267 | (or (> nnkiboze-level 7) | ||
| 268 | (and (setq glevel | ||
| 269 | (gnus-info-level (gnus-get-info gname))) | ||
| 270 | (>= nnkiboze-level glevel))) | ||
| 271 | (not (string-match "^nnkiboze:" gname)) ; Exclude kibozes | ||
| 272 | (push (cons gname (1- (car (symbol-value group)))) | ||
| 273 | nnkiboze-newsrc))) | ||
| 274 | gnus-active-hashtb) | ||
| 275 | ;; `newsrc' is set to the list of groups that possibly are | ||
| 276 | ;; component groups to this kiboze group. This list has elements | ||
| 277 | ;; on the form `(GROUP . NUMBER)', where NUMBER is the highest | ||
| 278 | ;; number that has been kibozed in GROUP in this kiboze group. | ||
| 279 | (setq newsrc nnkiboze-newsrc) | ||
| 280 | (while newsrc | ||
| 281 | (if (not (setq active (gnus-active (caar newsrc)))) | ||
| 282 | ;; This group isn't active after all, so we remove it from | ||
| 283 | ;; the list of component groups. | ||
| 284 | (setq nnkiboze-newsrc (delq (car newsrc) nnkiboze-newsrc)) | ||
| 285 | (setq lowest (cdar newsrc)) | ||
| 286 | ;; Ok, we have a valid component group, so we jump to it. | ||
| 287 | (switch-to-buffer gnus-group-buffer) | ||
| 288 | (gnus-group-jump-to-group (caar newsrc)) | ||
| 289 | (gnus-message 3 "nnkiboze: Checking %s..." (caar newsrc)) | ||
| 290 | (setq ginfo (gnus-get-info (gnus-group-group-name)) | ||
| 291 | orig-info (gnus-copy-sequence ginfo) | ||
| 292 | num-unread (gnus-group-unread (caar newsrc))) | ||
| 293 | (unwind-protect | ||
| 294 | (progn | ||
| 295 | ;; We set all list of article marks to nil. Since we operate | ||
| 296 | ;; on copies of the real lists, we can destroy anything we | ||
| 297 | ;; want here. | ||
| 298 | (when (nth 3 ginfo) | ||
| 299 | (setcar (nthcdr 3 ginfo) nil)) | ||
| 300 | ;; We set the list of read articles to be what we expect for | ||
| 301 | ;; this kiboze group -- either nil or `(1 . LOWEST)'. | ||
| 302 | (when ginfo | ||
| 303 | (setcar (nthcdr 2 ginfo) | ||
| 304 | (and (not (= lowest 1)) (cons 1 lowest)))) | ||
| 305 | (when (and (or (not ginfo) | ||
| 306 | (> (length (gnus-list-of-unread-articles | ||
| 307 | (car ginfo))) | ||
| 308 | 0)) | ||
| 309 | (progn | ||
| 310 | (ignore-errors | ||
| 311 | (gnus-group-select-group nil)) | ||
| 312 | (eq major-mode 'gnus-summary-mode))) | ||
| 313 | ;; We are now in the group where we want to be. | ||
| 314 | (setq method (gnus-find-method-for-group | ||
| 315 | gnus-newsgroup-name)) | ||
| 316 | (when (eq method gnus-select-method) | ||
| 317 | (setq method nil)) | ||
| 318 | ;; We go through the list of scored articles. | ||
| 319 | (while gnus-newsgroup-scored | ||
| 320 | (when (> (caar gnus-newsgroup-scored) lowest) | ||
| 321 | ;; If it has a good score, then we enter this article | ||
| 322 | ;; into the kiboze group. | ||
| 323 | (nnkiboze-enter-nov | ||
| 324 | nov-buffer | ||
| 325 | (gnus-summary-article-header | ||
| 326 | (caar gnus-newsgroup-scored)) | ||
| 327 | gnus-newsgroup-name)) | ||
| 328 | (setq gnus-newsgroup-scored (cdr gnus-newsgroup-scored))) | ||
| 329 | ;; That's it. We exit this group. | ||
| 330 | (when (eq major-mode 'gnus-summary-mode) | ||
| 331 | (kill-buffer (current-buffer))))) | ||
| 332 | ;; Restore the proper info. | ||
| 333 | (when ginfo | ||
| 334 | (setcdr ginfo (cdr orig-info))) | ||
| 335 | (setcar (gnus-group-entry (caar newsrc)) num-unread))) | ||
| 336 | (setcdr (car newsrc) (cdr active)) | ||
| 337 | (gnus-message 3 "nnkiboze: Checking %s...done" (caar newsrc)) | ||
| 338 | (setq newsrc (cdr newsrc))))) | ||
| 339 | ;; We save the kiboze newsrc for this group. | ||
| 340 | (gnus-make-directory (file-name-directory newsrc-file)) | ||
| 341 | (with-temp-file newsrc-file | ||
| 342 | (mm-disable-multibyte) | ||
| 343 | (insert "(setq nnkiboze-newsrc '") | ||
| 344 | (gnus-prin1 nnkiboze-newsrc) | ||
| 345 | (insert ")\n")) | ||
| 346 | (unless inhibit-list-groups | ||
| 347 | (save-excursion | ||
| 348 | (set-buffer gnus-group-buffer) | ||
| 349 | (gnus-group-list-groups))) | ||
| 350 | t)) | ||
| 351 | |||
| 352 | (defun nnkiboze-enter-nov (buffer header group) | ||
| 353 | (save-excursion | ||
| 354 | (set-buffer buffer) | ||
| 355 | (goto-char (point-max)) | ||
| 356 | (let ((prefix (gnus-group-real-prefix group)) | ||
| 357 | (oheader (copy-sequence header)) | ||
| 358 | article) | ||
| 359 | (if (zerop (forward-line -1)) | ||
| 360 | (progn | ||
| 361 | (setq article (1+ (read (current-buffer)))) | ||
| 362 | (forward-line 1)) | ||
| 363 | (setq article 1)) | ||
| 364 | (mail-header-set-number oheader article) | ||
| 365 | (with-temp-buffer | ||
| 366 | (insert (or (mail-header-xref oheader) "")) | ||
| 367 | (goto-char (point-min)) | ||
| 368 | (if (re-search-forward " [^ ]+:[0-9]+" nil t) | ||
| 369 | (goto-char (match-beginning 0)) | ||
| 370 | (or (eobp) (forward-char 1))) | ||
| 371 | ;; The first Xref has to be the group this article | ||
| 372 | ;; really came for - this is the article nnkiboze | ||
| 373 | ;; will request when it is asked for the article. | ||
| 374 | (insert " " group ":" | ||
| 375 | (int-to-string (mail-header-number header)) " ") | ||
| 376 | (while (re-search-forward " [^ ]+:[0-9]+" nil t) | ||
| 377 | (goto-char (1+ (match-beginning 0))) | ||
| 378 | (insert prefix)) | ||
| 379 | (mail-header-set-xref oheader (buffer-string))) | ||
| 380 | (nnheader-insert-nov oheader)))) | ||
| 381 | |||
| 382 | (defun nnkiboze-nov-file-name (&optional suffix) | ||
| 383 | (concat (file-name-as-directory nnkiboze-directory) | ||
| 384 | (nnheader-translate-file-chars | ||
| 385 | (concat (nnkiboze-prefixed-name nnkiboze-current-group) | ||
| 386 | (or suffix ".nov"))))) | ||
| 387 | |||
| 388 | (provide 'nnkiboze) | ||
| 389 | |||
| 390 | ;; arch-tag: 66068271-bdc9-4801-bcde-779702e73a05 | ||
| 391 | ;;; nnkiboze.el ends here | ||