* automatically decompiling a class file from jar.
@ 2003-10-04 10:41 jdijkmeijer
2003-10-06 17:31 ` Kevin Rodgers
0 siblings, 1 reply; 2+ messages in thread
From: jdijkmeijer @ 2003-10-04 10:41 UTC (permalink / raw)
Hi I thought it would be nice to automatically decompile a class file when
opening it from a jar. I already found decompile.el and that works fine on
class files loaded from a directory.
It's been a while since I wrote my last lisp program, and anyway I have
never been a real Lisp programmer but...
Looking into decompile.el I found an add-hook
;; a hook to be able to automatically decompile-find-file .class files
(add-hook
'find-file-hooks
(lambda ()
(let ((file (buffer-file-name)))
(cond ((and file (string= (substring file -6) ".class"))
(progn (jdc-buffer) (jde-mode)))))))
Which i deducted to be responsible for running the jad command on the file
to be opened. Now I wonder how difficult (or easy) is it to provide a hook
for opening a class file from a jar?
Going further into this, dreaming of some more really kewl emacs features It
would be really, really, really nice if you than could make changes to this
decompiled java file, compile it and place it back updated and compiled in
the jar file.
Of course classpath issues are lurking round the corner but...
Anyway lets stop dreaming, and back to some coding (yes on a Saturday
afternoon).
kind regards.
Jeroen.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: automatically decompiling a class file from jar.
2003-10-04 10:41 automatically decompiling a class file from jar jdijkmeijer
@ 2003-10-06 17:31 ` Kevin Rodgers
0 siblings, 0 replies; 2+ messages in thread
From: Kevin Rodgers @ 2003-10-06 17:31 UTC (permalink / raw)
jdijkmeijer wrote:
> ;; a hook to be able to automatically decompile-find-file .class files
> (add-hook
> 'find-file-hooks
> (lambda ()
> (let ((file (buffer-file-name)))
> (cond ((and file (string= (substring file -6) ".class"))
> (progn (jdc-buffer) (jde-mode)))))))
Slightly cleaner:
(add-hook 'find-file-hooks
(lambda ()
(when (equal (file-name-extension buffer-file-name) "class")
(jdc-buffer)
(jde-mode))))
> Which i deducted to be responsible for running the jad command on the file
> to be opened. Now I wonder how difficult (or easy) is it to provide a hook
> for opening a class file from a jar?
What is the value of buffer-file-name when you open a class file from a jar?
--
Kevin Rodgers
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-10-06 17:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-10-04 10:41 automatically decompiling a class file from jar jdijkmeijer
2003-10-06 17:31 ` Kevin Rodgers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).