-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Purpose-mode breaks org-tree-to-indirect-buffer #122
Comments
Apparently this is a result of #98. I fixed it in the Sorry for the late reply, I was busy with other matters. For convenience, here is the diff: --- a/window-purpose-switch.el
+++ b/window-purpose-switch.el
@@ -95,8 +95,8 @@ it yourself.")
purpose-display-maybe-pop-up-window
purpose-display-maybe-pop-up-frame))
(force-same-window . (purpose-display-maybe-same-window))
- (prefer-other-window . (purpose-display-reuse-window-buffer
- purpose-display-reuse-window-purpose
+ (prefer-other-window . (purpose-display-reuse-window-buffer-other-window
+ purpose-display-reuse-window-purpose-other-window
purpose-display-maybe-other-window
purpose-display-maybe-pop-up-window
purpose-display-maybe-other-frame
@@ -326,6 +326,18 @@ that a window on another frame is chosen, avoid raising that frame."
(purpose-change-buffer buffer window 'reuse alist))
window)))
+(defun purpose-display-reuse-window-buffer-other-window (buffer alist)
+ "Return a non-selected window that is already displaying BUFFER.
+This is the same `purpose-display-reuse-window-buffer', except
+the currently selected window is not eligible for reuse."
+ (purpose-display-reuse-window-buffer buffer (cons '(inhibit-same-window . t) alist)))
+
+(defun purpose-display-reuse-window-purpose-other-window (buffer alist)
+ "Return a non-selected window that is already used for the purpose PURPOSE.
+This is the same `purpose-display-reuse-window-purpose', except
+the currently selected window is not eligible for reuse."
+ (purpose-display-reuse-window-purpose buffer (cons '(inhibit-same-window . t) alist)))
+
(defun purpose-display-reuse-window-buffer-other-frame (buffer alist)
"Return a window that is already displaying BUFFER.
Return nil if no usable window is found.
@@ -492,8 +504,9 @@ used window, split the selected window."
(new-window (or (split-window-sensibly old-window)
(and force-split
(split-window old-window)))))
- (purpose-change-buffer buffer new-window 'window alist)
- new-window))
+ (when new-window
+ (purpose-change-buffer buffer new-window 'window alist)
+ new-window)))
(defun purpose-display-pop-up-window (buffer alist)
"Display BUFFER in a new window. |
Reopening since I reverted the fix for now. |
I decided not to fix this issue, since it I don't consider it a bug in Purpose. It might be a bug in Org 9.1.9 (built-in version in Emacs 26.1). When (pop-to-buffer ibuf) However, when called like that, (pop-to-buffer ibuf t) Purpose tries harder than stock Emacs to reuse windows, because it doesn't want to mess the user's window layout. That's why, when Fortunately, if you don't like reusing the current window for the indirect buffer, you can give the indirect buffers a different purpose than regular Org buffers, and that should be enough to restore (purpose-add-user-purposes :regexps '(("\\.org-" . indirect))) |
Similar issue has arisen recently with the Should't |
If
org-indirect-buffer-display
is'other-window
, then callingorg-tree-to-indirect-buffer
should open an inderect buffer in the other window. Ifpurpose-mode
is enabled, thenorg-tree-to-indirect-buffer
will open the indirect buffer in the current window. Somehowpop-to-buffer
and -pop-to-buffer-same-window` do the same thing if purpose is on?The text was updated successfully, but these errors were encountered: