Skip to content

Commit

Permalink
Revert "prefer-other-window: don't reuse selected window unless neces…
Browse files Browse the repository at this point in the history
…sary"

This reverts commit b06397d.

See discussion in #122
  • Loading branch information
bmag committed Aug 9, 2018
1 parent bcf0e64 commit f3b6c7e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 16 deletions.
4 changes: 2 additions & 2 deletions test/switch-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@
(set-window-buffer nil "xxx-p0-0")
;; (purpose-pop-buffer "xxx-p0-1")
(pop-to-buffer "xxx-p0-1")
(purpose-check-displayed-buffers '("xxx-p0-0" "xxx-p0-1"))
(purpose-check-displayed-buffers '("xxx-p0-1"))
;; 2
(message "2...")
(delete-other-windows)
Expand All @@ -183,7 +183,7 @@
(set-window-buffer nil "xxx-p0-0")
(purpose-pop-buffer "xxx-p0-1")
;; (pop-to-buffer "xxx-p0-1")
(purpose-check-displayed-buffers '("xxx-p0-0" "xxx-p0-1"))
(purpose-check-displayed-buffers '("xxx-p0-1" "xxx-p1-0"))
;; 3
(message "3...")
(delete-other-windows)
Expand Down
16 changes: 2 additions & 14 deletions window-purpose-switch.el
Original file line number Diff line number Diff line change
Expand Up @@ -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-other-window
purpose-display-reuse-window-purpose-other-window
(prefer-other-window . (purpose-display-reuse-window-buffer
purpose-display-reuse-window-purpose
;; only pops if `pop-up-frames' says so
purpose-display-maybe-pop-up-frame
;; only pops when sensible (`split-window-sensibly')
Expand Down Expand Up @@ -332,18 +332,6 @@ 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.
Expand Down

0 comments on commit f3b6c7e

Please sign in to comment.