Re: [O] patch: adding split-window-right option for src block editing
Hello, "Fraga, Eric" 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
Re: [O] patch: adding split-window-right option for src block editing
On Monday, 15 Jul 2019 at 12:02, Nicolas Goaziou wrote: > Hello, > > "Fraga, Eric" 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 From 550a7b3f95232295240852156d5e455b803992a9 Mon Sep 17 00:00:00 2001 From: Eric S Fraga 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-frameUse `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 From fabd6d84b0f6fd3ac2331a5e7b3b2dc2b54b6e51 Mon Sep 17 00:00:00 2001 From: Eric S Fraga 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
Re: [O] patch: adding split-window-right option for src block editing
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
Re: [O] patch: adding split-window-right option for src block editing
Hello, "Fraga, Eric" 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
[O] patch: adding split-window-right option for src block editing
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 From 550a7b3f95232295240852156d5e455b803992a9 Mon Sep 17 00:00:00 2001 From: Eric S Fraga 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-frameUse `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