I wanted to be able to tell jde to prompt for app args by giving it a
C-u before the run command.  Now I can type C-u C-c C-v C-r instead of
going through the customize-variable jde-run-read-app-args process.

My lisp knowledge is limited and my emacs lisp knowledge is even more
limited so if there's a better way to do this, I'd like to know.

-jeff

--- jde-run.orig.el     Tue Dec 19 22:18:38 2000
+++ jde-run.el  Fri Jan 26 14:51:08 2001
@@ -533,17 +533,17 @@
 
 
 ;;;###autoload
-(defun jde-run ()
+(defun jde-run (&optional args)
   "Run the Java application specified by `jde-run-executable', if
 not the null string. Otherwise run the class specified by 
 `jde-run-application-class', if non-null; otherwise the class in
 the current buffer. This command also creates a comint buffer to allow
 you to interacti with the program."
-  (interactive)
+  (interactive "p")
   (if (string= mode-name "JDE")
       (if (string= jde-run-executable "")
-         (jde-run-main-class)
-       (jde-run-executable))
+         (jde-run-main-class (or jde-run-read-app-args (eq args 4)) )
+       (jde-run-executable (or jde-run-read-app-args (eq args 4)) ))
     (error "The jde-run command works only in a Java source buffer.")))
 
 (defun jde-run-get-main-class () 
@@ -561,12 +561,12 @@
 
 
 
-(defun jde-run-main-class()
+(defun jde-run-main-class( read-app-args )
   "Runs the Java program named by `jde-run-application-class' in
 a buffer, piping output from the program to the buffer and 
 input from the buffer to the program."
   (interactive)
-    (jde-run-internal (jde-run-get-main-class)))
+    (jde-run-internal (jde-run-get-main-class) read-app-args))
 
 ; (defmacro save-w32-show-window (&rest body)
 ;   "Saves the value of the w32-start-process-show-window variable
@@ -603,7 +603,7 @@
   (let ((run-buf-name (concat "*" (jde-run-get-main-class) "*")))
     (comint-check-proc run-buf-name)))
 
-(defun jde-run-internal(app-class)
+(defun jde-run-internal(app-class read-app-args)
   (let ((run-buf-name (concat "*" app-class "*"))
        (source-directory default-directory)
        (working-directory (if (string= jde-run-working-directory "")
@@ -628,7 +628,7 @@
                                 'jde-run-interactive-vm-arg-history)))
                           (list app-class)
                           jde-run-option-application-args
-                          (if jde-run-read-app-args
+                          (if read-app-args
                               (jde-run-parse-args
                                (read-from-minibuffer
                                 "Application args: "
@@ -658,7 +658,7 @@
       (message "An instance of %s is running." app-class)
       (pop-to-buffer run-buf-name))))
 
-(defun jde-run-executable()
+(defun jde-run-executable( read-app-args )
   (let* ((prog-name (file-name-sans-extension
                     (file-name-nondirectory jde-run-executable)))
         (run-buf-name (concat "*" prog-name "*"))
@@ -670,7 +670,7 @@
        (let* ((run-buffer (get-buffer-create run-buf-name))
               (prog-args (append
                           jde-run-executable-args
-                          (if jde-run-read-app-args
+                          (if read-app-args
                               (jde-run-parse-args
                                (read-from-minibuffer
                                 "Application args: "

Reply via email to