[GRASS-user] Re: using GRASS in Emacs environment: msg#00039
Seb
spluque at gmail.com
Wed May 20 12:11:16 EDT 2009
On Thu, 18 Dec 2008 18:01:10 +0000,
Glynn Clements <glynn at gclements.plus.com> wrote:
[...]
> FWIW, I would suggest skipping the "grass63" startup altogether.
> I source the following script from my ~/.bash_profile (which is
> sourced by my ~/.xsession file, so the settings also apply to X
> programs):
> #export GISBASE=/opt/grass-7.0.svn export
> GISBASE=/usr/local/src/grass/svn/dist.i686-pc-linux-gnu export
> GRASS_GNUPLOT='gnuplot -persist' export GRASS_WIDTH=640 export
> GRASS_HEIGHT=480 export GRASS_HTML_BROWSER=firefox export
> GRASS_PAGER=cat export GRASS_WISH=wish export GRASS_PYTHON=python
> export GRASS_MESSAGE_FORMAT=silent export GRASS_TRUECOLOR=TRUE export
> GRASS_TRANSPARENT=TRUE export GRASS_PNG_AUTO_WRITE=TRUE
> export PATH="$GISBASE/bin:$GISBASE/scripts:$PATH" export
> LD_LIBRARY_PATH="$GISBASE/lib" export
> GRASS_LD_LIBRARY_PATH="$LD_LIBRARY_PATH" export
> PYTHONPATH="$GISBASE/etc/python:$PYTHONPATH" export
> MANPATH=$MANPATH:$GISBASE/man
> export GIS_LOCK=$$ export GRASS_VERSION="7.0.svn"
> tmp=/tmp/grass6-"`whoami`"-$GIS_LOCK export GISRC="$tmp/gisrc"
> mkdir "$tmp" cp ~/.grassrc6 "$GISRC"
> This means that I can run GRASS commands anywhere, e.g. using M-! from
> within XEmacs. You can use g.mapset to change
> database/location/mapset. It should also allow you to use other
> packages which normally only work "within GRASS".
> Starting a login shell ("bash --login", which sources ~/.bash_profile)
> will create a separate session with its own $GISRC file.
> Many of the environment variables are optional. The ones which really
> matter are GISBASE, GISRC, PATH and LD_LIBRARY_PATH. g.mapset requires
> GIS_LOCK to be set, but it doesn't matter to what. The others are only
> used by specific modules; see variables.html in the GRASS
> documentation for an extensive list.
I like this way of working. In Emacs, I've found one needs to set PATH
variable so that completion works in shell modes, etc.
(setq gisbase "/usr/lib/grass64") ; or where it lives
(setenv "PATH" (concat (getenv "PATH") path-separator gisbase "/bin"
path-separator gisbase "/scripts"))
(add-to-list 'exec-path (concat gisbase "/bin") t)
(add-to-list 'exec-path (concat gisbase "/scripts") t)
Then TAB completes GRASS modules as usual in shell modes. Sh-script
mode offers a subset of the facilities that ESS gives when working with
R, including executing regions, buffer, etc.
--
Seb
More information about the grass-user
mailing list