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.


1 Answer 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.

  • 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.
    – Lalylulelo
    Commented Jul 20, 2023 at 6:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.