In my .profile I've

export EDITOR="emacsclient -qa \"emacs --no-window-system --no-desktop\""

Doing sudo -e /somefile doesn't work even when Emacs server is running. I get

emacsclient: unrecognized option '--no-window-system'
Try 'emacsclient --help' for more information
sudo: /somefile unchanged

However, git commit does the right thing (Emacs editor for writing up my commit message) with both Emacs server running and not (opens inside terminal).

export EDITOR="emacsclient -qa nano"

Now sudo -e is happy. So it looks like git is OK with the spaces in the -a (alternate editor) option's argument while sudo is not. But, shouldn't this be a emacsclient problem? Why do I see these different behaviours.

  • 1
    My guess is that EDITOR is a variable (ab)used by different programs differently. It's not because of emacsclient itself. – legends2k Dec 31 '19 at 8:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.