I use the following alias:
alias e='emacsclient -a '\'''\'' -t alias sudo='sudo '
That way I can execute both, commands and aliases, with
e, which launchs the emacs server if it is not launched yet.
The thing is that, if I have the
emacs-daemon running, for example because I have edited a file before, and then I open the editor with
sudo, every file which is written by the server, like
.historian, changes its owner to
root. So, when trying to launch the server again, the server is launched but the client doesn't show up (it frozes just after launching the server) and I have to open the client in another terminal, but emacs doesn't behave correctly anyway. For example, the minibuffer is incorrectly displayed for commands that requires input, like C-x C-f.
How can I solve that situation? How could I launch an emacs server per user basis? Or there's any other solution?e