summaryrefslogtreecommitdiff
path: root/.emacs.d
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2022-05-21 13:13:17 -0700
committerSean Whitton <spwhitton@spwhitton.name>2022-05-22 14:34:37 -0700
commit7d44a9936200202c389a8fc720c0a748753011ca (patch)
treed3f2ea9eb866c5f97f5845c1e844b41e5fcc23e8 /.emacs.d
parent979b3f98a6016c42569289de4bbe6f0566c04884 (diff)
downloaddotfiles-7d44a9936200202c389a8fc720c0a748753011ca.tar.gz
Ensure that C-x 4 C-o &c. do not reuse the selected window
Diffstat (limited to '.emacs.d')
-rw-r--r--.emacs.d/init.el13
1 files changed, 13 insertions, 0 deletions
diff --git a/.emacs.d/init.el b/.emacs.d/init.el
index a3c3163b..8c945eea 100644
--- a/.emacs.d/init.el
+++ b/.emacs.d/init.el
@@ -849,6 +849,19 @@ layout (which I use by default)."
(display-buffer-reuse-window display-buffer-below-selected)
(window-height . fit-window-to-buffer))))
+;; Ensure that C-x 4 C-o &c. do not reuse the selected window.
+;;
+;; `display-buffer-fallback-action' is a constant so cons once in advance.
+(let ((ac `(,(car display-buffer-fallback-action) (inhibit-same-window . t))))
+ (defun spw/display-buffer (orig-fun &rest args)
+ (if (memq this-command '(display-buffer
+ project-display-buffer
+ transient-cycles-cmd-display-buffer))
+ (let ((display-buffer-overriding-action ac))
+ (apply orig-fun args))
+ (apply orig-fun args))))
+(advice-add #'display-buffer :around #'spw/display-buffer)
+
(defun spw/window-toggle-side-windows ()
"Like `window-toggle-side-windows', but (i) if the selected
window is a side window, change focus to the most recently used