Add option to fill window with stories#45
Conversation
Nice idea.
I assume by "status bar" you mean the mode line and by "minibuffer" you mean its window, i.e. the echo area. Either way, I see various issues with trying to correctly fill the entire window with items:
Perhaps a better way would be to allow (define-advice hackernews (:around (fn &rest args) my-dynamic-height)
"Adapt `hackernews-items-per-page' to current window height."
(let ((hackernews-items-per-page (window-text-height)))
(apply fn args))) |
basil-conto
left a comment
There was a problem hiding this comment.
Just some suggestions for future reference.
| (defcustom hackernews-items-per-page 20 | ||
| "Default number of stories to retrieve in one go." | ||
| "Default number of stories to retrieve in one go. | ||
| If nil, the stories will fill the window." |
There was a problem hiding this comment.
Changes to user options should be accompanied by updates to their :type and :version/:package-version tags.
hackernews.el
Outdated
| (if n | ||
| (prefix-numeric-value n) | ||
| hackernews-items-per-page))) | ||
| (hackernews--calculate-story-count)))) |
There was a problem hiding this comment.
A more Elisp-y way of writing this would have been
(cond (n (prefix-numeric-value n))
(hackernews-items-per-page)
(t (window-text-height)))|
(Just thinking aloud.)
When considering this avenue, we should think about what, if anything, to pass to this function, whether via explicit argument or its environment, e.g. the current buffer, so that the function can make a more educated or flexible calculation. It may, for example, like to know the type of the feed being retrieved. |
|
It's always educational to open a PR here, even if they never get accepted! That advice does what I want, although I changed it to There might still be something here worth pursuing, so I'll leave this open (I've updated it to incorporate your suggestions). Consider it a prototyped feature request. But as I said, the advice works, so feel free to close it. |
If hackernews-items-per-page is nil, the number of stories is enough to fill the current window.
I'll wait to design this option after #40 is fixed, as the latter will entail a large overhaul of the |
If hackernews-items-per-page is nil, the number of stories is three
less than the window height. It isn't the full window height because
that includes the status bar and the minibuffer, and it's annoying to
have to scroll down to see the last few stories.