summaryrefslogtreecommitdiff
path: root/lisp/gnus/nnrss.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/gnus/nnrss.el')
-rw-r--r--lisp/gnus/nnrss.el53
1 files changed, 28 insertions, 25 deletions
diff --git a/lisp/gnus/nnrss.el b/lisp/gnus/nnrss.el
index 95c07efa203..8115057723c 100644
--- a/lisp/gnus/nnrss.el
+++ b/lisp/gnus/nnrss.el
@@ -37,10 +37,11 @@
(require 'mm-url)
(require 'rfc2047)
(require 'mml)
-(eval-when-compile
- (ignore-errors
- (require 'xml)))
-(eval '(require 'xml))
+(require 'xml)
+
+(defgroup nnrss nil
+ "RSS access for Gnus."
+ :group 'gnus)
(nnoo-declare nnrss)
@@ -89,14 +90,16 @@ The arguments are (ENTRY GROUP ARTICLE).
ENTRY is the record of the current headline. GROUP is the group name.
ARTICLE is the article number of the current headline.")
-(defvar nnrss-file-coding-system mm-universal-coding-system
- "*Coding system used when reading and writing files.
+(defcustom nnrss-file-coding-system mm-universal-coding-system
+ "Coding system used when reading and writing files.
If you run Gnus with various versions of Emacsen, the value of this
variable should be the coding system that all those Emacsen support.
Note that you have to regenerate all the nnrss groups if you change
the value. Moreover, you should be patient even if you are made to
read the same articles twice, that arises for the difference of the
-versions of xml.el.")
+versions of xml.el."
+ :group 'nnrss
+ :type 'coding-system)
(defvar nnrss-compatible-encoding-alist
(delq nil (mapcar (lambda (elem)
@@ -114,11 +117,11 @@ for decoding when the cdr that the data specify is not available.")
;;; Interface functions
(defsubst nnrss-format-string (string)
- (gnus-replace-in-string string " *\n *" " "))
+ (replace-regexp-in-string " *\n *" " " string))
(defun nnrss-decode-group-name (group)
(if (and group (mm-coding-system-p 'utf-8))
- (setq group (mm-decode-coding-string group 'utf-8))
+ (setq group (decode-coding-string group 'utf-8))
group))
(deffoo nnrss-retrieve-headers (articles &optional group server fetch-old)
@@ -243,7 +246,6 @@ for decoding when the cdr that the data specify is not available.")
(max 1 (/ (* (window-width window) 7) 8))))
(fill-region (point) (point-max))
(goto-char (point-max))
- ;; XEmacs version of `fill-region' inserts newline.
(unless (bolp)
(insert "\n"))))
(when (or link enclosure)
@@ -295,7 +297,7 @@ for decoding when the cdr that the data specify is not available.")
(let ((rfc2047-encoding-type 'mime)
rfc2047-encode-max-chars)
(rfc2047-encode-string
- (gnus-replace-in-string group "[\t\n ]+" "_")))))
+ (replace-regexp-in-string "[\t\n ]+" "_" group)))))
(when nnrss-content-function
(funcall nnrss-content-function e group article))))
(cond
@@ -372,8 +374,6 @@ for decoding when the cdr that the data specify is not available.")
(nnoo-define-skeleton nnrss)
;;; Internal functions
-(eval-when-compile (defun xml-rpc-method-call (&rest args)))
-
(defun nnrss-get-encoding ()
"Return an encoding attribute specified in the current xml contents.
If `nnrss-compatible-encoding-alist' specifies the compatible encoding,
@@ -417,7 +417,7 @@ otherwise return nil."
;; Decode text according to the encoding attribute.
(when (setq cs (nnrss-get-encoding))
(insert (prog1
- (mm-decode-coding-string (buffer-string) cs)
+ (decode-coding-string (buffer-string) cs)
(erase-buffer)
(mm-enable-multibyte))))
(goto-char (point-min))
@@ -588,12 +588,11 @@ which RSS 2.0 allows."
"")
(defun nnrss-insert (url)
- (mm-with-unibyte-current-buffer
- (condition-case err
- (mm-url-insert url)
- (error (if (or debug-on-quit debug-on-error)
- (signal (car err) (cdr err))
- (message "nnrss: Failed to fetch %s" url))))))
+ (condition-case err
+ (mm-url-insert url)
+ (error (if (or debug-on-quit debug-on-error)
+ (signal (car err) (cdr err))
+ (message "nnrss: Failed to fetch %s" url)))))
(defun nnrss-decode-entities-string (string)
(if string
@@ -763,7 +762,7 @@ Read the file and attempt to subscribe to each Feed in the file."
Export subscriptions to a buffer in OPML Format."
(interactive)
(with-current-buffer (get-buffer-create "*OPML Export*")
- (mm-set-buffer-file-coding-system 'utf-8)
+ (set-buffer-file-coding-system 'utf-8)
(insert "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
"<!-- OPML generated by Emacs Gnus' nnrss.el -->\n"
"<opml version=\"1.1\">\n"
@@ -810,10 +809,11 @@ It is useful when `(setq nnrss-use-local t)'."
(nnrss-node-just-text node)
node))
(cleaned-text (if text
- (gnus-replace-in-string
- (gnus-replace-in-string
- text "^[\000-\037\177]+\\|^ +\\| +$" "")
- "\r\n" "\n"))))
+ (replace-regexp-in-string
+ "\r\n" "\n"
+ (replace-regexp-in-string
+ "^[\000-\037\177]+\\|^ +\\| +$" ""
+ text)))))
(if (string-equal "" cleaned-text)
nil
cleaned-text)))
@@ -959,6 +959,9 @@ Use Mark Pilgrim's `ultra-liberal rss locator'."
;; 4. check syndic8
(nnrss-find-rss-via-syndic8 url))))))))
+(declare-function xml-rpc-method-call "ext:xml-rpc"
+ (server-url method &rest params))
+
(defun nnrss-find-rss-via-syndic8 (url)
"Query syndic8 for the rss feeds it has for URL."
(if (not (locate-library "xml-rpc"))