From: immanuel <immanuel.litzroth@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Bug: org-edit-src keeps splitting the window [9.2.5 (release_9.2.5-504-g3c24be @ /home/immanuel/.emacs.d/straight/build/org/)]
Date: Fri, 30 Aug 2019 13:44:37 +0200 [thread overview]
Message-ID: <87r252swre.fsf@gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 566 bytes --]
Remember to cover the basics, that is, what you expected to happen and
what in fact did happen. You don't know how to make a good report? See
https://orgmode.org/manual/Feedback.html#Feedback
Your bug report will be posted to the Org mailing list.
------------------------------------------------------------------------
When org-edit-src-code is called with org-window-setup equal to
'split-window-below or 'split-window-right it will keep splitting the
window if the mouse is clicked on the src block in the org buffer.
This patch tries to address that
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: fix resplitting of window --]
[-- Type: text/x-diff, Size: 1306 bytes --]
diff --git a/lisp/org-src.el b/lisp/org-src.el
index 9134d5b5d..c7e201687 100644
--- a/lisp/org-src.el
+++ b/lisp/org-src.el
@@ -786,6 +786,13 @@ Raise an error when current buffer is not a source editing buffer."
(unless (org-src-edit-buffer-p) (error "Not in a source buffer"))
org-src--source-type)
+(defun org-src-select-window-for-buffer (buffer split-fun)
+ "Tries to select an existing window for buffer or splits the window."
+ (select-window
+ (or
+ (display-buffer-reuse-window buffer '())
+ (funcall split-fun))))
+
(defun org-src-switch-to-buffer (buffer context)
(pcase org-src-window-setup
(`current-window (pop-to-buffer-same-window buffer))
@@ -794,12 +801,12 @@ Raise an error when current buffer is not a source editing buffer."
(`split-window-below
(if (eq context 'exit)
(delete-window)
- (select-window (split-window-vertically)))
+ (org-src-select-window-for-buffer buffer #'split-window-vertically))
(pop-to-buffer-same-window buffer))
(`split-window-right
(if (eq context 'exit)
(delete-window)
- (select-window (split-window-horizontally)))
+ (org-src-select-window-for-buffer buffer #'split-window-horizontally))
(pop-to-buffer-same-window buffer))
(`other-frame
(pcase context
[-- Attachment #3: Type: text/plain, Size: 4307 bytes --]
Emacs : GNU Emacs 26.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30)
of 2019-07-17
Package: Org mode version 9.2.5 (release_9.2.5-504-g3c24be @ /home/immanuel/.emacs.d/straight/build/org/)
current state:
==============
(setq
org-src-mode-hook '(org-src-babel-configure-edit-buffer org-src-mode-configure-edit-buffer)
org-link-shell-confirm-function 'yes-or-no-p
org-metadown-hook '(org-babel-pop-to-session-maybe)
org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
org-reveal-start-hook '(org-decrypt-entry)
org-mode-hook '(#[0 "\301\211\207" [imenu-create-index-function org-imenu-get-tree] 2] #[0 "\300\301\302\303\304$\207" [add-hook change-major-mode-hook org-show-all append local] 5]
#[0 "\300\301\302\303\304$\207" [add-hook change-major-mode-hook org-babel-show-result-all append local] 5] org-babel-result-hide-spec org-babel-hide-all-hashes
auto-fill-mode)
org-archive-hook '(org-attach-archive-delete-maybe)
org-confirm-elisp-link-function 'yes-or-no-p
org-agenda-before-write-hook '(org-agenda-add-entry-text)
org-metaup-hook '(org-babel-load-in-session-maybe)
org-bibtex-headline-format-function #[257 "\300\236A\207" [:title] 3 "\n\n(fn ENTRY)"]
org-babel-pre-tangle-hook '(save-buffer)
org-tab-first-hook '(org-babel-hide-result-toggle-maybe org-babel-header-arg-expand)
org-babel-load-languages '((emacs-lisp . t) (C) (python . t) (shell . t) (plantuml . t))
org-src-preserve-indentation t
org-occur-hook '(org-first-headline-recenter)
org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-show-empty-lines org-optimize-window-after-visibility-change)
org-speed-command-hook '(org-speed-command-activate org-babel-speed-command-activate)
org-babel-tangle-lang-exts '(("D" . "d") ("C++" . "cpp") ("abc" . "abc") ("asymptote" . "asy") ("awk" . "awk") ("clojure" . "clj") ("fortran" . "F90") ("groovy" . "groovy")
("haskell" . "hs") ("io" . "io") ("java" . "java") ("latex" . "tex") ("LilyPond" . "ly") ("lisp" . "lisp") ("lua" . "lua") ("maxima" . "max") ("ocaml" . "ml")
("perl" . "pl") ("picolisp" . "l") ("processing" . "pde") ("ruby" . "rb") ("sed" . "sed") ("vala" . "vala") ("python" . "py") ("emacs-lisp" . "el")
("elisp" . "el"))
org-confirm-shell-link-function 'yes-or-no-p
org-link-parameters '(("attachment" :follow org-attach-open-link :export org-attach-export-link :complete org-attach-complete-link) ("id" :follow org-id-open)
("eww" :follow eww :store org-eww-store-link) ("rmail" :follow org-rmail-open :store org-rmail-store-link) ("mhe" :follow org-mhe-open :store org-mhe-store-link)
("irc" :follow org-irc-visit :store org-irc-store-link :export org-irc-export) ("info" :follow org-info-open :export org-info-export :store org-info-store-link)
("gnus" :follow org-gnus-open :store org-gnus-store-link) ("docview" :follow org-docview-open :export org-docview-export :store org-docview-store-link)
("bibtex" :follow org-bibtex-open :store org-bibtex-store-link)
("bbdb" :follow org-bbdb-open :export org-bbdb-export :complete org-bbdb-complete-link :store org-bbdb-store-link) ("w3m" :store org-w3m-store-link) ("file+sys")
("file+emacs") ("shell" :follow org-link--open-shell) ("news" :follow #[257 "\301\300\302Q!\207" ["news" browse-url ":"] 5 "\n\n(fn URL)"])
("mailto" :follow #[257 "\301\300\302Q!\207" ["mailto" browse-url ":"] 5 "\n\n(fn URL)"])
("https" :follow #[257 "\301\300\302Q!\207" ["https" browse-url ":"] 5 "\n\n(fn URL)"])
("http" :follow #[257 "\301\300\302Q!\207" ["http" browse-url ":"] 5 "\n\n(fn URL)"])
("ftp" :follow #[257 "\301\300\302Q!\207" ["ftp" browse-url ":"] 5 "\n\n(fn URL)"]) ("help" :follow org-link--open-elisp) ("file" :complete org-link-complete-file)
("elisp" :follow org-link--open-elisp) ("doi" :follow org-link--open-doi))
org-link-elisp-confirm-function 'yes-or-no-p
org-attach-id-to-path-function 'org-attach-id-folder-format
org-src-window-setup 'split-window-below
org-confirm-babel-evaluate nil
)
next reply other threads:[~2019-08-30 13:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-30 11:44 immanuel [this message]
2019-09-02 19:41 ` Bug: org-edit-src keeps splitting the window [9.2.5 (release_9.2.5-504-g3c24be @ /home/immanuel/.emacs.d/straight/build/org/)] Nicolas Goaziou
2019-09-02 21:26 ` Immanuel Litzroth
2019-09-03 16:17 ` Nicolas Goaziou
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=87r252swre.fsf@gmail.com \
--to=immanuel.litzroth@gmail.com \
--cc=emacs-orgmode@gnu.org \
/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).