about summary refs log tree commit diff
path: root/users/tazjin/emacs/config
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@tvl.su>2024-01-10T15·19+0300
committerclbot <clbot@tvl.fyi>2024-01-10T15·23+0000
commitc806ee0eb898215359fdc80010f779b3582248d1 (patch)
tree8ba178ceba9ca3a732b25eafb58bf66f550c02a1 /users/tazjin/emacs/config
parentc541273d2233a0dfd4fa29f4559d70c75249d877 (diff)
feat(tazjin/emacs): add M-x-always-same-window r/7368
Following a discussion on Telegram about window management ... might
come in useful!

Change-Id: If50741e4281c658bccc55e2f591ef945ef4b3b5d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10592
Autosubmit: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
Diffstat (limited to 'users/tazjin/emacs/config')
-rw-r--r--users/tazjin/emacs/config/functions.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/users/tazjin/emacs/config/functions.el b/users/tazjin/emacs/config/functions.el
index d91627a88247..68a384d20f7a 100644
--- a/users/tazjin/emacs/config/functions.el
+++ b/users/tazjin/emacs/config/functions.el
@@ -341,4 +341,12 @@ installed (and visible) XDG apps, and let users launch them."
   (interactive "aFunction symbol: ")
   (advice-mapc (lambda (advice _props) (advice-remove sym advice)) sym))
 
+(defun M-x-always-same-window ()
+  "Run `execute-extended-command', but ensure that whatever it does
+always opens in the same window in which the command was invoked."
+  (interactive)
+  (let ((display-buffer-overriding-action
+         '((display-buffer-same-window) . ((inhibit-same-window . nil)))))
+    (call-interactively #'execute-extended-command)))
+
 (provide 'functions)