-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to fill window with stories #45
base: master
Are you sure you want to change the base?
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))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some suggestions for future reference.
@@ -75,7 +75,8 @@ | |||
'hackernews-items-per-page "0.4.0") | |||
|
|||
(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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes to user options should be accompanied by updates to their :type
and :version
/:package-version
tags.
hackernews.el
Outdated
@@ -507,7 +513,7 @@ rendered at the end of the hackernews buffer." | |||
(max 0 (min (- (length ids) offset) | |||
(if n | |||
(prefix-numeric-value n) | |||
hackernews-items-per-page))) | |||
(hackernews--calculate-story-count)))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.