3 ms·
>ad-hoc editing with sudo (precluding use of emacsclient) It looks to me like you're probably unaware that an Emacs not running as root can edit files owned by
by hollerith 12y ago
>ad-hoc editing with sudo (precluding use of emacsclient)
It looks to me like you're probably unaware that an Emacs not running as root can edit files owned by root. The way it goes about it (in a word, TRAMP) is a little complicated under the hood, but (at least for files residing on the same machine as the Emacs process) reliable.
Specifically, both C-x C-f /sudo::/etc/hosts and `emacsclient /sudo::/etc/hosts` work.
- bazfoo 12y agoAnd you can have something fun like the following in your bashrc to allow attaching to your running emacs daemon any time you need in the terminal: function semacs() { emacsclient -t -a "" "/sudo::$(realpath $@)" }
- mitchty 12y agoEven more fun is using tramp to edit files as root on a machine via ssh. The whole installed editor canard is somewhat a nonissue from the emacs side.