emacs-opml-to-elfeed-feeds

Unnamed repository; edit this file 'description' to name the repository.
git clone https://kaka.farm/~git/emacs-opml-to-elfeed-feeds/
Log | Files | Refs | README | LICENSE

commit 80245f41431d8859a388f07a130081782b573bb9
parent aa711993b6ba12a93c8e55649e6b86384ea5d69c
Author: Yuval Langer <yuval.langer@gmail.com>
Date:   Sat, 29 Jun 2024 02:15:34 +0300

Rename package in the Emacs Lisp source.

Diffstat:
Mopml-to-elfeed-feeds.el | 68++++++++++++++++++++++++++++++++++----------------------------------
1 file changed, 34 insertions(+), 34 deletions(-)

diff --git a/opml-to-elfeed-feeds.el b/opml-to-elfeed-feeds.el @@ -1,11 +1,11 @@ -;;; get-craftering-opml.el --- Gets you the elfeed-list of the Craftering. -*- lexical-binding: t; -*- +;;; opml-to-elfeed-feeds.el --- Deals with OPMLs and their conversion to the Elfeed elfeed-feeds datatype. -*- lexical-binding: t; -*- ;; Copyright (C) 2024 Yuval Langer ;; Author: Yuval Langer <yuval.langer@gmail.com> ;; Version: 0.0.0 ;; Keywords: TODO -;; URL: https://codeberg.org/kakafarm/emacs-get-craftering-opml/ +;; URL: https://codeberg.org/kakafarm/emacs-opml-to-elfeed-feeds/ ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -28,7 +28,7 @@ ;;; Code: -(defcustom gco-opml-list +(defcustom o2e-opml-list '(("https://craftering.systemcrafters.net/Craftering.opml" blog craftering) ("https://planet.debian.org/opml.xml" blog debian planet)) "A list holding the OPML URLs. @@ -41,19 +41,19 @@ The tags would be attached to each feed in the OPML file." '(repeat (choice string (cons string (repeat symbol))))) -(defcustom gco-elfeed-feeds +(defcustom o2e-elfeed-feeds '() "The GCO `elfeed-feeds'." :type '(repeat (choice string (cons string (repeat symbol))))) -(defun gco--blogger-name-to-symbol (blogger-name) +(defun o2e--blogger-name-to-symbol (blogger-name) (intern (downcase (replace-regexp-in-string "[ .()]+" "-" blogger-name)))) -(defun gco--response-body-position (response-buffer) +(defun o2e--response-body-position (response-buffer) (with-current-buffer response-buffer (named-let loop ((position 1)) (cond @@ -67,9 +67,9 @@ The tags would be attached to each feed in the OPML file." (t (loop (1+ position))))))) -(defun gco--parse-response-buffer-to-xml (response-buffer) +(defun o2e--parse-response-buffer-to-xml (response-buffer) (with-current-buffer response-buffer - (let ((start (gco--response-body-position response-buffer)) + (let ((start (o2e--response-body-position response-buffer)) (end (buffer-end 1))) ;; (xml-parse-region beg ;; end @@ -77,18 +77,18 @@ The tags would be attached to each feed in the OPML file." (libxml-parse-xml-region start end)))) -(defun gco--xml-to-opml-outlines (xml) +(defun o2e--xml-to-opml-outlines (xml) (pcase (assq 'body xml) ;; TODO: What the hell is this? (`(body ,TODO-WHAT-THE-HELL-IS-THIS? . ,outlines) outlines))) -(cl-defun gco--response-buffer-to-elfeed-feed (response-buffer +(cl-defun o2e--response-buffer-to-elfeed-feed (response-buffer &key (tags '()) (tag-blogger-name? '())) - (let* ((xml (gco--parse-response-buffer-to-xml response-buffer)) - (outlines (gco--xml-to-opml-outlines xml))) + (let* ((xml (o2e--parse-response-buffer-to-xml response-buffer)) + (outlines (o2e--xml-to-opml-outlines xml))) (named-let loop ((outlines outlines) (accumulator '())) (cond @@ -103,7 +103,7 @@ The tags would be attached to each feed in the OPML file." outline-values))) (xml-url (cdr (assq 'xmlUrl outline-values))) - (blogger-name-tag (gco--blogger-name-to-symbol text)) + (blogger-name-tag (o2e--blogger-name-to-symbol text)) (all-tags (elfeed-normalize-tags (if tag-blogger-name? (list blogger-name-tag) @@ -123,7 +123,7 @@ The tags would be attached to each feed in the OPML file." (loop (cdr outlines) accumulator)))))) -(defun gco--elfeed-feeds-entry-url (elfeed-feeds-entry) +(defun o2e--elfeed-feeds-entry-url (elfeed-feeds-entry) "Takes an `elfeed-feeds' kind of entry as ELFEED-FEEDS-ENTRY and return its URL." (pcase elfeed-feeds-entry (`(,url . ,tags) @@ -131,7 +131,7 @@ The tags would be attached to each feed in the OPML file." (url url))) -(defun gco--elfeed-feeds-entry-tags (elfeed-feeds-entry) +(defun o2e--elfeed-feeds-entry-tags (elfeed-feeds-entry) "Takes an `elfeed-feeds' kind of entry as ELFEED-FEEDS-ENTRY and return its list of tags." (pcase elfeed-feeds-entry (`(,url . ,tags) @@ -139,7 +139,7 @@ The tags would be attached to each feed in the OPML file." (url '()))) -(defun gco--hash-table-to-alist (hash-table) +(defun o2e--hash-table-to-alist (hash-table) "Convert an hash-table HASH-TABLE to a list. TODO: There MUST be a standard function for that, right? Send a @@ -151,7 +151,7 @@ patch if you know." (sort (hash-table-keys hash-table) 'string<))) -(defun gco--normalise-elfeed-feeds (elfeed-feeds) +(defun o2e--normalise-elfeed-feeds (elfeed-feeds) (let (;; XXX: Pass ":test 'equal" into make-hash-table so that ;; string comparisons work, otherwise it'll put many of the ;; same string as keys, each with its own values, like: @@ -163,8 +163,8 @@ patch if you know." ('() '()) (`(,entry . ,rest-of-entries) - (let* ((url (gco--elfeed-feeds-entry-url entry)) - (entry-tags (gco--elfeed-feeds-entry-tags entry)) + (let* ((url (o2e--elfeed-feeds-entry-url entry)) + (entry-tags (o2e--elfeed-feeds-entry-tags entry)) (hash-tags (gethash url hash '())) @@ -174,14 +174,14 @@ patch if you know." merged-tags hash) (loop rest-of-entries))))) - (gco--hash-table-to-alist hash))) + (o2e--hash-table-to-alist hash))) -(defun gco--update-gco-efleed-feeds () +(defun o2e--update-o2e-efleed-feeds () "TODO: This here supposed to take the opmls and add and dedup the GCO elfeed-feeds" - (let ((our-elfeed-feeds gco-elfeed-feeds)) + (let ((our-elfeed-feeds o2e-elfeed-feeds)) (dolist (opml-list-entry - gco-opml-list - (setq gco-elfeed-feeds (gco--normalise-elfeed-feeds + o2e-opml-list + (setq o2e-elfeed-feeds (o2e--normalise-elfeed-feeds (apply 'append our-elfeed-feeds)))) (let* ((url+tags (cond @@ -200,21 +200,21 @@ patch if you know." (tags (cdr url+tags)) (response-buffer (url-retrieve-synchronously url))) (setq our-elfeed-feeds - (cons (gco--response-buffer-to-elfeed-feed response-buffer + (cons (o2e--response-buffer-to-elfeed-feed response-buffer :tags tags) our-elfeed-feeds)))))) ;;; XXX: Manual testing AHOY! -;; gco-elfeed-feeds -;; (gco--update-gco-efleed-feeds) -;; (setq craftering (url-retrieve-synchronously (caar gco-opml-list))) -;; (gco--response-buffer-to-elfeed-feed craftering :tags (cdar gco-opml-list)) -;; (setq debian-planet (url-retrieve-synchronously (caadr gco-opml-list))) -;; (gco--response-buffer-to-elfeed-feed debian-planet :tags (cdadr gco-opml-list)) +;; o2e-elfeed-feeds +;; (o2e--update-o2e-efleed-feeds) +;; (setq craftering (url-retrieve-synchronously (caar o2e-opml-list))) +;; (o2e--response-buffer-to-elfeed-feed craftering :tags (cdar o2e-opml-list)) +;; (setq debian-planet (url-retrieve-synchronously (caadr o2e-opml-list))) +;; (o2e--response-buffer-to-elfeed-feed debian-planet :tags (cdadr o2e-opml-list)) -(provide 'get-craftering-opml) +(provide 'opml-to-elfeed-feeds) ;; Local Variables: -;; read-symbol-shorthands: (("gco-" . "get-craftering-opml-")) +;; read-symbol-shorthands: (("o2e-" . "opml-to-elfeed-feeds-")) ;; End: -;;; get-craftering-opml.el ends here +;;; opml-to-elfeed-feeds.el ends here