From 8a659016a9e3cfd90ef57464da91e0bdb06a5762 Mon Sep 17 00:00:00 2001 From: jao Date: Wed, 10 Nov 2021 23:01:30 +0000 Subject: fix for rss subscriber --- init.org | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'init.org') 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 -- cgit v1.2.3