From 49dd44be530946e0345a8ef487b18bf1654621ba Mon Sep 17 00:00:00 2001 From: SqrtMinusOne Date: Sat, 10 Dec 2022 14:07:35 +0300 Subject: [PATCH] fix: workaround for magit-section-toggle --- elfeed-summary.el | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/elfeed-summary.el b/elfeed-summary.el index 42d6401..ec33690 100644 --- a/elfeed-summary.el +++ b/elfeed-summary.el @@ -984,6 +984,20 @@ The return value is a list of alists of the following elements: (defvar elfeed-summary--search-mark-read nil "If t, mark the feed as read instead of switching to it.") +(defun elfeed-summary--magit-section-toggle-workaround (section) + "`magit-section-toggle' with a workaround for invisible lines. + +SECTION is an instance of `magit-section'. + +No idea what I'm doing wrong, but this seems to help." + (interactive (list (save-excursion + (let ((lines (count-lines (point-min) (point-max)))) + (while (and (invisible-p (point)) + (< (line-number-at-pos) lines)) + (forward-line 1))) + (magit-current-section)))) + (magit-section-toggle section)) + (defvar elfeed-summary-mode-map (let ((map (make-sparse-keymap))) (set-keymap-parent map magit-section-mode-map) @@ -994,9 +1008,10 @@ The return value is a list of alists of the following elements: (define-key map (kbd "R") #'elfeed-summary-update) (define-key map (kbd "u") #'elfeed-summary-toggle-only-unread) (define-key map (kbd "U") #'elfeed-summary--action-mark-read) + (define-key map (kbd "") #'elfeed-summary--magit-section-toggle-workaround) (when (fboundp #'evil-define-key*) (evil-define-key* 'normal map - (kbd "") #'magit-section-toggle + (kbd "") #'elfeed-summary--magit-section-toggle-workaround "r" #'elfeed-summary--refresh "R" #'elfeed-summary-update "u" #'elfeed-summary-toggle-only-unread