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: Sun, 19 Jan 2020 09:13:28 -0800	[thread overview]
Message-ID: <87a76jmksn.fsf@gmail.com> (raw)
In-Reply-To: <878sm4nn67.fsf@kyleam.com>

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

Hi Kyle,

Thanks for taking the time to do a thorough review of the patch, I found
your response (especially the many examples you included) to be very
illuminating.

I agree that relying more on display-buffer-based functions is good, but
in retrospect I may have been over-eager, especially since
reorganize-frame can't be switched over, and split-window-right might
require writing a new action function.

My main motivation was to use my own display-buffer configuration to
show the source buffer. So I've rewritten the patch to be smaller and
more conservative, just adding a "plain" option to org-src-window-setup,
and not changing the implementation of any existing options.  I think
this is less likely to disrupt existing workflows or introduce
accidental bugs.

What do you think of using this smaller patch instead?

As an aside, in case we do decide to re-implement some of the display
options, now or in future, I did have a slight discrepancy from the
behavior you describe for split-window-right:

> Quickly testing, this has a slight change in behavior.  If there is
> already a window below the current Org buffer window, the new source
> window will be popped up below the _other_ window rather than the Org
> buffer.  I think this could be fixed (and the code in general
> simplified) by using display-buffer-below-selected.

On my own system, the window pops up below the existing Org buffer, even
if I have several existing horizontal splits. I'm not sure why.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-src-Add-option-plain-to-org-src-window-setup.patch --]
[-- Type: text/x-patch, Size: 2249 bytes --]

From a9cb8889df25697ff73e7c1e72987dac01875c8a Mon Sep 17 00:00:00 2001
From: Jack Kamm <jackkamm@gmail.com>
Date: Sun, 19 Jan 2020 08:28:36 -0800
Subject: [PATCH] org-src: Add option 'plain to org-src-window-setup

* lisp/org-src.el (org-src-window-setup): Add option 'plain for
org-src-window-setup, that uses vanilla display-buffer to show the
source window.
---
 etc/ORG-NEWS    | 7 +++++++
 lisp/org-src.el | 6 ++++++
 2 files changed, 13 insertions(+)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 67c3ca2ed..b32d37e65 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -35,6 +35,13 @@ value in call to =java=.
 After editing a source block, Org will restore the window layout when
 ~org-src-window-setup~ is set to a value that modifies the layout.
 
+*** New option to show source buffers using "plain" display-buffer
+
+Added option ~'plain~ to ~org-src-window-setup~ to show source buffers
+using ~display-buffer~. This allows users to control how source
+buffers are displayed by modifying ~display-buffer-alist~ or
+~display-buffer-base-action~.
+
 ** New functions
 *** ~org-columns-toggle-or-columns-quit~
 =<C-c C-c>= bound to ~org-columns-toggle-or-columns-quit~ replaces the
diff --git a/lisp/org-src.el b/lisp/org-src.el
index 878821b14..52e99cf04 100644
--- a/lisp/org-src.el
+++ b/lisp/org-src.el
@@ -148,6 +148,9 @@ the existing edit buffer."
   "How the source code edit buffer should be displayed.
 Possible values for this option are:
 
+plain              Show edit buffer using `display-buffer'.  Users can
+                   further control the display behavior by modifying
+                   `display-buffer-alist' and its relatives.
 current-window     Show edit buffer in the current window, keeping all other
                    windows.
 split-window-below Show edit buffer below the current window, keeping all
@@ -801,6 +804,9 @@ Raise an error when current buffer is not a source editing buffer."
 
 (defun org-src-switch-to-buffer (buffer context)
   (pcase org-src-window-setup
+    (`plain
+     (when (eq context 'exit) (quit-restore-window))
+     (pop-to-buffer buffer))
     (`current-window (pop-to-buffer-same-window buffer))
     (`other-window
      (switch-to-buffer-other-window buffer))
-- 
2.25.0


  reply	other threads:[~2020-01-19 17:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-18 17:33 [RFC PATCH] Changes to pop-up source buffers 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 [this message]
2020-01-21  4:10     ` Kyle Meyer
2020-01-22  5:06       ` Jack Kamm
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=87a76jmksn.fsf@gmail.com \
    --to=jackkamm@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=kyle@kyleam.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public 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).