emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* patch: adding split-window-right option for src block editing
@ 2019-07-11  9:27 Fraga, Eric
  2019-07-15 10:02 ` Nicolas Goaziou
  0 siblings, 1 reply; 5+ messages in thread
From: Fraga, Eric @ 2019-07-11  9:27 UTC (permalink / raw)
  To: Emacs Org mode mailing list

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

Hello all,

most of my work now involves using quite large wide monitors and having
the editing of src blocks open windows below is less convenient than
splitting horizontally.  I have added the option to split
horizontally.  See attached patch.

However, ideally, I would like the option to specify a function as
context matters: sometimes a vertical split is better, sometimes
not.  But implementing this was beyond my emacs-fu.

Thanks,
eric

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.2.4-379-g1b74ae

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-split-window-right-option-for-editing-src-blocks.patch --]
[-- Type: text/x-diff; name="0001-Add-split-window-right-option-for-editing-src-blocks.patch", Size: 1968 bytes --]

From 550a7b3f95232295240852156d5e455b803992a9 Mon Sep 17 00:00:00 2001
From: Eric S Fraga <e.fraga@ucl.ac.uk>
Date: Thu, 11 Jul 2019 10:24:15 +0100
Subject: [PATCH] Add split-window-right option for editing src blocks

* org-src.el (org-src-window-setup, org-src-switch-to-buffer): added
  new split-window-right option which splits horizontally.

This has been motivated by the increasing use of wide monitors.
---
 lisp/org-src.el | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/lisp/org-src.el b/lisp/org-src.el
index a83942fc5..3b0923c20 100644
--- a/lisp/org-src.el
+++ b/lisp/org-src.el
@@ -152,6 +152,8 @@ 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
                    other windows.
+split-window-right Show edit buffer to the right of the current window, 
+                   keeping all other windows.
 other-window       Use `switch-to-buffer-other-window' to display edit buffer.
 reorganize-frame   Show only two windows on the current frame, the current
                    window and the edit buffer.  When exiting the edit buffer,
@@ -162,6 +164,7 @@ other-frame        Use `switch-to-buffer-other-frame' to display edit buffer.
   :type '(choice
 	  (const current-window)
 	  (const split-window-below)
+	  (const split-window-right)
 	  (const other-frame)
 	  (const other-window)
 	  (const reorganize-frame)))
@@ -793,6 +796,11 @@ Raise an error when current buffer is not a source editing buffer."
 	 (delete-window)
        (select-window (split-window-vertically)))
      (pop-to-buffer-same-window buffer))
+    (`split-window-right
+     (if (eq context 'exit)
+	 (delete-window)
+       (select-window (split-window-horizontally)))
+     (pop-to-buffer-same-window buffer))
     (`other-frame
      (pcase context
        (`exit
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: patch: adding split-window-right option for src block editing
  2019-07-11  9:27 patch: adding split-window-right option for src block editing Fraga, Eric
@ 2019-07-15 10:02 ` Nicolas Goaziou
  2019-07-16  7:00   ` Fraga, Eric
  2019-07-24 11:22   ` Fraga, Eric
  0 siblings, 2 replies; 5+ messages in thread
From: Nicolas Goaziou @ 2019-07-15 10:02 UTC (permalink / raw)
  To: Fraga, Eric; +Cc: Emacs Org mode mailing list

Hello,

"Fraga, Eric" <e.fraga@ucl.ac.uk> writes:

> most of my work now involves using quite large wide monitors and having
> the editing of src blocks open windows below is less convenient than
> splitting horizontally.  I have added the option to split
> horizontally.  See attached patch.

Thank you. Could you provide an entry in ORG-NEWS, too?
>
> However, ideally, I would like the option to specify a function as
> context matters: sometimes a vertical split is better, sometimes
> not.  But implementing this was beyond my emacs-fu.

Allowing one to use a function is easy. It entails one additional value
in the defcustom, and one case in `org-src-switch-to-buffer':

  ((pred functionp) (funcall org-src-window-setup))

probably near the end since some symbols also are function names (e.g.,
`other-frame').

Implementing an interesting function is harder, but not necessary for
Org for the time being.

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: patch: adding split-window-right option for src block editing
  2019-07-15 10:02 ` Nicolas Goaziou
@ 2019-07-16  7:00   ` Fraga, Eric
  2019-07-24 11:22   ` Fraga, Eric
  1 sibling, 0 replies; 5+ messages in thread
From: Fraga, Eric @ 2019-07-16  7:00 UTC (permalink / raw)
  To: Emacs Org mode mailing list

Thanks Nicolas.  I'm currently travelling for work.  I'll add the news item for this change early next week.

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.2.4-379-g1b74ae

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: patch: adding split-window-right option for src block editing
  2019-07-15 10:02 ` Nicolas Goaziou
  2019-07-16  7:00   ` Fraga, Eric
@ 2019-07-24 11:22   ` Fraga, Eric
  2019-08-17 13:27     ` Nicolas Goaziou
  1 sibling, 1 reply; 5+ messages in thread
From: Fraga, Eric @ 2019-07-24 11:22 UTC (permalink / raw)
  To: Emacs Org mode mailing list

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

On Monday, 15 Jul 2019 at 12:02, Nicolas Goaziou wrote:
> Hello,
>
> "Fraga, Eric" <e.fraga@ucl.ac.uk> writes:
>
>> most of my work now involves using quite large wide monitors and having
>> the editing of src blocks open windows below is less convenient than
>> splitting horizontally.  I have added the option to split
>> horizontally.  See attached patch.
>
> Thank you. Could you provide an entry in ORG-NEWS, too?

Please find attached two patch files, both the one I have already sent
and now one with a change to the NEWS file.

Thanks and sorry for the delay.

eric

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.2.4-399-g4e6222

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-split-window-right-option-for-editing-src-blocks.patch --]
[-- Type: text/x-diff; name="0001-Add-split-window-right-option-for-editing-src-blocks.patch", Size: 1972 bytes --]

From 550a7b3f95232295240852156d5e455b803992a9 Mon Sep 17 00:00:00 2001
From: Eric S Fraga <e.fraga@ucl.ac.uk>
Date: Thu, 11 Jul 2019 10:24:15 +0100
Subject: [PATCH 1/2] Add split-window-right option for editing src blocks

* org-src.el (org-src-window-setup, org-src-switch-to-buffer): added
  new split-window-right option which splits horizontally.

This has been motivated by the increasing use of wide monitors.
---
 lisp/org-src.el | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/lisp/org-src.el b/lisp/org-src.el
index a83942fc5..3b0923c20 100644
--- a/lisp/org-src.el
+++ b/lisp/org-src.el
@@ -152,6 +152,8 @@ 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
                    other windows.
+split-window-right Show edit buffer to the right of the current window, 
+                   keeping all other windows.
 other-window       Use `switch-to-buffer-other-window' to display edit buffer.
 reorganize-frame   Show only two windows on the current frame, the current
                    window and the edit buffer.  When exiting the edit buffer,
@@ -162,6 +164,7 @@ other-frame        Use `switch-to-buffer-other-frame' to display edit buffer.
   :type '(choice
 	  (const current-window)
 	  (const split-window-below)
+	  (const split-window-right)
 	  (const other-frame)
 	  (const other-window)
 	  (const reorganize-frame)))
