If you want to have the filename be an input to your lisp function, you can
adapt something from the following examples. They are just simple example
functions that insert their input into the buffer.
to try one in emacs you need to do M-x eval-defun on it and then invoke it
e.g. M-x get-existing-filename

note (interactive "f...)  requires an existing file name.  (interactive
"F...) would allow for a nonexisting file and (interactive "s...) would be
for a string.
The text after the letter (f,F,s) is the prompt. (There are other options
too).

(defun get-existing-filename (filename)
   "get a filename and insert it in the buffer"
   (interactive "fFilename: ")
   (insert filename))

(defun get-existing-filename-or-current-file (filename)
   "get a filename, or if none specified, the name of the file associated
    with this buffer, and insert it in the buffer"
   (interactive "fFilename, or <CR>for current file: ")
 (and (= (length filename) 0) (setq string buffer-file-name))
   (insert filename))


- Aaron


                                                                                       
                                                 
                    Max Gravitt                                                        
                                                 
                    <Max.Gravitt@        To:     "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>   
                                                 
                    sas.com>             cc:                                           
                                                 
                                         Subject:     Unit Testing with JDE            
                                                 
                    04/18/2001                                                         
                                                 
                    08:14 AM                                                           
                                                 
                                                                                       
                                                 
                                                                                       
                                                 





I have a script that I run to test my java classes, and the script takes
one required parameter - the name of the class.  I'd like to bind this to a
key very similiar to the way that the JDE compile works.  The JDE compile
executes the "cd" command, then executes "javac classpath <filename>".  I
would like my test to execute the "cd" command (to my hard-coded 'test'
directory, not the dir where the .java is), then execute my script
"test.ksh <class name>"  (where the classname is the java file without the
extension) and have the output displayed in a window (just like JDE
compile).

So my questions are:
1)  is it easy to copy the JDE compile code and just change what I need?
2)  even for an Emacs rookie (me) who has never done this before?
3)  and once I copy the code, where do I need to put it so that I can
invoke it?

thanks in advance
Max



Reply via email to