aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThanh Vuong <thanhvg@gmail.com>2019-08-29 23:06:47 -0600
committerThanh Vuong <thanhvg@gmail.com>2019-08-29 23:06:47 -0600
commit1006f0191fe6482b368e6267d04b59e3cda014ae (patch)
tree40e78392429cb425c3da37b74fdfef1fa6c1fa57
parent4a2b130527934e8900920c56ec4ed716e4167040 (diff)
use pop-to-buffer by default
-rw-r--r--TODOs.org4
-rw-r--r--hnreader.el14
2 files changed, 15 insertions, 3 deletions
diff --git a/TODOs.org b/TODOs.org
index 63d729f..94649f0 100644
--- a/TODOs.org
+++ b/TODOs.org
@@ -57,7 +57,7 @@ just a private flag on running
* DONE comment page show main link and intro text
* DONE display page takes page number
-* TODO reload page
+* DONE reload page
* DONE frontpage has next page link
* DONE remove * in text
find and replace raw htlm '>*' with '>-'
@@ -107,3 +107,5 @@ class fatitem is 4 long when ask it's 6 items long
just take from 1 to the peniculate item with seq-take and seq-drop
* DONE add back (history) button
a variable to hold history
+* DONE option to open comment in same window
+use pop-to-buffer
diff --git a/hnreader.el b/hnreader.el
index ac89419..21c4671 100644
--- a/hnreader.el
+++ b/hnreader.el
@@ -39,6 +39,8 @@
;;; Customization
;; hnreader-history-max: max number history items to remember.
+;; hnreader-view-comments-in-same-window: if nil then will not create new window
+;; when viewing comments
;;; Code:
(require 'promise)
@@ -58,7 +60,12 @@
(defcustom hnreader-history-max 100
"Max history to remember."
- :type 'number
+ :type 'integer
+ :group 'hnreader)
+
+(defcustom hnreader-view-comments-in-same-window t
+ "Max history to remember."
+ :type 'boolean
:group 'hnreader)
;; internal stuff
@@ -118,7 +125,10 @@ third one is 80.")
(defun hnreader--prepare-buffer (buf &optional msg)
"Print MSG message and prepare window for BUF buffer."
(when (not (equal (window-buffer) buf))
- (switch-to-buffer-other-window buf))
+ (if hnreader-view-comments-in-same-window
+ ;; (switch-to-buffer buf)
+ (pop-to-buffer buf)
+ (switch-to-buffer-other-window buf)))
;; (display-buffer buf '(display-buffer-use-some-window (inhibit-same-window . t))))
(with-current-buffer buf
(read-only-mode -1)