From e04c4857c4c68005c13413a3e89abcbfdd81760c Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Thu, 15 Feb 2007 21:37:47 +0000 Subject: [PATCH] bash_profile: Make editor selection indirect via a script mdw-editor. This involves installing scripts from this package into the right place in ~/bin. --- bash_profile | 7 ++++--- mdw-editor | 11 +++++++++++ setup | 14 +++++++++++++- 3 files changed, 28 insertions(+), 4 deletions(-) create mode 100755 mdw-editor diff --git a/bash_profile b/bash_profile index c290aa9..3da56a8 100644 --- a/bash_profile +++ b/bash_profile @@ -104,15 +104,16 @@ export QMAILINJECT=c # --- Find a text editor --- -export EDITOR=ed +export MDW_EDITOR=ed for ed in "emacs21 -nw" "emacs -nw" vi pico nano ae; do name=`echo $ed | sed 's/ .*$//'` if __mdw_programp "$name"; then - EDITOR=$ed + MDW_EDITOR=$ed break fi done -export VISUAL="$EDITOR" + +export EDITOR=mdw-editor VISUAL=mdw-editor # --- Various options for programs --- diff --git a/mdw-editor b/mdw-editor new file mode 100755 index 0000000..cca7310 --- /dev/null +++ b/mdw-editor @@ -0,0 +1,11 @@ +#! /bin/sh + +set -e +editor=${MDW_EDITOR-ed} +case "$EDITOR,$VISUAL,$TERM" in + mdw-editor,mdw-editor,dumb) editor=gnuclient;; + mdw-editor,mdw-editor,*);; + *,mdw-editor,*) editor=$EDITOR;; + mdw-editor,*,*) editor=$VISUAL;; +esac +exec $editor "$@" diff --git a/setup b/setup index caa7b4b..3978ff4 100755 --- a/setup +++ b/setup @@ -157,7 +157,6 @@ dotfiles=" e-keybindings.cfg:.enlightenment/keybindings.cfg evnc-keybindings.cfg:.enlightenment-vnc/keybindings.cfg jue-peek.jpg:.enlightenment/backgrounds/jue-peek.jpg" -mkdir -p $HOME/test echo "Installing dotfiles..." for d in $dotfiles; do target=.$d @@ -173,6 +172,19 @@ for d in $dotfiles; do done echo " all done." +### Install useful scripts included in this package +scripts=" + mdw-editor" +echo "Installing scripts..." +mkdir -p $HOME$sub/bin +for s in $scripts; do + ft=$HOME$sub/bin/$s + ln -s $here/$s $ft.new + mv $ft.new $ft + echo " $s" +done +echo " all done." + ### Set up the Emacs config $echon "Finding a suitable emacs:$echoc" emacs=no -- 2.11.0