I frequently use TRAMP to edit files on a remote machine but I also want to use Emacs for remote configuration and management.

On any system there are some commands that run with the VISUAL and EDITOR variables which open local edits.

Usually there is a corresponding file that these programs edit but these files should not be edited directly as there is syntax checking that occurs after the files are edited.

So if I am using TRAMP from my local machine, and I run a command such as crontab -e on the remote machine (over tramp-term or ansi-term) it will open the default editor on the remote machine.

Frequently I am ssh'd in as my own user account, so this will often open a second instance of Emacs in my local Emacs' shell.

This is very bad for key command interception etc.

Is it possible to make the default editor for commands like visudo and crontab my local Emacs?

Browse other questions tagged or ask your own question.