How to make buffers accessible only from one frame(window) and not accessible from another and vice versa? So I want to have each frame with its own buffers.
I'm on OS X.
The only way I can think of is launching a new instance of Emacs instead of opening a new frame normally. You can set
C-x 5 2 to start
emacs instead of creating a new frame:
(defun start-other-emacs () "Start another Emacs process to open an independent Emacs window." (interactive) ;;; Run the command "emacs", piping output into a ;;; buffer called "*other-emacs*" (start-process "emacs" "*other-emacs*" "emacs")) (global-set-key (kbd "C-x 5 2") 'start-other-emacs)
Unfortunately, this isn't terribly fast unless you have a more optimized Emacs config than I do!
Generally you can't have frame-local list of buffers. It might have been possible when
buffer-alist was exposed at Lisp level (but even like that I'm not too sure), but that possibility is now gone.
The next best thing is to pretend you do. Packages like perspective.el can help in this regard: they avoid presenting buffers that are not "contained" in the current perspective. You can then activate different perspectives in different frames to implement your scenario.
Your question is not very clear (to me, at least). Just what do you mean by "accessible"? (displayed without selecting? selected as current buffer?) And what do you mean here by "and vice versa"? And what does "each frame with its own buffers" (plural?) mean?
Taking a wild guess, perhaps you mean that you want a single buffer (not two or more) shown in each frame. And perhaps you want the frame to show only that buffer. (No, I realize that this is not at all what you said. But what you said is anyway unclear to me.)
If so, then to use a separate frame by default for most buffer-displaying commands, try setting option
t. (Or customize the complex option
display-buffer-alist.) And to prevent other buffers from being shown in the same frame, make the buffer's window dedicated -- see the Elisp manual, node
But if you do only those things then you will wind up somewhat disappointed, as Emacs does not always behave well with one-buffer-per-frame.
If you want a relatively coherent setup that provides one-buffer-per-frame behavior, consider trying One On One Emacs. Try library oneonone.el, for example. To make all windows dedicated you can customize
special-display-regexps so that it matches all buffer names. (Or again, you can fiddle with customizing option
There is also frame-purpose:
makes it easy to open purpose-specific frames that only show certain buffers, e.g. by buffers’ major mode, their filename or directory, etc, with custom frame/X-window titles, icons, and other frame parameters.