Georg Nikodym writes:
Wow. The cool thing about days off is that you get to dork around
with whatever catches your eye.
Today, I started using eshell instead of the traditional shell.
Initially, I wasn't that impressed, but when I first typed "grep
net_device *.[ch]" into it and it magically became a M-x grep
invocation I fell in love (cause I'm forever typing into the shell and
then realizing after the fact that I probably wanted something more
sophisticated).
I achieve similar results with a bunch of bash functions which alias
certain commands to "gnuclient" invocations.
This allows all kinds of tricks. E.g. I type "mail" in a tshell
buffer and my VM frame pops up. "Make" turns into "(compile)". Best
of all, if you do a "setenv" or "export" in the shell window, it
actually sets the environment variable in the parent XEmacs process as
well as in the child shell. Ditto for "cd". "igrep" and
"set-variable" become available as shell commands. Etc, etc, etc. I
know it's only a hack, but I like it.
I'm posting my ".bashrc.tshell" here in case it is of interest to
anybody else.
To make this work, set gnuserv-frame to:
(lambda (f) (eq f (quote x)))
and put some code in your .bashrc to source .bashrc.tshell iff
TERM==eterm
Here's my .bashrc.tshell:
------------------------.bashrc.tshell-------------------
PS1="\h:\W\\\$ "
export PS1
alias less=cat
alias more=cat
qeval()
{
fn=$1
shift
args=""
for arg in $*; do args="$args "\"$arg\"; done
gnuclient -batch -q -eval "(save-excursion \
(split-window-vertically) \
(other-window 1 nil) \
(condition-case err \
($fn $args) \
(t (delete-window))))"
}
man ()
{
qeval manual-entry $1
}
info ()
{
qeval info $1
}
make ()
{
gnuclient -batch -eval "(compile \"make $*\")"
}
edit ()
{
gnuclient "$1" ;
}
open ()
{
qeval find-file-other-frame $1
}
view ()
{
gnuclient -v "$1" ;
}
igrep ()
{
pat=$1
shift
args=""
for arg in $*; do args="$args "\"$arg\"; done
gnuclient -eval "(igrep nil \"$pat\" '($args))"
}
cd ()
{
builtin cd "${1:-~}"; gnuclient -batch -eval "(cd
\"`pwd`\")" ;
}
mail ()
{
gnuclient -q -eval "(vm)" ;
}
unalias ls
alias ls="ls --color -B -w 100"
rename-buffer ()
{
gnuclient -eval "(rename-buffer \"$1\")"
}
set-variable ()
{
gnuclient -eval "(set-variable \"$1\" \"$2\")"
}
export ()
{
varname=`echo $1|sed 's/=.*//'`
value=`echo $1|sed 's/.*=//'`
builtin export $1=$2; gnuclient -eval "(setenv \"$varname\"
\"$value\")" ;
}
setenv ()
{
builtin export $1=$2 ; gnuclient -eval "(setenv \"$1\"
\"$2\")" ;
}
getenv ()
{
gnuclient -batch -eval "(message (getenv \"$1\"))" ;
}
gdb ()
{
gnuclient -eval "(gdbsrc \"$1\" \"$2\")";
}
---------------end of .bashrc.tshell-----------------------