Can the Emacs server edit deleted files specified by the Emacs client?

I want to configure emacs server so that the files indicated by emacsclients are related to the emacsclients file system and not to the server file system. For example, if I create emacs on a "darkstar" machine, and I connect to this server via emacsclient on "brightstar" with the command

emacsclient -nw '~/fantastic' 

The emacs server will try to edit the ~ / fantastic file on darkstar, not a bright star. Identical, vice versa. I am open to all kinds of shy suggestions.

* Note: I want the emacs process to track all the buffers that I opened on different machines, track my color settings, bindings, etc. I want all this to be accessible and playable on any arbitrary machine with emacs. The emacs server seems to do this, but without the ability to edit local client files!

+4
source share
2 answers

You should be able to configure a shell function that uses tramp, for example

 edit-local() { emacsclient -e "(find-file (expand-file-name \"$1\" \"/ssh: $USER@ $(hostname):$PWD\"))" } 

Of course, you may have to change the tramp protocol to whatever you configured.

+1
source

Did the remote computer (the one running Emacs) mount the file system of the local computer? If so, you can do something like:

  emacsclient --eval ยด(my-open-file "~/fantastic" "my-local-machine")ยด 

Then you could write a function my-open-file , which could, for example, open the file //mounts/my-local-machine/home/YOUR-ACCOUNT/fantastic (assuming it's a mount point).

To create the emacsclient command line, you will need several hacks of elisp and some hacks of the script (using, for example, Ruby).

+1
source

Source: https://habr.com/ru/post/1393229/


All Articles