I think you may want your opened frame in control. If you make certain files automatically opened in another frames, then when you open more than one it will create many frames that becomes unmanageable and defeats your purpose.
Since you use Helm and if you use any Helm Projectile command or helm-find-files
or helm-mini
... (Helm commands that are related to files), C-c C-o opens the selected files/buffers in another frames.
For vanilla Emacs solution, anything prefixed with C-x 5 opens file/buffer in another frame.
But you can use another method to achieve your purpose. You can use package like workgroup to manage your window configurations. What workgroup
does is allows you to create workspaces, each workspace holds a window configuration with its buffers and you can switch between window configurations easily and persist the workspaces across Emacs sessions. Of course, you can use it along with frame as well, i.e. each frame holds a workspace. Here is my configuration:
(setq wg-prefix-key (kbd "C-c v"))
(setq wg-morph-on nil ; disable switching animation
wg-no-confirm t ; don't ask for confirmation
wg-file (concat user-emacs-directory "workgroups") ; save your workspaces in ~/.emacs.d/wokgroups for future sessions
wg-switch-on-load nil ; don't switch to first workgroup when it is loaded
)
(global-set-key (kbd "C-c c") 'wg-create-workgroup)
(global-set-key (kbd "C-c b") 'wg-switch-to-workgroup)
(require 'workgroups)
(workgroups-mode 1)
Why did I choose such key bindings? Because the three keys are close together. C-c c and C-c b should be frequently used commands when you use workgroups
, and C-c v is for everything else. And the three are close with each other on the keyboard, which makes it easy to remember and fast to work with workgroups
: c v b.
Now, let's try create a workgroup with C-c c. Create 3 or 4 windows t hat hold something.
Then, create another workgroup with C-c c. Also create 3 or 4 windows t hat hold something.
Now you can switch back and forth with C-c v a between current and previous workgroups. If you want to go next/previous workgroup, use C-c v n and C-c v p.
Basically, workgroups
is the same as how Emacs handles frames in terminal, which I think is the missing feature in GUI Emacs that I was always wishing for.
If you have more than 2 workgroups and want to select one deterministically, press C-c b. Since you use Helm, you get a nice and visible list of workgroups.
To persist your workgroups between session, you can use C-c v S to save all your workgroups into the wg-file
you defined earlier. You can restore it later with C-c v C-l, or automatically when your Emacs starts:
(defun wg-load-default ()
"Run `wg-load' on `wg-file'."
(interactive)
(when (file-exists-p wg-file)
(wg-load wg-file)))
Finally, to navigate frame easier, you can select frame by name with select-frame-by-name
command. I bound it to C-x 5 s
(global-set-key (kbd "C-x 5 s") 'select-frame-by-name)
Again, it gives you a nice visible list with Helm.
You can cycle between frames with C-x 5 o, similar to how you cycle windows.
frame-bufs
by Alp Aker to associate buffers with the frame ( github.com/alpaker/Frame-Bufs ), let me know.