[PATCH 1/2] Factorize minibuffer prompts to read a class name in `jde-read-class-name'.

Paul Landes <[email protected]>
Newsgroups gmane.emacs.jdee.user,gmane.emacs.jdee.devel
Message-ID <[email protected]>
I appreciate the patch, but there will be functionality in the next
release that does a lot of this, including uses `completing-read' as
your comment mentions :)

Also, the direction I'd like to set is one function for class
reading/finding/visiting.  Currently we have two, this adds a third.
I'd like go keep it at one.

Thanks.

Ludovic Courtès writes:
 > 
 > * jde/lisp/jde-class.el (jde-read-class-name): New function.
 > 
 > * jde/lisp/jde-run.el (jde-run): Use `jde-read-class-name'.
 > ---
 >  jde/lisp/jde-class.el |   12 ++++++++++++
 >  jde/lisp/jde-run.el   |    8 +++-----
 >  2 files changed, 15 insertions(+), 5 deletions(-)
 > 
 > diff --git a/jde/lisp/jde-class.el b/jde/lisp/jde-class.el
 > index daa0e59..27adf7e 100644
 > --- a/jde/lisp/jde-class.el
 > +++ b/jde/lisp/jde-class.el
 > @@ -2,6 +2,7 @@
 >  ;; $Revision: 1.6 $
 >  ;;
 >  ;; Copyright (C) 2003 Andrew Hyatt
 > +;; Copyright (C) 2009 Ludovic Courtès
 >  ;;
 >  ;; Author: Andrew Hyatt <[email protected]>
 >  ;; Maintainers: Andrew Hyatt and Paul Kinnucan
 > @@ -218,6 +219,17 @@ will not be."
 >                                          (dolist (exceptions (mapcar (lambda (method-exceptions) (nth 1 method-exceptions))
 >                                                                      (jde-parse-class-extract-caught-exception-types info)))
 >                                            (append-to-list 'classes exceptions)))))
 > +
 > +(defun jde-read-class-name (&optional default)
 > +  "Read a class name from the prompt, defaulting to DEFAULT or
 > +the class name corresponding to the current source file if
 > +DEFAULT is omitted."
 > +  (let ((default (or default
 > +		     (concat (jde-db-get-package)
 > +			     (file-name-sans-extension 
 > +			      (file-name-nondirectory (buffer-file-name)))))))
 > +    ;; FIXME: Use `completing-read'.
 > +    (read-no-blanks-input "Main class: " default)))
 >      
 >  (provide 'jde-class)    
 >  
 > diff --git a/jde/lisp/jde-run.el b/jde/lisp/jde-run.el
 > index 6e643b8..2605670 100644
 > --- a/jde/lisp/jde-run.el
 > +++ b/jde/lisp/jde-run.el
 > @@ -6,6 +6,7 @@
 >  ;; Keywords: tools, processes
 >  
 >  ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2008 Paul Kinnucan
 > +;; Copyright (C) 2009 Ludovic Courtès
 >  
 >  ;; GNU Emacs is free software; you can redistribute it and/or modify
 >  ;; it under the terms of the GNU General Public License as published by
 > @@ -35,6 +36,7 @@
 >  ;; Paul Kinnucan at [email protected]
 >  
 >  (require 'eieio)
 > +(require 'jde-class)
 >  
 >  (defcustom jde-run-mode-hook nil
 >    "*List of hook functions run by `jde-run-mode' (see `run-hooks')."
 > @@ -1199,11 +1201,7 @@ interact with the program."
 >  	     vm
 >  	     :main-class
 >  	     (if read-main-class
 > -		 (read-from-minibuffer
 > -		  "Main class: "
 > -		  (concat (jde-db-get-package)
 > -		      (file-name-sans-extension 
 > -		       (file-name-nondirectory (buffer-file-name)))))
 > +		 (jde-read-class-name (jde-run-get-main-class))
 >  	       (jde-run-get-main-class)))
 >  	    (let ((jde-run-read-app-args read-app-args))
 >  	      (jde-run-vm-launch vm)))
 > -- 
 > 1.6.1.3
 > 
 > 
 > 
 > ------------------------------------------------------------------------------
 > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
 > trial. Simplify your report design, integration and deployment - and focus on 
 > what you do best, core application coding. Discover what's new with 
 > Crystal Reports now.  http://p.sf.net/sfu/bobj-july
 > _______________________________________________
 > jdee-users mailing list
 > [email protected]
 > https://lists.sourceforge.net/lists/listinfo/jdee-users


-- 
Paul Landes
[email protected]

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.