Geiser

Update: Since a few months ago, Geiser has its own home in the interwebs.

I hope you’ll pardon a shameless plug of one of my latest hacks, Geiser, a new Emacs-Scheme interaction mode.

After having lots of fun implementing Fuel, i was left with a lot of Elisp code that, i realized, could be easily reused for languages other than Factor. I also decided that it was high time to stop whining about Scheme environments not being dynamic enough and do something about it. As they say, talk is cheap.

Thusly, Geiser was born, and today it came of 0.0.1 0.0.2 age, as per the git tag in its repository.

If you know Slime or Fuel, you know what Geiser aims at: a pleasant, live interaction with Scheme without leaving Emacs. This first release is by no means there yet, but you’ll already find some joy using it: module-aware and incremental evaluation, jumping to definitions, dynamic symbol completion and automatic signature display in the echo area are the highlights.

Currently, Geiser supports two Scheme implementations: Guile and PLT. Yeah, i like both (and several others). It’s been really fun discovering how to tweak them to obtain the metadata i wanted, and their developers and users have been helpful, kind and patient to no end. A big thanks to them (you know who you are), and my promise that i’ll keep nagging.

Both Guile and PLT have given me many pleasant surprises. Guile is the most common-lispy Scheme around, and the recent hard work and improvements by the likes of Andy Wingo is making much of the criticism it memetically receives just moot. And PLT is by no means the rigid system i thought it was, while retaining all the great features i knew it had. Try any of them, with or without Geiser: they’re real fun.

Back to Geiser, this being an alpha release, there’s no screencasts or real documentation… the code just escaped leaving a blood trail, you know. Maybe one day it’ll have a webpage, a mailing list and even users. In the meantime, if you’re brave enough, the README will hopefully do; and, of course, the code:

  git clone git://gitorious.org/geiser/mainline.git

(If you’re not brave enough, but curious, the code is browsable here.)

Needless to say, all kinds of comments, criticisms and laundry lists are welcome and, actually, encouraged.

Happy scheming!

About these ads

