From: Andrea Zagli Date: Wed, 30 Aug 2017 19:42:20 +0000 (+0200) Subject: Shows feeds list sorted. X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=07914755197ea0227bc4b9af2184fefb6284148d;p=emacs%2Felfeed-speedbar Shows feeds list sorted. --- 07914755197ea0227bc4b9af2184fefb6284148d diff --git a/elfeed-search-speedbar.el b/elfeed-search-speedbar.el new file mode 100644 index 0000000..b00414c --- /dev/null +++ b/elfeed-search-speedbar.el @@ -0,0 +1,63 @@ +;;; elfeed-speedbar --- Speedbar support for elfeed + +;;; Commentary: +;; +;; Speedbar provides a frame in which files, and locations in files +;; are displayed. These functions provide elfeed specific support, +;; showing feeds list in the side-bar. +;; +;; This file requires speedbar. + +;;; Code: + +(require 'elfeed) +(require 'speedbar) + +(defvar elfeed-search-speedbar-key-map nil + "Keymap used when in elfeed display mode.") +(defvar elfeed-search-speedbar-menu-items nil + "Additional menu-items to add to speedbar frame.") + +(defun elfeed-search-install-speedbar-variables () + "Install those variables used by speedbar to enhance elfeed." + (setq elfeed-search-speedbar-key-map (speedbar-make-specialized-keymap)) + (define-key elfeed-search-speedbar-key-map "RET" 'speedbar-edit-line) + (define-key elfeed-search-speedbar-key-map "e" 'speedbar-edit-line)) + +(if (featurep 'speedbar) + (elfeed-search-install-speedbar-variables) + (add-hook 'speedbar-load-hook 'elfeed-search-install-speedbar-variables)) + +(defun elfeed~speedbar-render-feeds-list () + "Insert the list of feeds in the speedbar." + (interactive) + (setq mylist (hash-table-keys elfeed-db-feeds)) + (setq titles (list)) + (dolist (feed mylist) + (setq feed-title (plist-get (elfeed-feed-meta (elfeed-db-get-feed feed)) :title)) + (add-to-list 'titles feed-title)) + (setq titles-sorted (sort titles #'string-lessp)) + (dolist (feed-title titles-sorted) + (speedbar-insert-button + (concat " " feed-title) + 'italic + 'highlight + 'elfeed~speedbar-feed + feed-title))) + +;;;###autoload +(defun elfeed-search-speedbar-buttons (buffer) + "Create buttons for any elfeed BUFFER." + (interactive) + (erase-buffer) + (insert (propertize "* elfeed\n\n" 'face 'italic)) + + (insert (propertize " Bookmarks\n" 'face 'italic)) + ;;;(mu4e~speedbar-render-bookmark-list) + (insert "\n") + (insert (propertize " Feeds\n" 'face 'italic)) + (elfeed~speedbar-render-feeds-list) + ) + +(provide 'elfeed-search-speedbar) +;;; elfeed-search-speedbar.el ends here