Preview messages in Summary buffer

Skip to first unread message

Jun 23, 2020, 8:40:45 AM6/23/20

Just wanting to share a QnD hack I cobbled together when I was supposed to be marking theses today. It's still plenty rough around the edges but as a proof of concept it works reasonably well.

TL;DR: I wanted to be able to preview messages in the summary buffer so that I did not have to open an article window just to realise that it wasn't the message I was after. So I bound this to the key 'v' in gnus-summary-mode-map:

(defconst oxpecker-preview-lines 10)

(defun oxpecker-remove-empty-lines ()
(while (re-search-forward "^ *\n" nil t)
(replace-match ""))))

(defun oxpecker-wash-message (msg-buf)
(let (beg end)
(insert-buffer msg-buf)
(setq beg (point))
(insert "\n")
(forward-line oxpecker-preview-lines)
(setq end (point))
(buffer-substring beg end))))

(defun oxpecker-preview-message ()
(let ((gnus-inhibit-treatment t))
(let ((end (point-at-eol))
(msg (oxpecker-wash-message gnus-article-buffer)))
(momentary-string-display msg end ?v "Previewing Message. Press any key to continue."))))

TODO: It still opens the article window, I would prefer if I could to this entirely in the background. =gnus-request-article-this-buffer= would help, but then I need to parse the article in its entirety and that sounds like work.

Reply all
Reply to author
0 new messages