Skip to content

clojure-emacs/cider-decompile

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 

Repository files navigation

Installation

Via package.el

package.el is the built-in package manager in Emacs 24+. On Emacs 23 you will need to get package.el yourself if you wish to use it.

cider-decompile is available on both major package.el community maintained repos - Marmalade and MELPA.

If you're not already using Marmalade, add this to your ~/.emacs.d/init.el (or equivalent) and load it with M-x eval-buffer.

(require 'package)
(add-to-list 'package-archives
             '("marmalade" . "http://marmalade-repo.org/packages/"))
(package-initialize)

For MELPA the code you need to add is:

(require 'package)
(add-to-list 'package-archives
             '("melpa" . "http://melpa.milkbox.net/packages/") t)
(package-initialize)

And then you can install CIDER with the following command:

M-x package-install [RET] cider-decompile [RET]

or by adding this bit of Emacs Lisp code to your Emacs initialization file(.emacs or init.el):

(unless (package-installed-p 'cider-decompile))
  (package-install 'cider-decompile))

If the installation doesn't work try refreshing the package list:

M-x package-refresh-contents [RET]

Usage

First you have to install javap-mode because it will be used to display JVM-bytecode. You also need to compile your clojure files to bytecode by running lein compile on a command prompt inside your project directory.

Next. Since cider-decompile depends on cider, it has to be installed and running. Start cider session like this:

M-x cider-jack-in [RET]

Let's say, we've got the following namespace in the Clojure project: myns.core. Compile it, pressing in its buffer:

C-c C-k

Switch to this namespace in the cider buffer.

(in-ns 'myns.core)

Now you may decompile any function in the current namespace using command cider-decompile-func. For instance, if you have function myns.core/main, then you may decompile it like this:

M-x cider-decompile-func [RET] main [RET]

If you want to decompile a function from the other namespaces, you may use command cider-decompile-ns-func. For example, decompiling function myotherns.core/other-main would look like this:

M-x cider-decompile-ns-func [RET] myotherns.core/other-main [RET]

After the command was invoked, the buffer decompiled apears showing the bytecode of the function.

About

An extension to CIDER which provides a decompilation command

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 5