help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: hooking jode to emacs


From: kgold
Subject: Re: hooking jode to emacs
Date: 22 Dec 2003 19:40:11 GMT

Kai Grossjohann <address@hidden> writes:
> [great suggestions]

This version puts the output in a .class.java buffer and eliminates
the two extra jode lines.

It works for classes that aren't in a package.

For classes in a package, passing the file name without the directory
is wrong.  Rather, one must discard only from the current working
directory up toward the root, and then create a relative path by
replacing the Unix "/" directory separator with the Java separator
".".

Anyone have too much free time?  :-)

(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")
        (set-buffer (create-file-buffer (concat (file-name-sans-extension file)
                                                ".class.java")))
        (shell-command (concat class-file-decompile-command " " 
                               (file-name-nondirectory 
(file-name-sans-extension file)))
        t                       ; output to current buffer
        nil)                    ; stderr goes to same buffer as stdout
        (java-mode)
        (goto-char (point-min))
        (kill-line 2)
    )
)

-- 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]