Skip to content

Commit 546c9b9

Browse files
committed
Quit cider popup buffers with 'append argument
The default behavior of `quite-window` is to remove the buffer from the selected window's buffer history. We want to use the 'append action instead of 'bury to preserve the buffer in the history to allow future invocations of `display-buffer` and `pop-to-buffer` to reuse the window.
1 parent 57ace07 commit 546c9b9

File tree

1 file changed

+5
-16
lines changed

1 file changed

+5
-16
lines changed

cider-interaction.el

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,28 +1177,17 @@ If SELECT is non-nil, select the BUFFER."
11771177
(-when-let (win (get-buffer-window buffer))
11781178
(with-current-buffer buffer
11791179
(set-window-point win (point))))
1180+
;; Non nil `inhibit-same-window' ensures that current window is not covered
11801181
(if select
1181-
;; There is a quirk with `display-buffer-in-previous-window' which
1182-
;; overrides current buffer with *cider-error* buffer if *cider-error* was
1183-
;; most recently displayed in current buffer's window. The
1184-
;; `inhibit-same-window' solution below inhibits
1185-
;; `display-buffer-in-previous-window' altogether and allows
1186-
;; `display-buffer-use-some-window' to run instead, which in turn doesn't
1187-
;; behave that nicely on splits with more than 3 buffers. When
1188-
;; `pop-up-windows' is nil, non-nil `inhibit-same-window' pops up a new
1189-
;; frame if there is only one buffer in a frame. The
1190-
;; `display-buffer-in-previous-window' issue should be followed upstream,
1191-
;; but for now the solution below should satisfy all needs with only minor
1192-
;; inconvenience on frames with 3 buffer splits.
11931182
(pop-to-buffer buffer `(nil . ((inhibit-same-window . ,pop-up-windows))))
11941183
(display-buffer buffer `(nil . ((inhibit-same-window . ,pop-up-windows)))))
11951184
buffer)
11961185

1197-
(defun cider-popup-buffer-quit (&optional kill-buffer-p)
1198-
"Quit the current (temp) window and bury its buffer using `quit-window'.
1199-
If prefix argument KILL-BUFFER-P is non-nil, kill the buffer instead of burying it."
1186+
(defun cider-popup-buffer-quit (&optional kill)
1187+
"Quit the current (temp) window and bury its buffer using `quit-restore-window'.
1188+
If prefix argument KILL is non-nil, kill the buffer instead of burying it."
12001189
(interactive)
1201-
(quit-window kill-buffer-p (selected-window)))
1190+
(quit-restore-window (selected-window) (if kill 'kill 'append)))
12021191

12031192
(defun cider-make-popup-buffer (name &optional mode)
12041193
"Create a temporary buffer called NAME using major MODE (if specified)."

0 commit comments

Comments
 (0)