From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jack Kamm Subject: Re: [RFC PATCH] Changes to pop-up source buffers Date: Tue, 21 Jan 2020 21:06:12 -0800 Message-ID: <87muagnkqj.fsf@gmail.com> References: <878sm4nn67.fsf@kyleam.com> <87a76jmksn.fsf@gmail.com> <875zh55u1f.fsf@kyleam.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:56515) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iu8ER-00050P-Pw for emacs-orgmode@gnu.org; Wed, 22 Jan 2020 00:07:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iu8EQ-0006oW-MB for emacs-orgmode@gnu.org; Wed, 22 Jan 2020 00:07:11 -0500 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]:44928) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iu8EQ-0006nb-Bz for emacs-orgmode@gnu.org; Wed, 22 Jan 2020 00:07:10 -0500 Received: by mail-pf1-x441.google.com with SMTP id 62so2723506pfu.11 for ; Tue, 21 Jan 2020 21:07:09 -0800 (PST) In-Reply-To: <875zh55u1f.fsf@kyleam.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane-mx.org@gnu.org Sender: "Emacs-orgmode" To: Kyle Meyer , emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain > I suppose that to some degree [*] the main benefit of this patch is that > it offers an option that calls quit-restore-window. Yes, I agree with this. Setting org-src-window-setup to other-window was almost good enough for me -- it even respected display-buffer-base-action -- except that it wouldn't close the popped up window. > And that makes me think that the current options that go through a > simple display-buffer-based call (current-window and other-window) would > benefit from calling quit-restore-window like your `plain` option does. > If you agree, perhaps it's worth adding another patch on top that does > that. I agree other-window would benefit from quit-restore-window, it makes sense to close the existing window if it's been popped up. I'm less sure about current-window. We could certainly call quit-restore-window here, but I'm not sure there's any benefit, as it shouldn't open new windows that need to be closed (unless you're modifying display-buffer-alist, in which case the `plain' option should be preferred anyways). I'm also hesitant because Samuel relies on this option for accessibility reasons, and if I accidentally introduced a bug, I might not immediately notice, since I don't use this option. I've attached a patch on top of my previous one, calling quit-restore-window when using other-window, but leaving current-window alone. > Hmm, weird. I tried again (Emacs 26.3, vanilla config) and still see > the behavior I reported. Oh well. I tested again, with "emacs -q" this time, and got the behavior you reported. So it must be something with my config. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-org-src-Add-call-to-quit-restore-window-in-org-src-s.patch >From 0db0adc4f20d8c664976b89cbe033f5579e1fdc5 Mon Sep 17 00:00:00 2001 From: Jack Kamm Date: Tue, 21 Jan 2020 20:39:14 -0800 Subject: [PATCH] org-src: Add call to quit-restore-window in org-src-switch-to-buffer * lisp/org-src.el (org-src-switch-to-buffer): Add call to quit-restore-window in org-src-switch-to-buffer when org-src-window-setup is other-window --- lisp/org-src.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/org-src.el b/lisp/org-src.el index 52e99cf04..bb1c57c65 100644 --- a/lisp/org-src.el +++ b/lisp/org-src.el @@ -809,7 +809,9 @@ Raise an error when current buffer is not a source editing buffer." (pop-to-buffer buffer)) (`current-window (pop-to-buffer-same-window buffer)) (`other-window - (switch-to-buffer-other-window buffer)) + (let ((cur-win (selected-window))) + (switch-to-buffer-other-window buffer) + (when (eq context 'exit) (quit-restore-window cur-win)))) (`split-window-below (if (eq context 'exit) (delete-window) -- 2.25.0 --=-=-=--