Skip to content

Commit

Permalink
Add option to fill window with stories
Browse files Browse the repository at this point in the history
If hackernews-items-per-page is nil, the number of stories is enough
to fill the current window.
  • Loading branch information
nickdrozd committed May 9, 2018
1 parent 309c60c commit 487b21d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions hackernews.el
Original file line number Diff line number Diff line change
Expand Up @@ -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."
:package-version '(hackernews . "0.4.0")
:group 'hackernews
:type 'integer)
Expand Down Expand Up @@ -505,9 +506,10 @@ rendered at the end of the hackernews buffer."
(hackernews--put :register (cons offset ids))
(hackernews--put :items (make-vector
(max 0 (min (- (length ids) offset)
(if n
(prefix-numeric-value n)
hackernews-items-per-page)))
(cond
(n (prefix-numeric-value n))
(hackernews-items-per-page)
(t (1- (window-text-height))))))
()))

(hackernews--retrieve-items)
Expand Down

0 comments on commit 487b21d

Please sign in to comment.