1 ;;; w3-java.el --- Rudimentary java support
2 ;; Author: $Author: fx $
3 ;; Created: $Date: 2002/01/22 18:31:50 $
4 ;; Version: $Revision: 1.3 $
5 ;; Keywords: hypermedia, scripting
7 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8 ;;; Copyright (c) 1999, 2008 Free Software Foundation, Inc.
10 ;;; This file is part of GNU Emacs.
12 ;;; GNU Emacs is free software; you can redistribute it and/or modify
13 ;;; it under the terms of the GNU General Public License as published by
14 ;;; the Free Software Foundation; either version 2, or (at your option)
15 ;;; any later version.
17 ;;; GNU Emacs is distributed in the hope that it will be useful,
18 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;;; GNU General Public License for more details.
22 ;;; You should have received a copy of the GNU General Public License
23 ;;; along with GNU Emacs; see the file COPYING. If not, write to the
24 ;;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
25 ;;; Boston, MA 02111-1307, USA.
26 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
28 ; (require 'url-util) ; for `url-generate-unique-filename'
31 "Emacs/W3 Java Runtime support"
35 (defcustom w3-java-vm-program "hotjava"
36 "*The program name of the Java virtual machine."
37 :type '(choice (string :tag "External program")
38 (function :tag "Lisp function"))
41 (defcustom w3-java-vm-arguments '(file)
42 "*Arguments that should be passed to the program `w3-java-vm-program'.
43 The special symbol 'file may be used in the list of arguments and will
44 be replaced with the name of a file containing the commands to run a
49 (defun w3-java-run-applet (options params)
50 (let ((file (url-generate-unique-filename "%s-runjava.html")))
52 (set-buffer (get-buffer-create " *java*"))
56 " <title>Emacs/W3 Java Application</title>\n"
60 " This page was automatically generated by Emacs/W3 to\n"
61 " run this Java applet. Any problems with the HTML should\n"
62 " be referred to <a href='mailto:w3-bugs@xemacs.org'>\n"
63 " the Emacs/W3 bug list</a>.\n"
67 (mapconcat (lambda (x) (format "%s=\"%s\"" (car x) (cdr x))) options " ")
69 (mapconcat (lambda (x) (format " <param name=\"%s\" value=\"%s\">" (car x) (cdr x))) params "\n")
73 (write-region (point-min) (point-max) file)
75 (if (stringp w3-java-vm-program)
76 (let ((process-connection-type nil)
79 `(start-process name buffer w3-java-vm-program
80 ,@w3-java-vm-arguments)))
81 (process-kill-without-query proc)
83 (eval `(funcall w3-java-vm-program
84 ,@w3-java-vm-arguments))))))