emacsido

emacs - show the current file in other frame


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.

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))

Solution

  • 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)))