I want to do something similar to iswitchb-buffer-other-frame
except, set the file name programmatically to be the current frame.
(with iswitchb-buffer-other-frame
you have to chose the file interactively)
If iswitchb is obsolete, can I achieve that with ido-mode
or another package (or straight Lisp)?
How can I do that?
EDIT
Based on the answer of @pickle-rick I adjusted the code to my needs.
switch-to-buffer-other-window
instead of switch-to-buffer-other-frame
.
I'm not sure why...
In my setting, I have 2 frames - each frame has a single window, and I need to move the current buffer to the other frame.
But it works!*scratch*
) (to prevent showing the original buffer in the original frame)Here is my adjusted code:
(defun my-switch-buffer-other-frame ()
(interactive)
(switch-to-buffer-other-window (current-buffer))
(other-frame 1)
(switch-to-buffer "*scratch*")
(other-frame 1))
The ido equivalent is ido-switch-buffer-other-frame
, which prompts for interactive selection as well. Here is a simple modification to avoid the prompting, and use the current buffer instead,
(defun my-switch-buffer-other-frame ()
(interactive)
(switch-to-buffer-other-frame (current-buffer)))