aboutsummaryrefslogtreecommitdiff
path: root/hnreader.el
diff options
context:
space:
mode:
authorThanh Vuong <thanhvg@gmail.com>2019-09-08 20:58:44 -0600
committerThanh Vuong <thanhvg@gmail.com>2019-09-08 20:58:44 -0600
commitb764a40be1eb5f7cd1aeecb44b44717fb8d1f0ca (patch)
treeec8f43514c19511e65f285aaf90e215feee19796 /hnreader.el
parent83b806558d96d8839abae26c00d7aec2efd88bb5 (diff)
nav bar on listing pages
Diffstat (limited to 'hnreader.el')
-rw-r--r--hnreader.el17
1 files changed, 17 insertions, 0 deletions
diff --git a/hnreader.el b/hnreader.el
index 63c709f..17ba87d 100644
--- a/hnreader.el
+++ b/hnreader.el
@@ -34,6 +34,7 @@
;; hnreader-past: Load past page.
;; hnreader-ask: Load ask page.
;; hnreader-show: Load show page.
+;; hnreader-newest: Load new link page.
;; hnreader-more: Load more.
;; hnreader-back: Go back to previous page.
@@ -139,6 +140,15 @@ third one is 80.")
"Loading...")))
buf)
+(defun hnreader--print-header ()
+ "Print header links to current buffer."
+ (insert "[[elisp:(hnreader-news)][News]] | ")
+ (insert "[[elisp:(hnreader-newest)][New]] | ")
+ (insert "[[elisp:(hnreader-past)][Past]] | ")
+ (insert "[[elisp:(hnreader-ask)][Ask]] | ")
+ (insert "[[elisp:(hnreader-show)][Show]] | ")
+ (insert "[[elisp:(hnreader-jobs)][Jobs]]"))
+
(defun hnreader--print-frontpage-item (thing subtext)
"Print THING dom and SUBTEXT dom."
(let ((id (dom-attr thing 'id))
@@ -212,6 +222,7 @@ third one is 80.")
(read-only-mode -1)
(erase-buffer)
(insert "#+STARTUP: overview indent\n")
+ (hnreader--print-header)
(insert (hnreader--get-route-top-info dom))
(cl-mapcar #'hnreader--print-frontpage-item things subtexts)
;; (setq-local org-confirm-elisp-link-function nil)
@@ -351,6 +362,12 @@ Also upate `hnreader--history'."
(hnreader-read-page "https://news.ycombinator.com/front"))
;;;###autoload
+(defun hnreader-newest()
+ "Read past page."
+ (interactive)
+ (hnreader-read-page "https://news.ycombinator.com/newest"))
+
+;;;###autoload
(defun hnreader-ask ()
"Read ask page."
(interactive)