39 Responses to “Geiser”

  1. Ryszard Szopa Says:

    I cannot get Geiser to work. It wasn’t able to connect a buffer with a repl. The messages are:

    Starting Geiser REPL for plt …
    Geiser Autodoc enabled
    ad-Orig-error: No prompt found!
    ad-Orig-error: No Geiser REPL for this buffer (try M-x run-geiser) [6 times]

    (Of course I did M-x run-geiser.)

    • jao Says:

      Just in case someone else encounters Ryszard’s problem: Geiser requires PLT Scheme 4.1.5.5 or better, which, as of this writing, means that one needs to get the SVN version. There also seem to be some problems with versions of Emacs prior to 22.3.

  2. redline6561 Says:

    Out of curiosity, how possible do you think it would be to get Geiser to work with Chicken Scheme? Is it (csi) reflective enough for those purposes?

    Thanks very much for contributing this.

    • jao Says:

      Someone more familiar with Chicken please correct me if i’m wrong, but last time i checked i found csi not good enough at providing metadata. I’m not sure if the recent 4.x releases brought significant improvements, though.

      • Mario Domenech Goulart Says:

        Hi jao

        What would be required from Chicken to make it work with geiser?

        Best wishes.
        Mario

        • jao Says:

          Mario,

          Each supported scheme implementation consists of two parts: an elisp layer, and a scheme backend. The former is easy (see for instance geiser-guile.el or geiser-plt.el), being basically a translation of elisp calls to scheme ones, which are implemented for each supported implementation in scheme (for instance, scheme/guile/geiser/emacs.scm is the exported interface for guile). Geiser relies almost exclusively on the scheme implementation to obtain the metadata it displays (there’s very little scheme semantics on the elisp side), and that, unfortunately, means that support for chicken won’t be as good as for the PLT or Guile (at least that’s my impression after skimming Chicken’s documentation): basically, you want a scheme implementation as close as possible to CL when it comes to reflection and run-time information. That said, there’s provision for gracefully support a subset of the functionality. There were a couple of people in #scheme that seemed interested in a Chicken backend some weeks ago: perhaps you could ask there.

  3. bubo Says:

    thanks, man!

    worked immeadately on Debian Lenny and emacs22-nox. i’m guile user, so i just put in ‘guile as described in the README. i’m usually using cmuscheme by Olin Shivers but this seems like a posssible alternative… regards b.

  4. Geiser: A New Emacs-Scheme Interaction Mode | Wisdom and Wonder Says:

    [...] Here is the announcement for a new Emacs-Scheme interaction mode that already works with PLT and Guile, and will probably soon be working with Ikarus, too. This was written by Grant. Posted on Saturday, May 30, 2009, at 9:24 pm. Filed under Link. Tagged Emacs, Ide, Programming Language, Scheme. Bookmark the permalink. Follow comments here with the RSS feed. Post a comment or leave a trackback. [...]

  5. Raoul Duke Says:

    another possible target could be Clojure. (i know nothing about its metadata offerings.)

    • jao Says:

      Raoul, for clojure, there’s already a slime port, which works quite well for what i’ve seen. so, the job is done :)

  6. guinness Says:

    Hey,
    I’ve been having the same problem as Ryszard. I used guile 1.8.7 and emacs 23.1.1 (from the arch linux repository).

    I do M-x run-geiser and still get the error “No Geiser REPL for this buffer” when I try to M-c M-r or anything using geiser. Anything I should try?

  7. Alex Suraci Says:

    Having a bit of trouble getting it going on OS X with PLT Scheme v4.2.3, Emacs v23.1.1. It gives me the same “No Geiser REPL for this buffer” error others were getting. It also had geiser-scheme-dir wrong, so I set it to /usr/local/share/geiser, to no avail. Any ideas?

    • jao Says:

      Alex, does this happen with an installed geiser (did you run make install)? If so, what’s your .emacs configuration? What is the value of geiser-scheme-dir before you set it? What exactly happens when you run M-x run-plt? Do you get a REPL buffer?

      • Alex Suraci Says:

        Yes, I installed it with ./configure, make, sudo make install.

        The value of geiser-scheme-dir was set to “/usr/local/share/emacs/scheme”. I’ve re-set it to that for the following information, just to be consistent.

        When I do “M-x run-plt” a REPL comes up (after quite a bit of delay), but at the top it says:

        default-load-handler: cannot open input file: “/usr/local/share/emacs/scheme/plt/geiser.ss” (No such file or directory; errno=2)

        This is what led me to figuring out that geiser-scheme-dir was incorrect; I changed it to where geiser installed to (/usr/local/share/geiser) and that error goes away, but geiser still doesn’t seem to detect the REPL. I’m assuming M-x run-plt is the same as M-x run-geiser, but with PLT specified?

        My Emacs config can be found here: http://github.com/vito/dotfiles/tree/master/.emacs.d/

        • jao Says:

          As mentioned in the README, you need
          (require ‘geiser-install)

          instead of
          (require ‘geiser)

          Does that make things any better?

          • Alex Suraci Says:

            Ah, I figured that was just an installation step.

            Unfortunately, it doesn’t seem to change anything; I changed that in my lisp.el, restarted, even ran the require in scratch after the restart, still no go.

          • Alex Suraci Says:

            Ah, sorry – my geiser-scheme-dir is correct now, but I get the same “No Geiser REPL” errors as before.

          • jao Says:

            What are those errors? Since the scheme dir is correct, i’m guessing the error you mention above is not the one happening now.

            What’s the value of your geiser-plt-binary variable? Does that coincide with that of mzscheme? If it’s relative, is mzscheme in your path?

          • Alex Suraci Says:

            The long pause leading to the “cannot open input file” is indeed solved. The errors I get now are when I try to run the buffer in the repl (C-c C-l), run the preceding sexp, etc – autodoc also says “Autodoc not available (No Geiser REPL for this buffer (try M-x run-geiser))”, despite a REPL being opened; everything makes the same complaint.

            geiser-plt-binary was set to “mzscheme”. Just to be sure, I set it to an absolute path to mzscheme, but that hasn’t changed anything. The REPL works fine, the geiser buffers just don’t seem to be aware of it.

            (Thanks for the troubleshooting, btw.)

          • jao Says:

            Is the extension of your scheme file .ss? If so, does the modeline say Plt somewhere? If not, you’ll need to customize geiser-implementations-alist to match your preferred extensions.

          • Alex Suraci Says:

            Ah hah! That was it. My file extension was .scm, not .ss. I saved it as .ss and re-opened. Now the modeline is “(Scheme Plt/A)”, and everything seems to work properly (Autodoc, C-c C-l, and C-x C-e tested). Thank you very much for your help.

  8. Richard Lewis Says:

    This looks very cool. I keep meaning to learn more Scheme and having a good environment to work with it is going to make that a lot easier. Thanks very much!

  9. Antony Panama Says:

    I usually don’t usually post on many another Blogs, yet I just has to say thank you… keep up the amazing work. Ok unfortunately its time to get to school.

  10. Dan Says:

    In the REPL (using mzscheme), if I start defining a function, and then press enter to go to the next line, to continue the definition, is there any way to set up tab to indent properly. Pressing tab in this circumstance freezes my emacs. Calling the function indent-for-tab-command indents to the last line’s opening paren. The indent-line-function is indent-relative. Calling lisp-indent-line does not move the point. Please let me know if you know of any adjustments I could make to my .emacs so that this works similarly to SLIME or quack. Thanks.

    • jao Says:

      Dan,

      that’s because TAB is trying to complete the symbol at point (and there’s none). I’ll see to fix this bad behaviour, and adding indentation capabilities a la slime to Geiser’s REPL. Thanks for the report and patience! :)

    • jao Says:

      Dan, i’ve just pushed what is hopefully a fix for the problems you were having with the REPL. Please, give it try when you find the time. Thanks a lot!

  11. Punya Says:

    scheme/Makefile.am in mainline doesn’t list a few files that are supposed to get installed. When I updated it manually, things seemed to work.

  12. rata Says:

    First of all, thank you for the good work.
    The only thing I cannot do is to eval/load/compile code from my buffers in the REPL, so the definitions are then available in the REPL.
    The key combinations that appear in the README file such as C-M-x don’t work. If I press M-x geiser-compile-current-buffer it seems to compile the file, but once it’s done, the definitions aren’t available in the REPL.
    I’m using geiser’s last version from git with PLT Scheme (version 4.2.5). I’m using ArchLinux.
    Do you know what the problem could be?
    The only thing I found to work around this problem is to write (require “file.scm”) in the REPL, but would like to have a faster way to do it and be able to eval just one sexp from the buffer.

    The .emacs snippet that configures geiser is:
    (setq geiser-impl-installed-implementations ‘(plt guile))
    (load-file (expand-file-name “~/src/scheme/geiser/elisp/geiser.el”))
    (require ‘geiser)
    (setq geiser-implementations-alist ‘(((regexp “\\.scm$”) plt)))

    Again, thank you.

    • jao Says:

      rata, the expressions are evaluated in the namespace of the file’s module, so you won’t see them in the REPL unless you switch to that module’s namespace. You can do that in the repl using (enter! (file “path/to/file.scm”)) or, more conveniently, by pressing C-uC-cz in the scheme buffer (that’s “go to the repl and switch to current module”). You’ll notice that you’re in the proper namespace because the prompt will change to reflect that.
      To return to the top-level, use (enter! #f).

      If that doesn’t work, pressing things like C-M-x should give you some kind of error: is that the case?

  13. Ramakrishnan's website / Not dead yet Says:

    [...] others who can also be interacted with at the #guile irc channel, which is great. I use Emacs and geiser to interact with [...]

  14. 2010 in review « programming musings Says:

    [...] Geiser May 2009 35 comments Posted in Programming. Leave a Comment » LikeBe the first to like this post. [...]

  15. Geiser tool | Syr21 Says:

    [...] Geiser « programming musingsPageRank Tool. Geiser. May 14, 2009 — jao. Update: Since a few months ago, Geiser has its own home in the interwebs. … If you know Slime or Fuel, you know what Geiser aims at: a pleasant, live interaction with Scheme without leaving … [...]

  16. Dirk T. (@Mues_Li) Says:

    Hi! First, thanks for geiser!

    Then: Is there a description of the wire protocol so I can implement geyser support in an editor other than emacs?

    • jao Says:

      I’m afraid there’s not written account. In addition, geiser’s wire protocol was not designed with editor-independence in mind; rather, it’s quite specific to be used by emacs at the other end, so it’d probably need some adjustments for what you intend.

      (Although i plan to eventually provide documentation about the implementation details of geiser, i won’t have time for that
      in at least a year :( ).


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 42 other followers

%d bloggers like this: