[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Java decompilation on-the-fly, when opening .class file
From: |
Kevin Rodgers |
Subject: |
Re: Java decompilation on-the-fly, when opening .class file |
Date: |
Tue, 28 Oct 2003 17:57:35 -0700 |
User-agent: |
Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2 |
Joao wrote:
Has anyone set up a hook in emacs to call 'jad' or some other
Java decompiler when you visit a .class file ? I guess this should
be feasible, but my emacs-lisp skills are not up to this yet.
I would appreciate it if someone could share the code to do this.
I'm running emacs on Windows 2000 (not sure it matters).
I'd be surprised if the JDEE doesn't already provide a feature like that:
http://jdee.sunsite.dk/
But if it doesn't, how about something as simple as this:
(defvar class-file-decompile-command "jad -classpath ${CLASSPATH:-.}"
"The shell command run by `decompile-class-file'.")
(defun decompile-class-file (&optional file)
"Run `class-file-decompile-command' on FILE, but only if it's a .class file.
If FILE is nil, run it on `buffer-file-name'."
(interactive "fFile: ")
(or file (setq file buffer-file-name))
(and (equal (file-name-extension file) "class")
(shell-command (concat class-file-decompile-command " " file))))
(add-hook 'find-file-hooks 'decompile-class-file)
--
Kevin Rodgers