This elisp is an example of sending the buffer contents to a command line
program, and back.  It is from the Jindent web site (which is a great tool
for cleaning up that messy code received from others!).


Jindent Integration for "Emacs"
(from Holger Uhr, [EMAIL PROTECTED])

Add the following lines to your .emacs file to integrate Jindent:


(defun jindent ()
"Pipes the buffer through Jindent"
(interactive)
(message "Jindenting buffer (http://www.jindent.de) ...")
(setq executing-kbd-macro t)
(filter-buffer "/usr/local/java/jdk1.2/bin/java -classpath \
~/lib/Jindent/Jindent.jar: Jindent -mute -p \
~/lib/Jindent/Holger.jin")
(setq executing-kbd-macro nil)
(message "Jindenting buffer (http://www.jindent.de) ... done")
)

(defun filter-buffer (command)
(shell-command-on-region (point-min) (point-max) \
command t t "*Messages*")
)


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On
Behalf Of Rob Shaw
Sent: Thursday, November 02, 2000 6:52 PM
To: [EMAIL PROTECTED]
Subject: Sending the current buffer to a Java application.


I'm interested in sending a buffer to the stdin of a Java
application, have it process the input stream, and stream the
results back via stdout into the original emacs buffer.

There are many possible uses for such a configuration.
For example, one could create an english to german conversion
utility.  The idea here is that such utilities could be written
in Java as opposed to elisp.

Does anybody have some sample code or know of any sample code
that I could look at?

Thanks,
Rob

Reply via email to