2004-02-27 Jesper Harder <harder@ifa.au.dk>
+ * spam-stat.el: Pedantic docstring and whitespace fixes (courtesy
+ of checkdoc.el).
+ * nnrss.el: do.
+ * gnus-mlspl.el: do.
+ * gnus-ml.el: do.
+ * gnus-srvr.el: do.
+
* nnrss.el (nnrss-opml-export): Turn on sgml-mode.
2004-02-27 Kevin Ryde <user42@zip.com.au> (tiny change)
;; Copyright (C) 2000, 2001 Free Software Foundation, Inc.
;; Author: Julien Gilles <jgilles@free.fr>
-;; Keywords: news
+;; Keywords: news, mail
;; This file is part of GNU Emacs.
(t (gnus-message 1 "no list-help in this group")))))
(defun gnus-mailing-list-subscribe ()
- "Subscribe"
+ "Subscribe."
(interactive)
(let ((list-subscribe
(with-current-buffer gnus-original-article-buffer
(t (gnus-message 1 "no list-subscribe in this group")))))
(defun gnus-mailing-list-unsubscribe ()
- "Unsubscribe"
+ "Unsubscribe."
(interactive)
(let ((list-unsubscribe
(with-current-buffer gnus-original-article-buffer
(t (gnus-message 1 "no list-post in this group")))))
(defun gnus-mailing-list-owner ()
- "Mail to the owner"
+ "Mail to the owner."
(interactive)
(let ((list-owner
(with-current-buffer gnus-original-article-buffer
(t (gnus-message 1 "no list-owner in this group")))))
(defun gnus-mailing-list-archive ()
- "Browse archive"
+ "Browse archive."
(interactive)
(require 'browse-url)
(let ((list-archive
(require 'nnmail)
(defvar gnus-group-split-updated-hook nil
- "Hook called just after nnmail-split-fancy is updated by
-gnus-group-split-update.")
+ "Hook called just after `nnmail-split-fancy' is updated by
+`gnus-group-split-update'.")
(defvar gnus-group-split-default-catch-all-group "mail.misc"
"Group name (or arbitrary fancy split) with default splitting rules.
-Used by gnus-group-split and gnus-group-split-update as a fallback
+Used by `gnus-group-split' and `gnus-group-split-update' as a fallback
split, in case none of the group-based splits matches.")
;;;###autoload
(defun gnus-group-split-setup (&optional auto-update catch-all)
- "Set up the split for nnmail-split-fancy.
+ "Set up the split for `nnmail-split-fancy'.
Sets things up so that nnmail-split-fancy is used for mail
splitting, and defines the variable nnmail-split-fancy according with
group parameters.
If AUTO-UPDATE is non-nil (prefix argument accepted, if called
interactively), it makes sure nnmail-split-fancy is re-computed before
-getting new mail, by adding gnus-group-split-update to
-nnmail-pre-get-new-mail-hook.
+getting new mail, by adding `gnus-group-split-update' to
+`nnmail-pre-get-new-mail-hook'.
A non-nil CATCH-ALL replaces the current value of
-gnus-group-split-default-catch-all-group. This variable is only used
+`gnus-group-split-default-catch-all-group'. This variable is only used
by gnus-group-split-update, and only when its CATCH-ALL argument is
nil. This argument may contain any fancy split, that will be added as
-the last split in a `|' split produced by gnus-group-split-fancy,
+the last split in a `|' split produced by `gnus-group-split-fancy',
unless overridden by any group marked as a catch-all group. Typical
uses are as simple as the name of a default mail group, but more
elaborate fancy splits may also be useful to split mail that doesn't
;;;###autoload
(defun gnus-group-split-update (&optional catch-all)
- "Computes nnmail-split-fancy from group params and CATCH-ALL, by
+ "Computes `nnmail-split-fancy' from group params and CATCH-ALL, by
calling (gnus-group-split-fancy nil nil CATCH-ALL).
-If CATCH-ALL is nil, gnus-group-split-default-catch-all-group is used
-instead. This variable is set by gnus-group-split-setup."
+If CATCH-ALL is nil, `gnus-group-split-default-catch-all-group' is used
+instead. This variable is set by `gnus-group-split-setup'."
(interactive)
(setq nnmail-split-fancy
(gnus-group-split-fancy
;;;###autoload
(defun gnus-group-split ()
- "Uses information from group parameters in order to split mail.
+ "Use information from group parameters in order to split mail.
See `gnus-group-split-fancy' for more information.
-gnus-group-split is a valid value for nnmail-split-methods."
+`gnus-group-split' is a valid value for `nnmail-split-methods'."
(let (nnmail-split-fancy)
(gnus-group-split-update)
(nnmail-split-fancy)))
The following specs are understood:
-%h backend
+%h back end
%n name
%w address
%s status
(and server (symbol-name server))))
(defun gnus-server-named-server ()
- "Returns a server name that matches one of the names returned by
-gnus-method-to-server."
+ "Return a server name that matches one of the names returned by
+`gnus-method-to-server'."
(let ((server (get-text-property (point-at-bol) 'gnus-named-server)))
(and server (symbol-name server))))
(if (eq (car method) 'nntp)
(while (not (eobp))
(ignore-errors
- (push (cons
- (buffer-substring
+ (push (cons
+ (buffer-substring
(point)
- (progn
+ (progn
(skip-chars-forward "^ \t")
(point)))
(let ((last (read cur)))
(beginning-of-line)
(let ((name (get-text-property (point) 'gnus-group)))
(when (re-search-forward ": \\(.*\\)$" (point-at-eol) t)
- (concat (gnus-method-to-server-name gnus-browse-current-method) ":"
+ (concat (gnus-method-to-server-name gnus-browse-current-method) ":"
(or name
(match-string-no-properties 1)))))))
(gnus-get-function (gnus-server-to-method server)
'request-regenerate)
(error
- (error "This backend doesn't support regeneration")))
+ (error "This back end doesn't support regeneration")))
(gnus-message 5 "Requesting regeneration of %s..." server)
(unless (gnus-open-server server)
(error "Couldn't open server"))
(defvar nnrss-content-function nil
"A function which is called in `nnrss-request-article'.
The arguments are (ENTRY GROUP ARTICLE).
-ENTRY is the record of the current headline. GROUP is the group name.
+ENTRY is the record of the current headline. GROUP is the group name.
ARTICLE is the article number of the current headline.")
(nnoo-define-basics nnrss)
;;; Internal functions
(eval-when-compile (defun xml-rpc-method-call (&rest args)))
(defun nnrss-fetch (url &optional local)
- "Fetch the url and put it in a the expected lisp structure."
+ "Fetch URL and put it in a the expected Lisp structure."
(with-temp-buffer
;some CVS versions of url.el need this to close the connection quickly
(let* (xmlform htmlform)
(defvar nnrss-extra-categories '(nnrss-snarf-moreover-categories))
(defun nnrss-generate-active ()
- (if (y-or-n-p "fetch extra categories? ")
+ (if (y-or-n-p "Fetch extra categories? ")
(dolist (func nnrss-extra-categories)
(funcall func)))
(save-excursion
"OPML subscriptions import.
Read the file and attempt to subscribe to each Feed in the file."
(interactive "fImport file: ")
- (mapcar
- (lambda (node) (gnus-group-make-rss-group
+ (mapcar
+ (lambda (node) (gnus-group-make-rss-group
(cdr (assq 'xmlUrl (cadr node)))))
(nnrss-find-el 'outline
(progn
(interactive)
(with-current-buffer (get-buffer-create "*OPML Export*")
(mm-set-buffer-file-coding-system 'utf-8)
- (insert (concat
+ (insert (concat
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
"<!-- OPML generated by Emacs Gnus' nnrss.el -->\n"
"<opml version=\"1.1\">\n"
" </head>\n"
" <body>\n"))
(mapcar (lambda (sub)
- (insert (concat
+ (insert (concat
" <outline text=\"" (car sub) "\" xmlUrl=\""
(cadr sub) "\"/>\n")))
nnrss-group-alist)
node))
(defun nnrss-find-el (tag data &optional found-list)
- "Find the all matching elements in the data. Careful with this on
-large documents!"
+ "Find the all matching elements in the data.
+Careful with this on large documents!"
(if (listp data)
(mapcar (lambda (bit)
(when (car-safe bit)
"Test if the element we are handed is an RSS autodiscovery link."
(and (eq (car-safe el) 'link)
(string-equal (cdr (assoc 'rel (cadr el))) "alternate")
- (or (string-equal (cdr (assoc 'type (cadr el)))
+ (or (string-equal (cdr (assoc 'type (cadr el)))
"application/rss+xml")
(string-equal (cdr (assoc 'type (cadr el))) "text/xml"))))
(defun nnrss-get-rsslinks (data)
"Extract the <link> elements that are links to RSS from the parsed data."
- (delq nil (mapcar
+ (delq nil (mapcar
(lambda (el)
(if (nnrss-rsslink-p el) el))
(nnrss-find-el 'link data))))
(defun nnrss-extract-hrefs (data)
- "Recursively extract hrefs from a page's source. DATA should be
-the output of xml-parse-region or w3-parse-buffer."
+ "Recursively extract hrefs from a page's source.
+DATA should be the output of `xml-parse-region' or
+`w3-parse-buffer'."
(mapcar (lambda (ahref)
(cdr (assoc 'href (cadr ahref))))
(nnrss-find-el 'a data)))
-(defmacro nnrss-match-macro (base-uri item
+(defmacro nnrss-match-macro (base-uri item
onsite-list offsite-list)
`(cond ((or (string-match (concat "^" ,base-uri) ,item)
(not (string-match "://" ,item)))
(nnrss-match-macro
base-uri href rss-onsite-end rss-offsite-end))
((string-match "\\.rdf$" href)
- (nnrss-match-macro
+ (nnrss-match-macro
base-uri href rdf-onsite-end rdf-offsite-end))
((string-match "\\.xml$" href)
(nnrss-match-macro
(nnrss-match-macro
base-uri href xml-onsite-in xml-offsite-in)))))
hrefs)
- (append
+ (append
rss-onsite-end rdf-onsite-end xml-onsite-end
rss-onsite-in rdf-onsite-in xml-onsite-in
rss-offsite-end rdf-offsite-end xml-offsite-end
;; - offsite links containing any of the above
(let* ((base-uri (progn (string-match ".*://[^/]+/?" url)
(match-string 0 url)))
- (hrefs (nnrss-order-hrefs
+ (hrefs (nnrss-order-hrefs
base-uri (nnrss-extract-hrefs parsed-page)))
(rss-link nil))
(while (and (eq rss-link nil) (not (eq hrefs nil)))
(nnrss-find-rss-via-syndic8 url))))))))
(defun nnrss-find-rss-via-syndic8 (url)
- "query syndic8 for the rss feeds it has for the url."
+ "Query syndic8 for the rss feeds it has for URL."
(if (not (locate-library "xml-rpc"))
(progn
(message "XML-RPC is not available... not checking Syndic8.")
'syndic8.FindSites
url)))
(when feedid
- (let* ((feedinfo (xml-rpc-method-call
+ (let* ((feedinfo (xml-rpc-method-call
"http://www.syndic8.com/xmlrpc.php"
'syndic8.GetFeedInfo
feedid))
(urllist
- (delq nil
+ (delq nil
(mapcar
(lambda (listinfo)
- (if (string-equal
+ (if (string-equal
(cdr (assoc "status" listinfo))
"Syndicated")
(cons
(cdr (assoc "sitename" listinfo))
(list
(cons 'title
- (cdr (assoc
+ (cdr (assoc
"sitename" listinfo)))
(cons 'href
(cdr (assoc
(if (not (> (length urllist) 1))
(cdar urllist)
(let ((completion-ignore-case t)
- (selection
+ (selection
(mapcar (lambda (listinfo)
- (cons (cdr (assoc "sitename" listinfo))
- (string-to-int
+ (cons (cdr (assoc "sitename" listinfo))
+ (string-to-int
(cdr (assoc "feedid" listinfo)))))
feedinfo)))
- (cdr (assoc
+ (cdr (assoc
(completing-read
"Multiple feeds found. Select one: "
selection nil t) urllist)))))))))
(defun nnrss-rss-p (data)
- "Test if data is an RSS feed. Simply ensures that the first
-element is rss or rdf."
+ "Test if DATA is an RSS feed.
+Simply ensures that the first element is rss or rdf."
(or (eq (caar data) 'rss)
(eq (caar data) 'rdf:RDF)))
that gives the URI for which you want to retrieve the namespace
prefix), return the prefix."
(let* ((prefix (car (rassoc uri (cadar el))))
- (nslist (if prefix
+ (nslist (if prefix
(split-string (symbol-name prefix) ":")))
(ns (cond ((eq (length nslist) 1) ; no prefix given
"")
:group 'spam-stat)
(defcustom spam-stat-split-fancy-spam-group "mail.spam"
- "Name of the group where spam should be stored, if
-`spam-stat-split-fancy' is used in fancy splitting rules. Has no
-effect when spam-stat is invoked through spam.el."
+ "Name of the group where spam should be stored.
+If `spam-stat-split-fancy' is used in fancy splitting rules. Has
+no effect when spam-stat is invoked through spam.el."
:type 'string
:group 'spam-stat)
(defcustom spam-stat-split-fancy-spam-threshhold 0.9
- "Spam score threshhold in spam-stat-split-fancy."
+ "Spam score threshold in spam-stat-split-fancy."
:type 'number
:group 'spam-stat)
;; Parsing
(defmacro with-spam-stat-max-buffer-size (&rest body)
- "Narrows the buffer down to the first 4k characters, then evaluates BODY."
+ "Narrow the buffer down to the first 4k characters, then evaluate BODY."
`(save-restriction
(when (> (- (point-max)
(point-min))
,@body))
(defun spam-stat-buffer-words ()
- "Return a hash table of words and number of occurences in the buffer."
+ "Return a hash table of words and number of occurrences in the buffer."
(run-hooks 'spam-stat-washing-hook)
(with-spam-stat-max-buffer-size
(with-syntax-table spam-stat-syntax-table
(lambda (word count)
(let ((entry (gethash word spam-stat)))
(if (not entry)
- (error "This buffer has unknown words in it.")
+ (error "This buffer has unknown words in it")
(spam-stat-set-good entry (- (spam-stat-good entry) count))
(spam-stat-set-bad entry (+ (spam-stat-bad entry) count))
(spam-stat-set-score entry (spam-stat-compute-score entry))
(lambda (word count)
(let ((entry (gethash word spam-stat)))
(if (not entry)
- (error "This buffer has unknown words in it.")
+ (error "This buffer has unknown words in it")
(spam-stat-set-good entry (+ (spam-stat-good entry) count))
(spam-stat-set-bad entry (- (spam-stat-bad entry) count))
(spam-stat-set-score entry (spam-stat-compute-score entry))
;; Saving and Loading
(defun spam-stat-save (&optional force)
- "Save the `spam-stat' hash table as lisp file.
+ "Save the `spam-stat' hash table as Lisp file.
With a prefix argument save unconditionally."
(interactive "P")
(when (or force spam-stat-dirty)
(setq spam-stat-dirty t))
(defun spam-stat-install-hooks-function ()
- "Install the spam-stat function hooks"
+ "Install the spam-stat function hooks."
(interactive)
(add-hook 'nnmail-prepare-incoming-message-hook
'spam-stat-store-current-buffer)
(spam-stat-install-hooks-function))
(defun spam-stat-unload-hook ()
- "Uninstall the spam-stat function hooks"
+ "Uninstall the spam-stat function hooks."
(interactive)
(remove-hook 'nnmail-prepare-incoming-message-hook
'spam-stat-store-current-buffer)