1

I am trying to open crontab -e in emacs terminal editor, but it keeps opening it as GUI.

After running crontab -e emacs windows pops up rather than opening it as terminal editor.

$ crontab -e
no crontab for alper - using an empty one
Waiting for Emacs...

I have following setup in my ~/.zshrc, and emacs always opens as terminal editor.

export EDITOR="emacsclient -c"

The way I open files:

FILE=filepath
emacsclient -qut -e '(progn (find-file "'$FILE'"))'

2 Answers 2

2

Use emacsclient -nw instead of -c.

0
1

CONFIRMATION, db48x's advice really works in general.

SUPPLEMENT, what also works is placing the line export EDITOR="emacs -nw" into the currently logged-in user's .bashrc file, normally located at ~/.bashrc, and within that file at any place, for example, at the very bottom. It's important to have the line placed in literally. If you would place a # in front of it - that's called a prefix, resulting in [beginning of line]# export EDITOR="emacs -nw" - that line would be just a comment and not take effect.

In general for the change to take effect, after the edit, you need to 1st save the .bashrc file, and 2nd, then, make your terminal session reload that configuration file once again, after it has been modified and saved, by invocating source .bashrc - assuming you currently are in the same directory with your terminal session, where said .bashrc file was saved.

FAILS, approaches, which have proven to fail, to not do the trick: Placing export EDITOR=~/bin/emacs-nw-redir into one's .bashrc file with emacs-nw-redir when being executed with cat cat ~/bin/emacs-nw-redir containing the following emacs -nw. The fail: Emacs gets opened, in Terminal, but don't showcase the baggage of crontab, that template with the comment at the beginning where you want to place your cronjobs in, after the comment. Instead you will see the emacs welcome screen. Sourcing the specific crontab file path and supplementing emacs -nw with that path of the usual crontab file in the tmp directory will create a completely new, empty file with no crontab template content.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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