On Thu, 29 Oct 2009 23:14:28 +0000, Bruce Stephens <bruce+use
...@cenderis.demon.co.uk> wrote:
> Andrea Crotti <kerny
...@gmail.com> writes:
>> Ah yes ok but how about the other programs?
>> I should set them up to call emacsclient somehow with a proper buffer
>> no?
> Sure. With many, setting EDITOR or VISUAL appropriately will work.
> For Firefox there are extensions. (I use Mozex, but I see there's
> another one I didn't know about.)
> The buffer works in the normal way: emacsclient is asked to edit a
> file, and you get a buffer for that file (normally a new buffer). You
> can configure how the buffer's mapped onto a frame (whether you get a
> new frame, new window, etc.) by configuring the "server" group.
Another extension that supports this is called "It's All Text!".
> In the emacsclient from Emacs 23 you need to pass -c to get a frame or
> -t to get a terminal (if you don't have a windowing system). (I use a
> simple script that calls emacsclient with the appropriate flag
> depending on whether DISPLAY is defined.)
Precisely.
I have been using a similar script for several months. The script calls
emacsclient with either -c or -t depending on the value of $DISPLAY:
#!/bin/sh
# Set up locale environment, but only if LANG is currently unset.
if test -z "${LANG}" ; then
# First clear off any locale related environment vars.
__junk=""
unset __junk `env | sed -n -E '/^(LANG|LC_[A-Z]+)=.*$/ s/=.*$//p'`
# Then set the preferred locale variables for Greek text.
export LANG="C"
export LC_CTYPE="el_GR.ISO8859-7"
export LC_COLLATE="el_GR.ISO8859-7"
fi
# When ${DISPLAY} is non-empty, assume it's ok to spawn a frame with
# the -c option of emacsclient.
if [ -z "${DISPLAY}" ]; then
frameopt='-c'
else
frameopt='-t'
fi
# Try to fire up some version of emacsclient.
# The first one that works will terminate this script.
test -x /opt/emacs/bin/emacsclient && \
exec /opt/emacs/bin/emacsclient ${frameopt} "$@"
test -x /usr/local/bin/emacsclient && \
exec /usr/local/bin/emacsclient ${frameopt} "$@"
test -x /usr/bin/emacsclient && \
exec /usr/bin/emacsclient ${frameopt} "$@"
echo >&2 "emacsclient-wrapper: no emacsclient found."
exit 1
This is saved as `/home/keramida/bin/emacsclient-wrapper' in my HOME
directory, and I call the script from "It's All Text!".