From 20ab1acb6c66ed0f7ad5824634c071b351ed3f8a Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 9 Dec 2015 02:09:47 -0500 Subject: [PATCH] Better REPL/popwin integration --- core/core-popup.el | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/core/core-popup.el b/core/core-popup.el index c526b7fd8..56df2b13d 100644 --- a/core/core-popup.el +++ b/core/core-popup.el @@ -31,8 +31,10 @@ ("*Agenda Commands*" :position bottom :height 0.5) (" *Org todo*" :position bottom :height 5) ("*Org Links*" :position bottom :height 2) - ("*ruby*" :position bottom :height 0.3 :stick t) - ("*ielm*" :position bottom :height 0.3 :stick t) + + ;; REPLs + ((lambda (buffer) (with-current-buffer buffer (derived-mode-p 'comint-mode))) + :position bottom :height 0.2 :stick t) )) (popwin-mode 1) @@ -147,8 +149,15 @@ (if buffer (eq buffer popwin:popup-buffer) t))) (defun narf/popup-close () - (when (popwin:popup-window-live-p) - (popwin:close-popup-window t))) + (let ((popup-p (popwin:popup-window-live-p)) + (comint-p (derived-mode-p 'comint-mode))) + (when comint-p + (when (eq rtog/--last-buffer (current-buffer)) + (setq rtog/--last-buffer nil + narf-repl-buffer nil)) + (kill-this-buffer)) + (when popup-p + (popwin:close-popup-window t)))) (defun narf/popup-open (buffer &optional height) (popwin:popup-buffer buffer))