unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* [ANN] guile-bash
@ 2015-02-07 22:45 Dmitry Bogatov
  2015-02-12 22:39 ` Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Bogatov @ 2015-02-07 22:45 UTC (permalink / raw)
  To: guile-user

[-- Attachment #1: Type: text/plain, Size: 1406 bytes --]

Hello!

I would like to anounce my library, guile-bash.  With it, you can write
your bash functions in Scheme, like this:

(use-modules (gnu bash))
(define-bash-function (dtach-start-emacs)
  (unless (file-exists? "/tmp/emacs.dtach")
    #$[dtach -n /tmp/emacs.dtach emacs]))

This strange #$ is reader macro. To give a try, you should download
it from https://github.com/kaction/guile-bash, like this:

$ git clone git://github.com/kaction/guile-bash
$ cd guile-bash
$ autoreconf -if
$ ./configure
$ make
$ make install

Make sure, that directory, where Guile modules are installed
are in GUILE_LOAD_PATH. Locate libguile-bash.so
and do in your bash

$ enable -f /path/to/libguile-bash.so scm

Now you can copy snippet above to a file and make

$ scm /some/file/with/code.scm

Now you should have `dtach-start-emacs` function availiable.  To get
overview of what is availiable, see lisp/gnu/bash.scm Functions defined
with `define-ffi` and `define-public` are of interest.

About reader macro.  To get variable value, write `#$HOME`, to set

(set! #$HOME).

#$[echo foo] is just eval
#$(echo foo) captures output.

If you use Debian GNU/Linux, debianization is ready on
https://github.com/kaction/deb-guile-bash

I am very interested in your opinions.

[please keep me in CC]

--
Best regards, Dmitry Bogatov <KAction@gnu.org>,
Free Software supporter, esperantisto and netiquette guardian.
GPG: 54B7F00D

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [ANN] guile-bash
  2015-02-07 22:45 [ANN] guile-bash Dmitry Bogatov
@ 2015-02-12 22:39 ` Ludovic Courtès
  0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2015-02-12 22:39 UTC (permalink / raw)
  To: Dmitry Bogatov; +Cc: Guile User

Dmitry Bogatov <KAction@gnu.org> skribis:

> I would like to anounce my library, guile-bash.  With it, you can write
> your bash functions in Scheme, like this:
>
> (use-modules (gnu bash))
> (define-bash-function (dtach-start-emacs)
>   (unless (file-exists? "/tmp/emacs.dtach")
>     #$[dtach -n /tmp/emacs.dtach emacs]))

This looks neat!

[...]

> Now you should have `dtach-start-emacs` function availiable.  To get
> overview of what is availiable, see lisp/gnu/bash.scm Functions defined
> with `define-ffi` and `define-public` are of interest.

The (system ffi) module looks interesting.  It would be nice to
integrate some of these ideas it into Guile proper eventually.

> About reader macro.  To get variable value, write `#$HOME`, to set
>
> (set! #$HOME).
>
> #$[echo foo] is just eval
> #$(echo foo) captures output.

Cool.  Just one nit: #$ is also used by Guix, so it would be nice if
guile-bash would use something else, in the interest of composability.
;-)

Random comments:

  • lisp/ is conventionally the directory containing elisp code; for
    Guile code, some of us use module/ or modules/ or just the
    top-level directory.

  • There are places with unnecessarily repeated #:export or
    ‘use-modules’ forms that look verbose to me.

Thanks for the nice hack!

Ludo’.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-02-12 22:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-07 22:45 [ANN] guile-bash Dmitry Bogatov
2015-02-12 22:39 ` Ludovic Courtès

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).