emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Jack Kamm <jackkamm@gmail.com>
To: Kyle Meyer <kyle@kyleam.com>, emacs-orgmode@gnu.org
Subject: Re: [RFC PATCH] Changes to pop-up source buffers
Date: Tue, 21 Jan 2020 21:06:12 -0800	[thread overview]
Message-ID: <87muagnkqj.fsf@gmail.com> (raw)
In-Reply-To: <875zh55u1f.fsf@kyleam.com>

[-- Attachment #1: Type: text/plain, Size: 1608 bytes --]

> 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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-src-Add-call-to-quit-restore-window-in-org-src-s.patch --]
[-- Type: text/x-patch, Size: 1068 bytes --]

From 0db0adc4f20d8c664976b89cbe033f5579e1fdc5 Mon Sep 17 00:00:00 2001
From: Jack Kamm <jackkamm@gmail.com>
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


  reply	other threads:[~2020-01-22  5:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-18 17:33 Jack Kamm
2020-01-18 18:56 ` Samuel Wales
2020-01-18 19:27   ` Jack Kamm
2020-01-19  2:46     ` Samuel Wales
2020-01-19  3:24 ` Kyle Meyer
2020-01-19 17:13   ` Jack Kamm
2020-01-21  4:10     ` Kyle Meyer
2020-01-22  5:06       ` Jack Kamm [this message]
2020-01-25  4:18       ` Kyle Meyer
2020-01-19  5:07 ` stardiviner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87muagnkqj.fsf@gmail.com \
    --to=jackkamm@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=kyle@kyleam.com \
    --subject='Re: [RFC PATCH] Changes to pop-up source buffers' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Code repositories for project(s) associated with this inbox:

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).