I'm managing workspaces by creating new frames, but running C-x 5 C-h
couldn't find anything like "run command in new frame", basically what I'd like to do is to run some REPL or shell in new frame. Is it possible?
If you simply want a programmatic way to run a command in a new frame, just create the frame and run the command:
(defun simple-run-command-in-new-frame (command)
(select-frame (make-frame))
(funcall #'command))
If you want an interactive command that queries for the command being run, similar to M-x
, then you'll need to take care of details such as handling the prefix argument and querying the user. The following should work in most circumstances:
(defun run-command-in-new-frame (prefixarg command-name)
(interactive (list current-prefix-arg (read-extended-command)))
(let ((command (intern-soft command-name)))
(unless command
(error "%s is not a valid command name" command-name))
(select-frame (make-frame))
(let ((prefix-arg prefixarg))
(command-execute command))))
shell
function (defined within the libraryshell.el
) that looks like this:(pop-to-buffer-same-window buffer)
. For example, you might be interested in something like(swtich-to-buffer-other-frame buffer)
. There are also those users who prefer to modify thedisplay-buffer-alist
. – lawlist Jan 7 '15 at 15:12