@@ -793,6 +796,11 @@ Raise an error when current buffer is not a source editing buffer."
 	 (delete-window)
        (select-window (split-window-vertically)))
      (pop-to-buffer-same-window buffer))
+    (`split-window-right
+     (if (eq context 'exit)
+	 (delete-window)
+       (select-window (split-window-horizontally)))
+     (pop-to-buffer-same-window buffer))
     (`other-frame
      (pcase context
        (`exit
-- 
2.20.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-Add-NEWS-item-for-split-window-right-option-for-edit.patch --]
[-- Type: text/x-diff; name="0002-Add-NEWS-item-for-split-window-right-option-for-edit.patch", Size: 1153 bytes --]

From fabd6d84b0f6fd3ac2331a5e7b3b2dc2b54b6e51 Mon Sep 17 00:00:00 2001
From: Eric S Fraga <e.fraga@ucl.ac.uk>
Date: Wed, 24 Jul 2019 12:18:35 +0100
Subject: [PATCH 2/2] Add NEWS item for split-window-right option for editing
 src blocks

* ORG-NEWS: added news item for new split-window-right option
---
 etc/ORG-NEWS | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index bbd9dc975..f0163a77b 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -123,6 +123,11 @@ auto-commit attachments to git:
   one need to require the =org-attach-git= module in the startup.
 
 ** New features
+*** Add split-window-right option for src block edit window placement
+Given the increasing popularity of wide screen monitors, splitting
+horizontally may make more sense than splitting vertically.  An
+option, ~split-window-right~, to request horizontal splitting has been
+added to ~org-src-window-setup~.
 *** Org-Attach has been refactored and extended
 Org attach has been refactored and the functionality extended.  It
 should now be easier to understand how it works.  A few improvements
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: patch: adding split-window-right option for src block editing
  2019-07-24 11:22   ` Fraga, Eric
@ 2019-08-17 13:27     ` Nicolas Goaziou
  0 siblings, 0 replies; 5+ messages in thread
From: Nicolas Goaziou @ 2019-08-17 13:27 UTC (permalink / raw)
  To: Fraga, Eric; +Cc: Emacs Org mode mailing list

Hello,

"Fraga, Eric" <e.fraga@ucl.ac.uk> writes:

> Please find attached two patch files, both the one I have already sent
> and now one with a change to the NEWS file.

Applied. Thank you.

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-08-17 13:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-11  9:27 patch: adding split-window-right option for src block editing Fraga, Eric
2019-07-15 10:02 ` Nicolas Goaziou
2019-07-16  7:00   ` Fraga, Eric
2019-07-24 11:22   ` Fraga, Eric
2019-08-17 13:27     ` Nicolas Goaziou

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