*** A new mail-to-news backend makes it possible to post
even when the NNTP server doesn't allow posting.
+*** Process mark sets can be pushed and popped.
+
+*** A new mail-to-news backend makes it possible to post
+even when the NNTP server doesn't allow posting.
+
+*** A new backend for reading searches from DejaNews has
+been added.
+
+ Use the `G n' command in the group buffer to create such
+ a group.
+
+Sun Aug 18 12:46:12 1996 Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
+
+ * nnoo.el (nnoo-define-skeleton-1): Defined too many functions.
+
+Sat Aug 17 18:43:22 1996 Lars Magne Ingebrigtsen <lars@eyesore.no>
+
+ * gnus-group.el (gnus-group-make-dejanews-group): New command and
+ keystroke.
+
+ * gnus-start.el (gnus-site-init-file): New variable.
+ (gnus-read-init-file): Use it.
+
+ * nndejanews.el: New file.
+
+ * nnheader.el (make-full-mail-header): New function.
+
+ * nngateway.el (nngateway-open-server): Used nntp vars.
+
+Sat Aug 17 15:35:28 1996 Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
+
+ * gnus.el: Red Gnus v0.12 is released.
+
Sat Aug 17 12:58:28 1996 Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
* gnus-win.el (gnus-window-configuration-element): New function.
;; Remove the read article from the prefetch buffer.
(when (memq 'read gnus-prefetched-article-deletion-strategy)
(gnus-async-delete-prefected-entry entry))
- ;; Decode the article. Perhaps this shouldn't be done
- ;; here?
- (set-buffer buffer)
- (nntp-decode-text)
- (goto-char (point-min))
- (gnus-delete-line)
t)))))
(defun gnus-async-delete-prefected-entry (entry)
"V" gnus-group-make-empty-virtual
"D" gnus-group-enter-directory
"f" gnus-group-make-doc-group
+ "n" gnus-group-make-dejagnus-group
"r" gnus-group-rename-group
"\177" gnus-group-delete-group
[delete] gnus-group-delete-group)
(list 'nndoc-address file)
(list 'nndoc-article-type (or type 'guess))))))
+(defun gnus-group-make-dejagnus-group (&optional solid)
+ "Create an ephemeral nndejagnus group.
+If SOLID (the prefix), create a solid group."
+ (interactive "P")
+ (let* ((group
+ (if solid (read-string "Group name: ") (message-unique-id)))
+ (search
+ (read-string "Search string: "))
+ (method
+ `(nndejagnus ,group (nndejagnus-search ,search))))
+ (if solid
+ (gnus-group-make-group group method)
+ (gnus-group-read-ephemeral-group
+ group method t
+ (cons (current-buffer)
+ (if (eq major-mode 'gnus-summary-mode) 'summary 'group))))))
+
(defun gnus-group-make-archive-group (&optional all)
"Create the (ding) Gnus archive group of the most recent articles.
Given a prefix, create a full group."
("nnsoup" post-mail address)
("nndraft" post-mail)
("nnfolder" mail respool address)
- ("nngateway" none address prompt-address))
+ ("nngateway" none address prompt-address)
+ ("nndejanews" none))
"An alist of valid select methods.
The first element of each list lists should be a string with the name
of the select method. The other elements may be the category of
If a file with the .el or .elc suffixes exist, it will be read
instead.")
+(defvar gnus-site-init-file
+ (condition-case ()
+ (concat (file-name-directory
+ (directory-file-name installation-directory))
+ "site-lisp/gnus-init")
+ (error nil))
+ "*The site-wide Gnus elisp startup file.
+If a file with the .el or .elc suffixes exist, it will be read
+instead.")
+
(defvar gnus-default-subscribed-newsgroups nil
"*This variable lists what newsgroups should be subscribed the first time Gnus is used.
It should be a list of strings.
(if gnus-init-inhibit
(setq gnus-init-inhibit nil)
(setq gnus-init-inhibit inhibit-next)
- (and gnus-init-file
- (or (and (file-exists-p gnus-init-file)
- ;; Don't try to load a directory.
- (not (file-directory-p gnus-init-file)))
- (file-exists-p (concat gnus-init-file ".el"))
- (file-exists-p (concat gnus-init-file ".elc")))
- (condition-case var
- (load gnus-init-file nil t)
- (error
- (error "Error in %s: %s" gnus-init-file var))))))
+ (let ((files (list gnus-site-init-file gnus-init-file))
+ file)
+ (while files
+ (and (setq file (pop files))
+ (or (and (file-exists-p file)
+ ;; Don't try to load a directory.
+ (not (file-directory-p file)))
+ (file-exists-p (concat file ".el"))
+ (file-exists-p (concat file ".elc")))
+ (condition-case var
+ (load file nil t)
+ (error
+ (error "Error in %s: %s" file var))))))))
;; For subscribing new newsgroup
(require 'gnus-undo)
(require 'gnus)
-
(defvar gnus-kill-summary-on-exit t
"*If non-nil, kill the summary buffer when you exit from it.
If nil, the summary will become a \"*Dead Summary*\" buffer, and
(eval '(run-hooks 'gnus-load-hook))
-(defconst gnus-version-number "0.12"
+(defconst gnus-version-number "0.13"
"Version number for this version of Gnus.")
(defconst gnus-version (format "Red Gnus v%s" gnus-version-number)
--- /dev/null
+;;; nndejagnus.el --- retrieving articles via DejaNews
+;; Copyright (C) 1996 Free Software Foundation, Inc.
+
+;; Author: Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
+;; Keywords: news
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING. If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
+
+;;; Commentary:
+
+;; Note: You need to have `url' and `w3' installed for this
+;; backend to work.
+
+;;; Code:
+
+(require 'nnoo)
+(require 'message)
+(require 'gnus-util)
+(require 'w3-forms)
+(require 'url)
+
+(nnoo-declare nndejagnus)
+
+(defvoo nndejagnus-address "http://www.dejagnus.com/"
+ "Base URL of the DejaNews search engine.")
+
+(defvoo nndejagnus-search nil
+ "Search string to feed to DejaNews.")
+
+(defvoo nndejagnus-max-hits 100
+ "Maximum number of hits to display.")
+
+;;; Internal variables
+
+(defvoo nndejagnus-articles nil)
+(defvoo nndejagnus-buffer nil)
+(defvoo nndejagnus-async-buffer nil)
+(defvar nndejagnus-callback-function nil)
+(defvar nndejagnus-to-buffer nil)
+(defvar nndejagnus-start-point nil)
+(defvar nndejagnus-inside-change-function nil)
+
+;;; Interface functions
+
+(nnoo-define-basics nndejagnus)
+
+(deffoo nndejagnus-retrieve-headers (articles &optional group server fetch-old)
+ (nndejagnus-possibly-change-server server)
+ (save-excursion
+ (set-buffer nntp-server-buffer)
+ (erase-buffer)
+ (let (article header)
+ (while (setq article (pop articles))
+ (when (setq header (cadr (assq article nndejagnus-articles)))
+ (nnheader-insert-nov header)))
+ 'nov)))
+
+(deffoo nndejagnus-request-group (group &optional server dont-check)
+ (nndejagnus-possibly-change-server server)
+ (when (or (not dont-check)
+ (not nndejagnus-articles))
+ (nndejagnus-create-mapping group))
+ (cond
+ ((not nndejagnus-articles)
+ (nnheader-report 'nndejagnus "Couldn't request search"))
+ (t
+ (nnheader-report 'nndejagnus "Opened group %s" group)
+ (nnheader-insert
+ "211 %d %d %d %s\n" (length nndejagnus-articles)
+ (caar nndejagnus-articles) (caar (last nndejagnus-articles))
+ group))))
+
+(deffoo nndejagnus-request-article (article &optional group server buffer)
+ (nndejagnus-possibly-change-server server)
+ (save-excursion
+ (set-buffer (or buffer nntp-server-buffer))
+ (let ((url (caddr (assq article nndejagnus-articles))))
+ (when (and url
+ (nndejagnus-fetch-url url))
+ (unless nnheader-callback-function
+ (nndejagnus-decode-article)
+ (nndejagnus-decode-entities))
+ (nnheader-report 'nndejagnus "Fetched article %s" article)
+ t))))
+
+(deffoo nndejagnus-close-server (&optional server)
+ (when (nndejagnus-server-opened server)
+ (gnus-kill-buffer nndejagnus-buffer))
+ (nnoo-close-server 'nndejagnus server))
+
+(deffoo nndejagnus-request-update-info (group info &optional server)
+ (nndejagnus-possibly-change-server server)
+ (setcar (cddr info) nil))
+
+(deffoo nndejagnus-asynchronous-p ()
+ t)
+
+(nnoo-define-skeleton nndejagnus)
+
+;;; Internal functions
+
+(defun nndejagnus-possibly-change-server (&optional server)
+ (nndejagnus-init server)
+ (when server
+ (unless (nndejagnus-server-opened server)
+ (nndejagnus-open-server server))))
+
+(defun nndejagnus-init (server)
+ "Initialize buffers and such."
+ (unless (gnus-buffer-live-p nndejagnus-buffer)
+ (setq nndejagnus-buffer
+ (save-excursion
+ (nnheader-set-temp-buffer
+ (format " *nndejagnus %s*" server))))))
+
+(defun nndejagnus-create-mapping (group)
+ "Perform the search and create an number-to-url alist."
+ (save-excursion
+ (set-buffer nndejagnus-buffer)
+ (erase-buffer)
+ (when (nndejagnus-fetch-search nndejagnus-search)
+ (let ((i 0)
+ (more t)
+ Subject Score Date Newsgroup Author
+ map url)
+ (while more
+ ;; Go through all the article hits on this page.
+ (goto-char (point-min))
+ (nndejagnus-decode-entities)
+ (goto-char (point-min))
+ (while (re-search-forward "^ +[0-9]+\\." nil t)
+ (narrow-to-region
+ (point)
+ (if (re-search-forward "^ +[0-9]+\\." nil t)
+ (match-beginning 0)
+ (point-max)))
+ (goto-char (point-min))
+ (when (looking-at ".*HREF=\"\\([^\"]+\\)\"")
+ (setq url (match-string 1)))
+ (while (re-search-forward "<[^>]+>" nil t)
+ (replace-match "" t t))
+ (goto-char (point-min))
+ (while (search-forward "\t" nil t)
+ (replace-match " "))
+ (goto-char (point-min))
+ (while (re-search-forward "^ +\\([^:]+\\): +\\(.*\\)$" nil t)
+ (set (intern (match-string 1)) (match-string 2)))
+ (widen)
+ (when (string-match "#[0-9]+/[0-9]+ *$" Subject)
+ (setq Subject (substring Subject 0 (match-beginning 0))))
+ (push
+ (list
+ (incf i)
+ (make-full-mail-header
+ i (concat "(" Newsgroup ") " Subject) Author Date
+ (concat "<" (message-unique-id) "-" (int-to-string i)
+ "@dejanews>")
+ nil 0 (string-to-int Score) nil)
+ url)
+ map))
+ ;; See whether there is a "Get next 20 hits" button here.
+ (if (or (not (re-search-forward
+ "HREF=\"\\([^\"]+\\)\">Get next" nil t))
+ (> i nndejagnus-max-hits))
+ (setq more nil)
+ ;; Yup -- fetch it.
+ (setq more (match-string 1))
+ (erase-buffer)
+ (url-insert-file-contents more)))
+ ;; Return the articles in the right order.
+ (setq nndejagnus-articles (nreverse map))))))
+
+(defun nndejagnus-fetch-url (url)
+ (save-excursion
+ (if (not nnheader-callback-function)
+ (let ((buf (current-buffer)))
+ (save-excursion
+ (set-buffer nndejagnus-buffer)
+ (erase-buffer)
+ (prog1
+ (url-insert-file-contents url)
+ (copy-to-buffer buf (point-min) (point-max)))))
+ (nndejagnus-url-retrieve-asynch
+ url 'nndejanews-callback (current-buffer) nnheader-callback-function)
+ t)))
+
+(defun nndejanews-callback (buffer callback)
+ (save-excursion
+ (set-buffer url-working-buffer)
+ (nndejagnus-decode-article)
+ (nndejagnus-decode-entities)
+ (set-buffer buffer)
+ (goto-char (point-max))
+ (insert-buffer-substring url-working-buffer))
+ (funcall callback t)
+ (gnus-kill-buffer url-working-buffer))
+
+(defun nndejagnus-url-retrieve-asynch (url callback &rest data)
+ (let ((url-request-method "GET")
+ (old-asynch url-be-asynchronous)
+ (url-request-data nil)
+ (url-request-extra-headers nil)
+ (url-working-buffer (generate-new-buffer-name " *dejanews*")))
+ (setq-default url-be-asynchronous t)
+ (save-excursion
+ (set-buffer (get-buffer-create url-working-buffer))
+ (setq url-current-callback-data data
+ url-be-asynchronous t
+ url-current-callback-func callback)
+ (url-retrieve url))
+ (setq-default url-be-asynchronous old-asynch)))
+
+(defun nndejagnus-decode-article ()
+ (goto-char (point-min))
+ (re-search-forward "<PRE>" nil t)
+ (delete-region (point-min) (point))
+ (re-search-forward "</PRE>" nil t)
+ (delete-region (point) (point-max))
+ (goto-char (point-min))
+ (while (re-search-forward "<[^>]+>" nil t)
+ (replace-match "" t t))
+ (goto-char (point-min))
+ (while (looking-at " *$")
+ (gnus-delete-line))
+ (while (looking-at "\\(^[^ ]+:\\) *")
+ (replace-match "\\1 " t)
+ (forward-line 1))
+ (when (re-search-forward "\n\n+" nil t)
+ (replace-match "\n" t t)))
+
+(defun nndejagnus-encode-www-form-urlencoded (pairs)
+ "Return PAIRS encoded for forms."
+ (mapconcat
+ (function
+ (lambda (data)
+ (concat (w3-form-encode-xwfu (car data)) "="
+ (w3-form-encode-xwfu (cdr data))))) pairs "&"))
+
+(defun nndejagnus-fetch-form (url pairs)
+ (let ((url-request-data (nndejagnus-encode-www-form-urlencoded pairs))
+ (url-request-method 'POST)
+ (url-request-extra-headers
+ '(("Content-type" . "application/x-www-form-urlencoded"))))
+ (url-insert-file-contents url)))
+
+(defun nndejagnus-fetch-search (search)
+ (nndejagnus-fetch-form
+ "http://xp6.dejanews.com/dnquery.xp"
+ `(("query" . ,search)
+ ("defaultOp" . "AND")
+ ("svcclass" . "dncurrent")
+ ("maxhits" . "25")
+ ("format" . "verbose")
+ ("threaded" . "0")
+ ("showsort" . "score")
+ ("agesign" . "1")
+ ("ageweight" . "1"))))
+
+(defun nndejagnus-decode-entities ()
+ (goto-char (point-min))
+ (while (re-search-forward "&\\([a-z]+\\);" nil t)
+ (replace-match (char-to-string (or (cdr (assq (intern (match-string 1))
+ w3-html-entities ))
+ ?#))
+ t t)))
+
+; "^ +\\([0-9]+\\)\\. +\\([0-9]+\\)/+\\([0-9]+\\)/+\\([0-9]+\\) +\\([0-9]+\\).+HREF=\"\\([^\"]+\\)\">\\([^<]+\\)<.*<B> *\\(.*\\)</B>.+>\\([^<>]+\\)</A> *$"
+
+(provide 'nndejagnus)
+
+;;; nndejagnus.el ends here
;;; Interface functions
(nnoo-define-basics nngateway)
-(nnoo-define-skeleton nngateway)
(deffoo nngateway-open-server (server &optional defs)
(if (nngateway-server-opened server)
t
(unless (assq 'nngateway-address defs)
- (setq defs (append defs (list (list 'nntp-address server)))))
- (nnoo-change-server 'nntp server defs)))
+ (setq defs (append defs (list (list 'nngateway-address server)))))
+ (nnoo-change-server 'nngateway server defs)))
(deffoo nngateway-request-post (&optional server)
(when (or (nngateway-server-opened server)
(goto-char (point-min))
(insert "To: " (nnheader-replace-chars-in-string newsgroups ?. ?-)
"@" gateway "\n")))
+
+(nnoo-define-skeleton nngateway)
(provide 'nngateway)
"Create a new mail header structure initialized with INIT."
(make-vector 9 init))
+(defun make-full-mail-header (&optional number subject from date id
+ references chars lines xref)
+ "Create a new mail header structure initialized with the parameters given."
+ (vector number subject from date id references chars lines xref))
+
;; Parsing headers and NOV lines.
(defsubst nnheader-header-value ()
(defun nnoo-define-skeleton-1 (backend)
(let ((functions '(retrieve-headers
- request-close server-opened request-article
+ request-close request-article
open-group request-group close-group
request-list request-post))
- function)
+ function fun)
(while (setq function (pop functions))
- (eval `(deffoo ,(nnoo-symbol backend function)
- (&optional server)
- (nnheader-report ',backend ,(format "%s-%s not implemented"
- backend function)))))))
+ (when (not (fboundp (setq fun (nnoo-symbol backend function))))
+ (eval `(deffoo ,fun
+ (&rest args)
+ (nnheader-report ',backend ,(format "%s-%s not implemented"
+ backend function))))))))
(provide 'nnoo)
;;; nnoo.el ends here.
(when (and (> (point) nntp-process-start-point)
(re-search-backward nntp-process-wait-for
nntp-process-start-point t))
- (when nntp-process-decode
- ;(nntp-decode-text)
- )
(when (buffer-name (get-buffer nntp-process-to-buffer))
(let ((cur (current-buffer))
(start nntp-process-start-point))
(save-excursion
(set-buffer (get-buffer nntp-process-to-buffer))
(goto-char (point-max))
- (insert-buffer-substring cur start))))
+ (let ((b (point)))
+ (insert-buffer-substring cur start)
+ (narrow-to-region b (point-max))
+ (nntp-decode-text)
+ (goto-char (point-min))
+ (gnus-delete-line)
+ (widen)))))
(goto-char end)
- ;(erase-buffer)
(let ((callback nntp-process-callback)
(nntp-inside-change-function t))
(setq nntp-process-callback nil)
+Sat Aug 17 22:24:34 1996 Lars Magne Ingebrigtsen <lars@eyesore.no>
+
+ * gnus.texi (Startup Files): Addition.
+ (Anything Groups): Addition.
+
Thu Aug 15 17:59:12 1996 Lars Magne Ingebrigtsen <lars@eyesore.no>
* gnus.texi (Followups To Yourself): Addition.
startup files.
@vindex gnus-init-file
-When Gnus starts, it will read the @code{gnus-init-file} file, which is
-@file{~/.gnus.el} by default. This is a normal Emacs Lisp file and can
-be used to avoid cluttering your @file{.emacs} file with Gnus stuff.
+When Gnus starts, it will read the @code{gnus-site-init-file} (default
+@file{.../site-lisp/gnus.el}) and @code{gnus-init-file} (default
+@file{~/.gnus.el}) files. These are normal Emacs Lisp files and can be
+used to avoid cluttering your @file{.emacs} and @file{site-init} files
+with Gnus stuff.
@node Auto Save
@code{forward}. If you run this command without a prefix, Gnus will
guess at the file type. @xref{Document Groups}.
+@item G n
+@kindex G n (Group)
+@findex gnus-group-make-dejagnus-group
+@cindex DejaNews
+Make an ephemeral group based on a DejaNews search
+(@code{gnus-group-make-dejagnus-group}). If you give a prefix to this
+command, make a solid group instead. You will be prompted for the
+search. @xref{DejaNews Searches}.
+
@item G DEL
@kindex G DEL (Group)
@findex gnus-group-delete-group
* Anything Groups:: Dired? Who needs dired?
* Document Groups:: Single files can be the basis of a group.
* SOUP:: Reading @sc{SOUP} packets ``offline''.
+* DejaNews Searches:: Creating groups from articles that match a string.
* Mail-To-News Gateways:: Posting articles via mail-to-news gateways.
@end menu
@sc{soup}ed you use the second.
+@node DejaNews Searches
+@subsection DejaNews Searches
+@cindex nndejagnus
+@cindex DejaNews
+@cindex Usenet searches
+@cindex searching the Usenet
+
+It's, like, too neat to search the Usenet for articles that match a
+string, but it, like, totally @emph{sucks}, like, totally, to use one of
+those, like, Web browsers, and you, like, have to, rilly, like, look at
+the commercials, so, like, with Gnus you can do @emph{rad}, rilly,
+searches without having to use a browser.
+
+The @code{nndejagnus} (hey, I wonder if they're going to sue me over
+copyright infringement?) backend allows an easy interface to the mighty
+search engine. You create an @code{nndejagnus} group, enter a search
+pattern, and then enter the group and read the articles like you would
+any normal group. The @kbd{G n} command in the group buffer
+(@pxref{Foreign Groups}) will do this in an easy-to-use fashion.
+
+@code{nndejagnus} groups don't really lend themselves to being solid
+groups---they have a very fleeting idea of article numbers. In fact,
+each time you enter an @code{nndejagnus} group (not changing the search
+pattern), you are likely to get the articles ordered in a different
+manner. Not even using duplicate suppression (@code{Duplicate
+Suppression}) will help, since @code{nndejagnus} doesn't even know the
+@code{Message-ID} of the articles before reading them. The only
+possible way to keep track of which articles you've read is by scoring
+on the @code{Date} header---mark all articles that were posted before
+the last date you read the group as read.
+
+You must have the @code{url} and @code{w3} package installed to be able
+to use @code{nndejagnus}.
+
+Virtual server variables:
+
+@table @code
+@item nndejagnus-address
+@vindex nndejagnus-address
+The address of the DejaNews search engine. The default is
+@samp{http://www.dejagnus.com}.
+
+@item nndejagnus-search
+@vindex nndejagnus-search
+The search string to feed to DejaNews.
+
+@item nndejagnus-max-hits
+@vindex nndejagnus-max-hits
+Maximum number of hits per search to display. The default is 100.
+@end table
+
+
+
@node Mail-To-News Gateways
@subsection Mail-To-News Gateways
@cindex mail-to-news gateways