From 6df795e121ef7dd2cc062890dae1e8962a11b46d Mon Sep 17 00:00:00 2001 From: Thanh Vuong Date: Thu, 29 Aug 2019 23:34:10 -0600 Subject: a bit smart on picking window to display buffer --- TODOs.org | 5 ++++- hnreader.el | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/TODOs.org b/TODOs.org index 94649f0..570c90a 100644 --- a/TODOs.org +++ b/TODOs.org @@ -108,4 +108,7 @@ 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 +use pop-to-buffer isn't what we want, pop-to-buffer-same-window looks the same +as switch-to-buffer display-buffer returns windows most of the time, so use it +instead with select-window + (select-window (display-buffer buf '(display-buffer-use-some-window))) diff --git a/hnreader.el b/hnreader.el index 21c4671..92e67ed 100644 --- a/hnreader.el +++ b/hnreader.el @@ -127,7 +127,7 @@ third one is 80.") (when (not (equal (window-buffer) buf)) (if hnreader-view-comments-in-same-window ;; (switch-to-buffer buf) - (pop-to-buffer buf) + (select-window (display-buffer buf '(display-buffer-use-some-window))) (switch-to-buffer-other-window buf))) ;; (display-buffer buf '(display-buffer-use-some-window (inhibit-same-window . t)))) (with-current-buffer buf -- cgit v1.2.3