Figure 1: sudo plus emacs

Figure 1: sudo plus emacs

Emacs offers TRAMP as a way to edit files over ssh or as a different user. Combine with sudo-edit for easy superuser edits. VSCode has a feature reminiscent of TRAMP called Remote Development using SSH.

At the time, I didn’t know of M-x sudo-edit so I wrote my own implementation. It sucked, didn’t work on chained TRAMP connections (e.g. ssh then edit as root on the remote host). Also, it turned out non-standard file buffers (such as dired) require dedicated code paths that I’d have to troubleshoot and diagnose. It wasn’t easy to figure out how to write this interactive lisp function. And indeed, it’s not what I want at all.

Figure 2: sudo-edit in action

Figure 2: sudo-edit in action

No, what I actually want is sudo-edit with its quality, time-tested defuns. Besides, it’s easy to use:

  1. M-x package-install sudo-edit RET. (See sudo-edit on MELPA.)
  2. Next visit the file then run M-x sudo-edit RET.
  3. Finally, type in your sudo password and viola! You can now edit and save the buffer as root!

Read more about sudo-edit in C-h f sudo-edit RET or see the source code — embedded with commentary and documentation — here on GitHub.


sudo make me a sandwhich.

…By the way I had to figure out how to make decent gifs from a webm. Generate a color pallet then perform the transcode using that color data to ensure decent contrast. See this StackExchange answer.