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: Kai Grossjohann
Subject: Re: hooking jode to emacs
Date: Mon, 22 Dec 2003 17:13:50 +0100
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.2 (gnu/linux)

address@hidden (kgold) writes:

> (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-name-nondirectory 
> (file-name-sans-extension file))))))

Maybe it's better to use call-process instead of shell-command.  Hm.
Oh, no it's not necessary, you can specify a buffer for the output of
the shell command.

Maybe like this:

(set-buffer (create-file-buffer (concat (file-name-sans-extension file)
                                        ".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)

What do you think?

Regarding the two extra lines, maybe you're lucky and the output goes
to stderr, so you can just specify a buffer instead of nil for the two
extra lines.  If not, you can always do (goto-char (point-min))
followed by (kill-line 2) to delete the first two lines.

Kai


reply via email to

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