Function: newsticker-opml-export

newsticker-opml-export is an interactive and byte-compiled function defined in newst-backend.el.gz.

Signature

(newsticker-opml-export)

Documentation

OPML subscription export.

Export subscriptions to a buffer in OPML Format.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/net/newst-backend.el.gz
;; ======================================================================
;;; OPML
;; ======================================================================
(defun newsticker-opml-export ()
  "OPML subscription export.
Export subscriptions to a buffer in OPML Format."
  (interactive)
  (with-current-buffer (get-buffer-create "*OPML Export*")
    (erase-buffer)
    (set-buffer-file-coding-system 'utf-8)
    (insert (concat
             "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
             "<!-- OPML generated by Emacs newsticker.el -->\n"
             "<opml version=\"1.0\">\n"
             "  <head>\n"
             "    <title>Emacs newsticker subscriptions</title>\n"
             "    <dateCreated>" (format-time-string "%a, %d %b %Y %T %z")
             "</dateCreated>\n"
             "    <ownerEmail>" user-mail-address "</ownerEmail>\n"
             "    <ownerName>" (user-full-name) "</ownerName>\n"
             "  </head>\n"
             "  <body>\n"))
    (let ((feeds (append newsticker-url-list newsticker-url-list-defaults))
          ;; insert the feed groups and all feeds that are contained
          (saved-feed-names (newsticker--opml-insert-elt newsticker-groups 2)))
      ;; to be safe: insert all feeds that are not contained in any group
      (dolist (f feeds)
        (unless (seq-find (lambda (sfn) (string= (car f) sfn)) saved-feed-names)
          (newsticker--opml-insert-feed (car f) 4)))
      (insert "  </body>\n</opml>\n")))
  (pop-to-buffer "*OPML Export*")
  (sgml-mode))