Closed mohkale closed 3 years ago
You can set the third argument of edit-indirect-region
to nil
to create an edit-indirect buffer without displaying it, and switch the current window to that buffer in a custom command:
(defun switch-to-edit-indirect-region (beg end)
(interactive
(if (or (use-region-p) (not transient-mark-mode))
(prog1 (list (region-beginning) (region-end))
(deactivate-mark))
(user-error "No region")))
(switch-to-buffer (edit-indirect-region beg end nil)))
@Fanael
My bad the format of my display-buffer-alist
entry wasn't correct. The second entry is supposed to be a list of functions not a symbol. This works.
(push (cons (rx bol "*edit-indirect ")
'((display-buffer-reuse-window
display-buffer-same-window)))
display-buffer-alist)
@Fanael
It's also worth pointing out you probably shouldn't do (select-window (display-buffer buffer))
. While I actually prefer selecting popup windows this should be configured using display-buffer-alist
(eg. setting an action to (body-function . select-window)
).
The way some other packages do this is by exposing a defcustom for the action argument passed to the display-buffer
function. For example bufler.
I don't like windows popping up all over the place so for some types of popups I like to make them open in the current window.
I tried this but it doesn't seem to work :cry:.