Search code examples
remacsrprofile

How do I set my default editor to emacs -nw in my .Rprofile?


As the question says, I want my default editor in R (e.g. when I do fix(fn_name)) to be the non-windowed mode of emacs as opposed to the windowed mode. Is there any way to do this?


Solution

  • Create a file somewhere (I use a bin directory under my home), called emacsnw like this:

    #!/bin/sh
    emacs -nw "$@"
    

    and make it executable: chmod 755 emacsnw

    Then you can do options(editor="/home/me/bin/emacsnw") and that will then call it.

    Note I can never remember if "$@" or "$*" is the right way to pass args through a script, but this seems to work for fix().