this is a rather rudimentary question, but what is the practical difference between opening a new file in a separate frame (make-new-frame) from emacs or opening the file in an instance of emacsclient? I can see that if you are working through a terminal, the difference is clear... but can emacsclient additionally restrict the list of buffers accessed by (buffer-menu) or ido-mode to buffers opened in that particular emacsclient instance?
Emacs - emacsclient or new frame?
2.1k Views Asked by hatmatrix At
2
There's really no difference between the two situations, other than the fact that the server sets up some buffer-local state to enable
C-x #
(akaserver-edit
).You can limit
M-x list-buffers
behavior like you're asking with the following advice:Now when you do
M-x buffer-menu
in a buffer visited byemacsclient
, you only see other buffers visited by the same client(s). It works as normal when the buffer is not visited by anemacsclient
.I don't use
ido
, but I imagine the customization would be similar (if this advice doesn't work as is).The details are that when you run
emacsclient
, the buffers that get opened up are associated with the server process (it can be more than one because you can open up the same file via multiple invocations ofemacsclient
). A buffer's server clients are stored in the buffer local variableserver-buffer-clients
.To find out which buffers are associated with a particular invocation of
emacsclient
, find the process for that emacsclient, and do:(process-get proc 'buffers)
(whereproc
is the particular emacsclient process - one of the elements of the list found inserver-buffer-clients
).That's all the advice does.