emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Rainer M Krug <r.m.krug@gmail.com>
To: Eric Schulte <schulte.eric@gmail.com>
Cc: Thorsten <gruenderteam.berlin@googlemail.com>, emacs-orgmode@gnu.org
Subject: Re: [babel] Suggestions: GRASS GIS und Lilypond
Date: Wed, 16 Feb 2011 10:14:54 +0100	[thread overview]
Message-ID: <4D5B958E.5030103@gmail.com> (raw)
In-Reply-To: <87ei795dzc.fsf@gmail.com>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 02/15/2011 07:46 PM, Eric Schulte wrote:
> I am happy to answer questions and provide suggestions for anyone who is
> interested in developing support for these (or any other) additional
> languages.  I would recommend looking at existing languages which are
> similar to the new language for guidance/examples.
> 
> In the case of GRASS, it sounds as though GRASS is a sub[super]-set of
> R?  

No - GRASS can be described as a collection of commands which are
executed in the shell after some environmental variables are set. So
GRASS is rather a super set of a bash shell.
So an implementation of GRASS could easily build on how sh code blocks
are hab=ndled in org.

Interactive GRASS sessions are effectively sh sessions with adapted
$PATH variable and a few environmental variables, to make the GRASS
commands accessible. So really the easiest would be to use the existing
sh support, set the environmental variables, set the $PATH and execute
the commands.
The environmental variables could be defined in :var - so actually that
should not be a problem.

Syntax highlighting could be based on sh with added commands in the
added $PATH - should not be to difficult (theoretically...).

> Would it be possible to simply use the existing R support in babel
> only specify a non-R command to be run to start interactive sessions?

Well - R, like python which is becoming the "official" scripting
language for GRASS, has a set of commands to interface with GRASS - so
using R (or python) would not be a useful approach.

There is an R package (spGRASS6) which is doing exactly what I mentioned
above (setting the $PATH and the environmental variables) to be able to
execute grass commands from within R - (with the syntax

execGRASS( "COMMAND", ... )

So one could look at that command (initGRASS() I think it is called) to
see what is necessary - or just execute grass:

grass -text GISBASE/LOCATION_NAME/MAPSET

##########################################
rkrug@ecolmod:~/deb$ grass --help
Usage:
  grass64 [-h | -help | --help] [-v | --version] [-c]
          [-text | -gui | -tcltk | -oldtcltk | -wxpython | -wx]
          [[[<GISDBASE>/]<LOCATION_NAME>/]<MAPSET>]

Flags:
  -h or -help or --help          print this help message
  -v or --version                show version information and exit
  -c                             create given mapset if it doesn't exist
  -text                          use text based interface
                                   and set as default
  -gui                           use graphical user interface (wxpython
by default)
                                   and set as default
  -tcltk                         use Tcl/Tk based graphical user interface
                                   and set as default
  -oldtcltk                      use old Tcl/Tk based graphical user
interface
                                   and set as default
  -wxpython or -wx               use wxPython based graphical user interface
                                   and set as default

Parameters:
  GISDBASE                       initial database (path to GIS data)
  LOCATION_NAME                  initial location
  MAPSET                         initial mapset

  GISDBASE/LOCATION_NAME/MAPSET  fully qualified initial mapset directory

Environment variables relevant for startup:
  GRASS_GUI                      select GUI (text, gui, tcltk, oldtcltk,
wxpython)
  GRASS_TCLSH                    set tclsh shell name to override 'tclsh'
  GRASS_WISH                     set wish shell name to override 'wish'
  GRASS_HTML_BROWSER             set html web browser for help pages
  GRASS_ADDON_PATH               set additional path(s) to local GRASS
modules
  GRASS_BATCH_JOB                shell script to be processed as batch job
  GRASS_PYTHON                   set python shell name to override 'python'
rkrug@ecolmod:~/deb$
##########################################


So it should be doable relatively easily I guess.

So the environmental variables needed would be:

 GISDBASE                    initial database (path to GIS data)
 LOCATION_NAME               initial location
 MAPSET                      initial mapset

So that GRASS can build

 GISDBASE/LOCATION_NAME/MAPSET  fully qualified initial mapset directory

Thinking of it, a GRASS code block

#+begin_src grass
 ...
#+end_src

would be a sh code block, in which as the first command "grass -text" is
executed, i.e.

#+begin_src grass
  grass -text
  ...
#+end_src

For tangling: GRASS scripts are executed usually from within GRASS, so
they are normal sh scripts (same shebang and all)

So implementation should be rather straight forward, I think?

Just a side note: as GRASS installs in addition to the command grass
also a command "grass64" for version 6.4 etc, it would be nice to have
the command "grass" modifiable.


Cheers,

Rainer

> 
> Best -- Eric
> 
> Thorsten  <gruenderteam.berlin@googlemail.com> writes:
> 
>> Hello Babel developers, 
>> just two suggestions for new languages: 
>> 1. GRASS GIS
>> As far as I know there is no grass-mode in emacs, but some expert people are
>> successful running grass processes together with R processes in ESS.
>> Since GRASS and R are natural allies, it would be great to use the GRASS
>> engine in an org-file to retrieve spatial data and then analyse the data
>> with R in the same file - would make Org a kind of emacs-grassmode
>> replacement.  
>> 2. Lilypond
>> A nice to have for all the music lovers in the org community. 
>> Regards
>> Thorsten
>>
>>
>> _______________________________________________
>> Emacs-orgmode mailing list
>> Please use `Reply All' to send replies to the list.
>> Emacs-orgmode@gnu.org
>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
> 
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode


- -- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Natural Sciences Building
Office Suite 2039
Stellenbosch University
Main Campus, Merriman Avenue
Stellenbosch
South Africa

Tel:        +33 - (0)9 53 10 27 44
Cell:       +27 - (0)8 39 47 90 42
Fax (SA):   +27 - (0)8 65 16 27 82
Fax (D) :   +49 - (0)3 21 21 25 22 44
Fax (FR):   +33 - (0)9 58 10 27 44
email:      Rainer@krugs.de

Skype:      RMkrug
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk1blY4ACgkQoYgNqgF2egouBgCfdJliPegFD+52k6+CF6Zw25bM
hfEAoIo7M1r1TkQbJ1CoeD+kW1jxfQW6
=ezOa
-----END PGP SIGNATURE-----

  reply	other threads:[~2011-02-16  9:15 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-15  1:02 [babel] Suggestions: GRASS GIS und Lilypond Thorsten
2011-02-15  2:57 ` John Hendy
2011-02-15  8:19   ` Thorsten
2011-02-15 17:15     ` John Hendy
2011-02-15  9:11 ` Rainer M Krug
2011-02-15  9:59 ` Christian Moe
2011-02-15 10:08   ` Bastien
2011-02-16 21:21   ` Shelagh Manton
2011-02-17 18:40     ` Martyn Jago
2011-02-20 20:37       ` Shelagh Manton
2011-02-20 20:42         ` Shelagh Manton
2011-02-21 13:01           ` Martyn Jago
2011-02-15 18:46 ` Eric Schulte
2011-02-16  9:14   ` Rainer M Krug [this message]
2011-02-18 22:39 ` Thorsten

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D5B958E.5030103@gmail.com \
    --to=r.m.krug@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=gruenderteam.berlin@googlemail.com \
    --cc=schulte.eric@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).