From dbb494b92233e58276eb27279bc6309447bbeb28 Mon Sep 17 00:00:00 2001 From: Kyrre Havik Date: Mon, 17 Jan 2022 21:59:38 +0100 Subject: [PATCH] feat: custom for using same buffer for output Most time I want to use the same buffer as the list of resource to describe the resource. So instead of changing main window and moving buffers around I just want to use the same window as kubel is running. --- kubel.el | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/kubel.el b/kubel.el index 09f8fb3..a2c9b95 100644 --- a/kubel.el +++ b/kubel.el @@ -159,6 +159,11 @@ off - always assume we cannot list namespaces" :group 'kubel :options '('auto 'on 'off)) +(defcustom kubel-same-buffer 'nil + "Use the same buffer for output." + :type 'boolean + :group 'kubel) + (defun kubel--append-to-process-buffer (str) "Append string STR to the process buffer." (with-current-buffer (get-buffer-create kubel--process-buffer) @@ -464,7 +469,9 @@ READONLY If true buffer will be in readonly mode(view-mode)." :file-handler t :stderr error-buffer :command cmd) - (pop-to-buffer buffer-name) + (if kubel-same-buffer + (pop-to-buffer-same-window buffer-name) + (pop-to-buffer buffer-name)) (if readonly (with-current-buffer buffer-name (view-mode)))))