1

When I create a new frame with make-frame-command, it automatically opens the currently open buffer in the new frame. Is it possible to change this to open the scratch buffer instead? I'm using perspective.el.

0

1 Answer 1

1

You can add a function that switches to the desired buffer, to the hook after-make-frame-functions:

(defun my/switch-to-scratch (frame) (switch-to-buffer "*scratch*")) (add-hook 'after-make-frame-functions #'my/switch-to-scratch t) 

Do C-h v after-make-frame-functions for more info.

1
  • Thanks for the trick. I had to add (select-frame frame) before modifying the buffer with (dired "~"). Otherwise, dired was performed in the old frame. Commented Jul 20, 2023 at 6:48

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.