diff options
-rw-r--r-- | README.org | 128 | ||||
-rw-r--r-- | docs/screenshot.png | bin | 0 -> 182303 bytes | |||
-rw-r--r-- | docs/screenshot2.png | bin | 0 -> 77964 bytes |
3 files changed, 128 insertions, 0 deletions
diff --git a/README.org b/README.org new file mode 100644 index 0000000..eb5a9eb --- /dev/null +++ b/README.org @@ -0,0 +1,128 @@ +#+STARTUP: align fold hidestars oddeven indent +#+TITLE: Emacs hnreader - Read Hacker News in Emacs +[[http://spacemacs.org][file:https://cdn.rawgit.com/syl20bnr/spacemacs/442d025779da2f62fc86c2082703697714db6514/assets/spacemacs-badge.svg]] + +Front page: + +[[file:docs/screenshot.png]] + +Comments: + +[[file:docs/screenshot2.png]] + +* Intro +This package renders hackernews website at https://news.ycombinator.com/ in an +org buffer. Almost everything works. + +The org-mode buffer feature interactive links similar to html. + +Features that are not supported are account related features. You cannot add +comment, downvote or upvote. + +* Install +Manual: TBD + +Spacemacs layer: + +https://github.com/thanhvg/spacemacs-eos + +* Dependencies +~promise~ and ~request~ are required. +User must have ~org-mode~ 9.2 or later installed also. + +* Commands +~hnreader-news~: Load news page. +~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. +* Remarks +Listing buffer is called ~*HN*~ +Command buffer is called ~*HNComments*~ + +Most of links in Hacker News buffer will run elsip commands on clicking, by default +org-mode will ask you for confirmation. You can disable org confirm message on +clicking +#+begin_example elsip +(setq org-confirm-elisp-link-function nil) +#+end_example + +But it is not recommended by the org-mode guide: just change it to ‘y-or-n-p’ if +you want to confirm with a single keystroke rather than having to type "yes". +* Recommended settings for eww +eww can be used to view story. You may want to set these settings for web page +display inside Emacs: + +#+begin_example elsip +(setq shr-width 75) +(setq shr-use-fonts nil) +#+end_example + +When displaying pictures srolling over them is jumpy. You can try this hack in +your config: +#+begin_src elisp +(with-eval-after-load "shr" + (defun shr-put-image (spec alt &optional flags) + "Insert image SPEC with a string ALT. Return image. +SPEC is either an image data blob, or a list where the first +element is the data blob and the second element is the content-type. +Hack to use `insert-sliced-image' to avoid jerky image scrolling." + (if (display-graphic-p) + (let* ((size (cdr (assq 'size flags))) + (data (if (consp spec) + (car spec) + spec)) + (content-type (and (consp spec) + (cadr spec))) + (start (point)) + (image (cond + ((eq size 'original) + (create-image data nil t :ascent 100 + :format content-type)) + ((eq content-type 'image/svg+xml) + (create-image data 'svg t :ascent 100)) + ((eq size 'full) + (ignore-errors + (shr-rescale-image data content-type + (plist-get flags :width) + (plist-get flags :height)))) + (t + (ignore-errors + (shr-rescale-image data content-type + (plist-get flags :width) + (plist-get flags :height))))))) + (when image + (let* ((image-pixel-cons (image-size image t)) + (image-pixel-width (car image-pixel-cons)) + (image-pixel-height (cdr image-pixel-cons)) + (image-scroll-rows (round (/ image-pixel-height (default-font-height))))) + ;; When inserting big-ish pictures, put them at the + ;; beginning of the line. + (when (and (> (current-column) 0) + (> (car (image-size image t)) 400)) + (insert "\n")) + + (insert-sliced-image image (or alt "*") nil image-scroll-rows 1) + ;; (if (eq size 'original) + ;; (insert-sliced-image image (or alt "*") nil image-scroll-rows 1) + ;; (insert-image image (or alt "*"))) + + (put-text-property start (point) 'image-size size) + (when (and shr-image-animate + (cond ((fboundp 'image-multi-frame-p) + ;; Only animate multi-frame things that specify a + ;; delay; eg animated gifs as opposed to + ;; multi-page tiffs. FIXME? + (cdr (image-multi-frame-p image))) + ((fboundp 'image-animated-p) + (image-animated-p image)))) + (image-animate image nil 60)))) + image) + (insert (or alt ""))))) +#+end_src + +* Demo +TBD + diff --git a/docs/screenshot.png b/docs/screenshot.png Binary files differnew file mode 100644 index 0000000..c38ec96 --- /dev/null +++ b/docs/screenshot.png diff --git a/docs/screenshot2.png b/docs/screenshot2.png Binary files differnew file mode 100644 index 0000000..f29981c --- /dev/null +++ b/docs/screenshot2.png |