Skip to content

Customizable news formatting implementation #427

@Dr-Dd

Description

@Dr-Dd

I was seeing how it's not possible to reformat the news differently of how they have been originally set (e.g. one line per news, date, title, feed-title, tags).

I hacked around a bit in the code for elfeed-search.el and got what i was looking for by reordering elfeed-search-print-entry--default and changing the formatting a bit

    [...] 
    (insert (propertize date 'face 'elfeed-search-date-face) " ")
    (when feed-title
      (insert (propertize feed-title 'face 'elfeed-search-feed-face) " "))
    (when tags
      (insert "(" tags-str ")\n"))
    (insert "  " (propertize title-column 'face title-faces 'kbd-help title))
    ))

this attains the result that i wanted (screenshot below), and could be implemented by parsing a format string as in "%Y-%F-%T\n-%f" for obtaining the same result, settable via defcustom.

image

But there are some bugs: for example, interacting with a title by pressing RET, invoking elfeed-search-show-entry (and in turn elfeed-show-entry from elfeed-show.el) still reads the buffer as if news were formatted line per line. I've tried understanding the logic of the function but right now i'm unable to.

[...] from elfeed-search.el [...]

(defun elfeed-search-show-entry (entry)
  "Display the currently selected item in a buffer."
  (interactive (list (elfeed-search-selected :ignore-region)))
  (require 'elfeed-show)
  (when (elfeed-entry-p entry)
    (elfeed-untag entry 'unread)
    (elfeed-search-update-entry entry)
    (unless elfeed-search-remain-on-entry (forward-line))
    (elfeed-show-entry entry)))

[...] from elfeed-show.el [...]

(defun elfeed-show-entry (entry)
  "Display ENTRY in the current buffer."
  (let ((buff (get-buffer-create (elfeed-show--buffer-name entry))))
    (with-current-buffer buff
      (elfeed-show-mode)
      (setq elfeed-show-entry entry)
      (elfeed-show-refresh))
    (funcall elfeed-show-entry-switch buff)))

I suspect the problem is with elfeed-search-selected which would need some reworking.

I'm checking in to see if you (@skeeto) are interested in pulling an eventual patch for this feature, and if you agree with what i said, even give me some of your suggestions and thoughts on the matter.

Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions