Wandbox client for Emacs
Emacs Lisp Makefile C
Latest commit 490eed2 Apr 18, 2016 @kosh04 Merge pull request #10 from tarsius/master
Require markdown-mode, not markdown, and not until actually needed

README.md

Wandbox for Emacser

MELPA Build Status

wandbox.el is Wandbox client program.

README : Japanese / English

What is Wandbox ?

Wandbox is online compilation service. Developed by @melponn and @kikairoya.

You can try various programming language such as C, C++, D, Haskell, Perl, Python, Ruby, PHP, Erlang, Java, JavaScript, CoffeeScript Rust, Common Lisp, and more.

Installation

  1. Install wandbox.el into your load-path directory. or M-x package-install wandbox if Emacs 24+.
  2. and put (require 'wandbox) into your .emacs.
;; .emacs sample
(require 'wandbox)
(global-set-key (kbd "C-c w w") 'wandbox)
(global-set-key (kbd "C-c w e") 'wandbox-eval-last-sexp)
(global-set-key (kbd "C-c w l") 'wandbox-list-compilers)

Usage

  1. Open some program source
  2. Type M-x wandbox to copmile this buffer
  3. The result are display to "Wandbox Output" buffer

for more details, see following reference.

References

Command

  • wandbox - Alias of wandbox-compile-buffer
  • wandbox-compile-file (filename) - Compile with file contents
  • wandbox-compile-region (from to) - Compile marked region
  • wandbox-compile-buffer () - Compile with current buffer
  • wandbox-list-compilers () - Display available compilers
  • wandbox-select-server (name) - Switch to selected NAME wandbox server

Function

  • wandbox - Alias of wandbox-compile
  • wandbox-compile (&rest profile &key compiler options code stdin compiler-option runtime-option lang name file save)

    Run wandbox compile with detailed options. arguments compiler, options, code, compiler-option, runtime-option, save is based on wandbox API.

  • wandbox-add-server (name location) - Register wandbox server the name as name

Variable

  • wandbox-profiles - List of wandbox compiler options.
  • wandbox-precompiled-hook - Hook run before post wandbox. Return value will be merged into the old profile.
  • wandbox-default-server - Wandbox server name to use by default. (default "melpon")

Example

;; Compile code with compiler name and options
(wandbox :compiler "gcc-head" :options "warning" :code "main(){}")
;; Compile as C source code (use wandbox-profiles)
(wandbox :lang "C" :code "main(){}")
;; Compile local file, and generate permalink
(wandbox :lang "C" :file "/path/to/prog.c" :save t)
;; Use standard-input
(wandbox :lang "Perl" :code "while (<>) { print uc($_); }" :stdin "hello")
;; Multiple compile
(wandbox :profiles [(:name "php HEAD") (:name "php")] :code "<? echo phpversion();")
;; Add user-profile
(add-to-list 'wandbox-profiles '(:name "ANSI C" :compiler "clang-head" :options "warning,c89"))
(wandbox :name "ANSI C" :file "/path/to/prog.c")
;; Compile gist snippet
;; sample: https://gist.github.com/219882
(wandbox :name "CLISP" :gist 219882 :stdin "Uryyb Jbeyq!")
;; Compile any url file (add :url keyword)
(defun* wandbox-option-url (&key url &allow-other-keys)
  (if url (plist-put nil :code (wandbox-fetch url))))
(add-to-list 'wandbox-precompiled-hook #'wandbox-option-url)

(wandbox :lang "C" :url "http://localhost/prog.c")
;; Use other server
(wandbox-add-server "fetus" "https://wandbox.fetus.jp")

(wandbox :code "<?php echo phpversion();"
         :profiles [(:name "HHVM") (:name "HippyVM") (:name "PHP")]
         :server-name "fetus")

;; switch default server
;; or M-x wandbox-select-server fetus
(setq wandbox-default-server-name "fetus")

TODO

  • add test
  • add merge-plist
  • configure response-data
  • handle gist snippet as code
  • multiple profiles (e.g. compare gcc/clang)
  • easy setting for compiler-options
  • require request.el
  • auto generated profile (#2)
  • use multiple files
  • use other wandbox clone (#3)

License

This software is licensed under the MIT-License.