summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2021-11-10 23:01:30 +0000
committerjao <jao@gnu.org>2021-11-10 23:02:11 +0000
commit8a659016a9e3cfd90ef57464da91e0bdb06a5762 (patch)
treecdb1f69c68bb58dc832ca5c96cc5ff0dee68fed9
parent89e738b464a53817b5b5ab473563783dd407c8bb (diff)
downloadelibs-8a659016a9e3cfd90ef57464da91e0bdb06a5762.tar.gz
elibs-8a659016a9e3cfd90ef57464da91e0bdb06a5762.tar.bz2
fix for rss subscriber
-rw-r--r--init.org42
1 files changed, 21 insertions, 21 deletions
diff --git a/init.org b/init.org
index a3577e8..0a92b75 100644
--- a/init.org
+++ b/init.org
@@ -1543,21 +1543,23 @@
(autoload 'View-quit "view")
(defun jao-rss--find-url ()
- (when (derived-mode-p 'w3m-mode 'eww-mode)
- (save-excursion
- (if (fboundp 'w3m-view-source) (w3m-view-source) (eww-view-source))
- (goto-char (point-min))
- (when (re-search-forward
- "type=\"application/\\(?:atom\\|rss\\)\\+xml\" +" nil t)
- (let ((url (save-excursion
- (when (re-search-forward
- "href=\"\\([^\n\"]+\\)\"" nil t)
- (match-string-no-properties 1))))
- (title (when (re-search-forward
- "\\(?:title=\"\\([^\n\"]+\\)\" +\\)" nil t)
- (match-string-no-properties 1))))
- (if (fboundp 'w3m-view-mode) (w3m-view-source) (View-quit))
- (when url (cons url (or title ""))))))))
+ (save-excursion
+ (when (derived-mode-p 'w3m-mode 'eww-mode)
+ (if (fboundp 'w3m-view-source) (w3m-view-source) (eww-view-source)))
+ (goto-char (point-min))
+ (when (re-search-forward
+ "type=\"application/\\(?:atom\\|rss\\)\\+xml\" +" nil t)
+ (let ((url (save-excursion
+ (when (re-search-forward
+ "href=\"\\([^\n\"]+\\)\"" nil t)
+ (match-string-no-properties 1))))
+ (title (when (re-search-forward
+ "\\(?:title=\"\\([^\n\"]+\\)\" +\\)" nil t)
+ (match-string-no-properties 1))))
+ (cond ((derived-mode-p 'w3m-view-mode) (w3m-view-source))
+ ((string-match-p ".*\\*eww-source\\b.*" (buffer-name))
+ (View-quit)))
+ (when url (cons url (or title "")))))))
(defun jao-rss2e-append (name url mbox)
(with-current-buffer (find-file-noselect "~/.config/rss2email.cfg")
@@ -1569,12 +1571,10 @@
(defun jao-rss-subscribe (url)
"Subscribe to a given RSS URL. If URL not given, look for it."
- (interactive "sURL: ")
- (let* ((url (or url
- (jao-url-around-point)
- (jao-rss--find-url)
- (read-string "Feed URL: ")))
- (url+title (if (consp url) url (list url)))
+ (interactive (list (or (jao-url-around-point)
+ (jao-rss--find-url)
+ (read-string "Feed URL: "))))
+ (let* ((url+title (if (consp url) url (list url)))
(url (car url+title))
(title (cdr url+title)))
(if url