From 6e6c574abc4f1221adcf78467d5c445c5639f973 Mon Sep 17 00:00:00 2001 From: "Collin J. Doering" Date: Thu, 23 Oct 2014 03:26:23 -0400 Subject: [PATCH] Fix EDITOR environment variable issue for emacs Have programs using the $EDITOR environment variable use emacsclient if a daemon is running but otherwise fallback to plain emacs. See: http://www.emacswiki.org/emacs/EmacsAsDaemon Signed-off-by: Collin J. Doering --- .bashrc | 5 ++++- .zshrc | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.bashrc b/.bashrc index 8bf0a77..0df02b4 100644 --- a/.bashrc +++ b/.bashrc @@ -66,4 +66,7 @@ fi #eval `keychain --eval --timeout 10 --quiet --agents ssh id_rsa` # Default editor -export EDITOR="emacs -nw" +export ALTERNATE_EDITOR="" +export EDITOR="emacsclient -t" # $EDITOR should open in terminal +export VISUAL="emacsclient -c -a emacs" # $VISUAL opens in GUI with non-daemon as alternate + diff --git a/.zshrc b/.zshrc index 839d8ea..51c1f36 100644 --- a/.zshrc +++ b/.zshrc @@ -99,4 +99,6 @@ fi #eval `keychain --eval --timeout 10 --quiet --agents ssh id_rsa` # Default editor -export EDITOR="emacs -nw" +export ALTERNATE_EDITOR="" +export EDITOR="emacsclient -t" # $EDITOR should open in terminal +export VISUAL="emacsclient -c -a emacs" # $VISUAL opens in GUI with non-daemon as alternate