Emacs + Rhino for Mac

What:

ungulate-mode, an Emacs minor mode to send your Python buffers to Rhino with minimal hassle. Basic usage is in the source, but since it’s intended for existing Emacs users you should have a look there anyway. It’s pretty simple, lacks autocompletion for now, but maybe it will come in handy for someone out there (I imagine the intersection of Rhino and Emacs users is small). Feel free to submit issues, etc. with ideas for improvement.

Where: https://github.com/ianclarksmith/ungulate-mode

Why:

I haven’t really been keeping up on all the latest developments around here but it looks like there is some exciting stuff going on with respect to plugin development on Mac. A few years ago I hacked together this little thingy to run commands from a remote shell but it wasn’t very useful for more than testing out a command or two. Then a few months ago Rhino for Mac got the StartAtomEditorListener command which made writing Python for Rhino almost pleasant, until Atom crashed for the nth time and I longed to go back to Emacs. Earlier in the week I had a need to write a couple of scripts and figured it wouldn’t take much work to be able to do it in Emacs.

1 Like

Which json and request modules are you using? I’m usiing the OS X homebrew install, and both of those (require’s fail.

Using the built-in json package with Emacs 24.4 and 24.5 (not tried with earlier) and request is fine for me on master branch though is arbitrarily suggested to be 0.2.0 or newer. If those are both failing then the issue may have to do with your Emacs config. (require 'json) shouldn’t fail with homebrew Emacs. If the error message you see isn’t helpful, try this:

  • open -a /path/to/Emacs.app --args --debug-init for more detailed messages– maybe something else is failing on launch? (ELPA/MELPA stuff maybe)
  • open -a /path/to/Emacs.app --args -q to launch without user configuration, then try both requires in the *scratch* buffer assuming you have request.el installed

Thanks. I think I have something wrong with my homebrew installation, the json files are there but not the request files. I wiped and reinstalled and still no request.* files.

I tried installing 0.2.0 from source and it failed with connections to a local server and wouldn’t install.

What do you get for brew info?

bulafia:~ jet$ brew info emacs
emacs: stable 24.5 (bottled), devel 25.0.90, HEAD
GNU Emacs text editor
https://www.gnu.org/software/emacs/
/usr/local/Cellar/emacs/25.0.90 (4,047 files, 119.4M) *
Built from source with: --with-cocoa
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/emacs.rb
==> Dependencies
Build: xz :heavy_check_mark:, pkg-config :heavy_check_mark:
Optional: d-bus :heavy_check_mark:, gnutls ✘, librsvg ✘, imagemagick ✘, mailutils ✘, glib ✘

I use brew install emacs --HEAD --with-cocoa --with-d-bus --with-glib --with-gnutls --with-imagemagick --with-librsvg, and the request package from MELPA which uses the current Github source. Since you seem to have a working Emacs (with json), more things to try:

  1. Call (package-refresh-contents) and try again
  2. Try installing from the latest source or MELPA and making sure wherever it ends up is on your load-path, maybe there’s an issue with the release version.

All that being said, there’s nothing special about using request.el here and it could just as well use the built-in (url-retrieve) with some json parsing.

It’s in MELPA – pulled 'request from there and now everything is working. Thanks for writing this code, I think too much in emacs and find Atom very difficult to use as a text editor.