Join GitHub today
[feature] more status in the mode line #111
The first line at the top of the search buffer currently shows the last updated date of the db. I'd like to know:
There's also the issue of where to put it.
Perhaps one day elfeed's search mode might derive from tabulated-list-mode, like the package list view built-in to Emacs, and the header will become column headers? So here's a quick sketch of how to add the data to the mode line:
It works well in conjunction with the toggles in #109 - you can see how the number of feeds goes up/down as you toggle unread/date.
I really like the idea of putting the current search filter in there.
And, holy crap, I didn't know about header-line-format! I should have
I'm not a fan of putting important information in the modeline. It's
added a commit
Nov 25, 2015
I like the way you've moved the search filter to the right so that the header doesn't jump around as as you modify the filter.
Maybe more info could be added about the db status. Currently:
One feed has failed to update. A tool-tip could explain: 100 entries download from 9 of 10 feeds, 1 feed failed, and clicking this area would update just those 10 feeds, which in this branch would be all feeds but in #109 a subset. This last batch of feeds updated could also be re-run with C-u C-u G. No more problem with feeds missing due to having all entries filtered out. (Maybe re-run just the feeds with errors with C-u C-u C-u G or is that a step too far...?)
Maybe the 90/100:10 status count and search filter should be fontified the same way. There's really two concepts: the database and the sub-set on display. Colouring the two halves would emphasise that. A tool-tip could explain: filtering 90 unread of 100 entries from 10 feeds.
It would be really nice if we could override the header function. Something along these lines:
(defvar elfeed-search-header-function #'elfeed-search--header "Function that returns the string to be used for the Elfeed header.")
And then use
I'll pull up a branch with this change, and possibly with some alternative header examples.
Managed to come up with this so far:
(defun elfeed-search--stats () "Count the number of entries and feeds being currently displayed." (if (and elfeed-search-filter-active elfeed-search-filter-overflowing) (list 0 0 0) (cl-loop with feeds = (make-hash-table :test 'equal) for entry in elfeed-search-entries for feed = (elfeed-entry-feed entry) for url = (elfeed-feed-url feed) count entry into entry-count count (elfeed-tagged-p 'unread entry) into unread-count do (puthash url t feeds) finally (cl-return (list unread-count entry-count (hash-table-count feeds)))))) (defun my-elfeed-search--header () "Returns the string to be used as the Elfeed header." (let* ((separator-left (intern (format "powerline-%s-%s" (powerline-current-separator) (car powerline-default-separator-dir)))) (separator-right (intern (format "powerline-%s-%s" (powerline-current-separator) (cdr powerline-default-separator-dir))))) (cond ((zerop (elfeed-db-last-update)) (elfeed-search--intro-header)) (url-queue (let* ((total (length url-queue)) (in-process (cl-count-if #'url-queue-buffer url-queue)) (center (list (funcall separator-left 'mode-line 'powerline-active2) (powerline-raw (format " %d feeds pending, %d in process ... " total in-process) 'powerline-active2) (funcall separator-right 'powerline-active2 'mode-line)))) (concat (powerline-fill-center nil (/ (powerline-width center) 2.0)) (powerline-render center)))) ((let* ((db-time (seconds-to-time (elfeed-db-last-update))) (update (format-time-string "%Y-%m-%d %H:%M:%S %z" db-time)) (stats (elfeed-search--stats)) (search-filter (cond (elfeed-search-filter-active "") (elfeed-search-filter elfeed-search-filter) (""))) (lhs (list (powerline-raw (concat search-filter " ") 'powerline-active1 'l) (funcall separator-right 'powerline-active1 'mode-line))) (center (list (funcall separator-left 'mode-line 'powerline-active2) (destructuring-bind (unread entry-count feed-count) stats (propertize (format " %d/%d:%d " unread entry-count feed-count) 'face 'powerline-active2 'help-echo (format "%d unread entries\n%d total entries\n%d feeds" unread entry-count feed-count))) (funcall separator-right 'powerline-active2 'mode-line))) (rhs (list (funcall separator-left 'mode-line 'powerline-active1) (powerline-raw (concat " " update) 'powerline-active1 'r)))) (concat (powerline-render lhs) (powerline-fill-center nil (/ (powerline-width center) 2.0)) (powerline-render center) (powerline-fill nil (powerline-width rhs)) (powerline-render rhs))))))) (setq elfeed-search-header-function #'my-elfeed-search--header)
added a commit
Nov 30, 2015
In order to display the failure information in the header Elfeed actually needs to capture it first (#113). Right now it's just dumped in the message buffer. I'm going to merge what we've got so far into master.