with-editor-export-editor: new command

Add new command `with-editor-export-editor' which allows setting
the editor for subsequent commands in `shell-mode', `term-mode'
and `eshell-mode' buffers.

Also add the variants `with-editor-export-git-editor' and
`with-editor-export-hg-editor'.

Also add the utility functions `with-editor-emulate-terminal'
and `with-editor-read-envvar'.

This commit is a joint effort between Philippe Vaucher and me.
with-editor-async-shell-command: new command

Add new commands `with-editor-async-shell-command' and
`with-editor-shell-command', as well as `shell-command-with-editor-mode'
which makes regular `async-shell-command' and `shell-command' similarly.

Add utility function `with-editor-shell-command-read-args' and advice
`shell-command'.
Merge branch 'n/shell-with-editor' into next