2

What am I trying to achieve

I want to use emacsclient (not emacs) as my default text editor on Debian Buster.

What have I tried so far

  • Alternatives:

    > sudo update-alternatives --config editor`
    There are 3 choices for the alternative editor (providing /usr/bin/editor).
    
    Selection    Path                Priority   Status
    ------------------------------------------------------------
      0            /bin/nano            40        auto mode
      1            /bin/nano            40        manual mode
      2            /usr/bin/emacs       0         manual mode
    * 3            /usr/bin/vim.basic   30        manual mode
    

    Emacs is listed here, but when I choose 2, and test using git rebase -i HEAD~3 (in a git directory) it launches a new emacs instance.

  • $EDITOR & $VISUAL:

    I added these 2 lines in my .bashrc:

    EDITOR="emacsclient -nw"
    VISUAL=emacsclient
    

    I can confirm the values are set but git rebase -i HEAD~3 still opens a vim. (This is despite the fact the documentation saying that $EDITOR & $VISUAL are taken into account )


How can I set my default editor to be emacsclient, both for terminal & GUI? (Preferably without changing my system in too many places)

1

I figured out why .bashrc solution didn't work. I had to actually export the variables:

export EDITOR="emacsclient -nw"
export VISUAL=$EDITOR

I use -nw both for $EDITOR & $VISUAL since I don't want to involve my emacs frame as much as possible.

| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.