unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: kgold@watson.ibm.com (kgold)
Subject: Re: hooking jode to emacs
Date: 22 Dec 2003 19:40:11 GMT	[thread overview]
Message-ID: <bs7har$bka$1@news.btv.ibm.com> (raw)
In-Reply-To: 87u13sygn5.fsf@emptyhost.emptydomain.de

Kai Grossjohann <kai@emptydomain.de> 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	other threads:[~2003-12-22 19:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-19 21:49 hooking jode to emacs kgold
2003-12-19 23:38 ` Kevin Rodgers
2003-12-22 14:47   ` kgold
2003-12-22 16:13     ` Kai Grossjohann
2003-12-22 19:40       ` kgold [this message]
2003-12-22 21:16         ` Kai Grossjohann
2003-12-23 17:59           ` Kevin Rodgers
2003-12-23 20:22             ` Kevin Rodgers
2003-12-25 16:28             ` Kai Grossjohann
2003-12-29 21:38               ` Kevin Rodgers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='bs7har$bka$1@news.btv.ibm.com' \
    --to=kgold@watson.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).