Re: Patch for allowing wildcards in jde-sourcepath
Troy Daniels <[email protected]>
| Newsgroups | gmane.emacs.jdee.devel |
|---|---|
| Message-ID | <[email protected]> |
I've added in the declare-functions, so the new warnings should be gone. I'm using emacs 22, where declare-function is a no-op, so I still get the warnings, but the calls are there. Troy On Thu, Apr 1, 2010 at 2:03 AM, Len Trigg <[email protected]<lenbok%[email protected]> > wrote: > You can nicely make the warnings go away by using declare-function > (which we have started to do in several places). > > http://www.gnu.org/software/emacs/elisp/html_node/Declaring-Functions.html > > Cheers, > Len. > > On Thu, Apr 1, 2010 at 4:05 PM, Troy Daniels > <[email protected]> wrote: > > I'm cleaning up those warnings, but there's one I'm not certain how to > > handle. > > > > In end of data: > > jde-db.el:2018:1:Warning: the following functions are not known to be > > defined: > > jde-find-class-source-file, jde-build-classpath, jde-normalize-path, > > jde-jdb-get-jdb > > > > has now become > > > > In end of data: > > jde-db.el:2017:1:Warning: the following functions are not known to be > > defined: > > jde-find-class-source-file, jde-build-classpath, jde-normalize-path, > > jde-jdb-get-jdb, jde-expand-wildcards-and-normalize > > > > The new function is defined in the jde.el, the same file as > > jde-normalize-path, and that seems to be the logical place to define it > (as > > it is related to jde-normalize-path). Is there a standard way to make > > "forward declarations" for the compiler? Since there is already a > warning > > for jde-normalize-path, it seems that there probably is not a way. If > so, > > is it acceptable to add this warning to the build? > > > > There is a similar warning in jde-javadoc-gen.el > > > > I've attached the updated patch in case these warnings are acceptable. > > > > Troy > > > > > >> Cheers, > >> Len. > > > > > ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ jdee-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/jdee-devel
jdee-wildcards.patch
(application/octet-stream, 8 KB)
Index: jdee/lisp/jde-db.el
===================================================================
--- jdee/lisp/jde-db.el (revision 220)
+++ jdee/lisp/jde-db.el (working copy)
@@ -47,8 +47,8 @@
(defvar jde-global-classpath)
(defvar jde-sourcepath)
(defvar jde-debugger)
+(declare-function jde-expand-wildcards-and-normalize "jde" (path &optional symbol))
-
;; ======================================================================
;; jde-db variables
@@ -2000,18 +2000,15 @@
"Return true if one of `jde-sourcepath'
matches FILE."
(let* ((directory-sep-char ?/)
- (filename (jde-normalize-path file)))
+ (filename (jde-normalize-path file)))
(find-if
(lambda (dir-x)
(string-match
- (concat
- "^"
- (jde-normalize-path
- dir-x
- 'jde-sourcepath))
- filename))
- jde-sourcepath)))
+ (concat "^" dir-x)
+ filename))
+ (jde-expand-wildcards-and-normalize jde-sourcepath 'jde-sourcepath))))
+
(provide 'jde-db)
;;; End of jde-db.el
Index: jdee/lisp/jde-javadoc-gen.el
===================================================================
--- jdee/lisp/jde-javadoc-gen.el (revision 220)
+++ jdee/lisp/jde-javadoc-gen.el (working copy)
@@ -33,6 +33,7 @@
(defvar browse-url-new-window-p)
(defvar jde-global-classpath)
(defvar jde-sourcepath)
+(declare-function jde-expand-wildcards-and-normalize "jde" (path &optional symbol))
(defgroup jde-javadoc nil
"Javadoc template generator"
@@ -328,8 +329,7 @@
(list
"-sourcepath"
(jde-build-classpath
- jde-sourcepath
- 'jde-sourcepath)))))
+ (jde-expand-wildcards-and-normalize jde-sourcepath 'jde-sourcepath))))))
;; Insert bootclasspath
Index: jdee/lisp/jde-open-source.el
===================================================================
--- jdee/lisp/jde-open-source.el (revision 220)
+++ jdee/lisp/jde-open-source.el (working copy)
@@ -96,7 +96,7 @@
(fboundp 'jde-parse-find-completion-for-pair)))
-(defun jde-open-jump-to-class (parsed-symbol class-name)
+(defun jde-open-jump-to-class (parsed-symbol class-name)
"Place the cursor in the parsed variable"
(let* (tags super-class (first-time t))
;; Searching only for the symbol '{' is not good enough. We can
@@ -118,7 +118,7 @@
(setq parsed-symbol (concat "\\b" parsed-symbol "\\b"))
(while (not (senator-re-search-forward parsed-symbol nil t))
(message "Could not find %s in %s" parsed-symbol (buffer-name))
- ;; searching for the thing-of-interest has failed
+ ;; searching for the thing-of-interest has failed
;; let's try in the base class
(progn
(if (not super-class)
@@ -132,7 +132,7 @@
;;if it is the first time try in the class definition
;;itself.
(if first-time
- (progn
+ (progn
(setq first-time nil)
(senator-re-search-forward
(progn
@@ -145,13 +145,13 @@
(defun jde-get-parents ()
"Returns a list with all the parents (super class and interfaces,
if any) of the current class or interface."
- (jde-remove-type
+ (jde-remove-type
(append (semantic-tag-type-superclasses
(semantic-current-tag-of-class 'type))
- (semantic-tag-type-interfaces (semantic-current-tag-of-class
+ (semantic-tag-type-interfaces (semantic-current-tag-of-class
'type)))))
-(defun jde-remove-type (list)
+(defun jde-remove-type (list)
"Removes generics '<Type>' declaration from every given
class/interface name."
(mapcar '(lambda(s) (replace-regexp-in-string "<.*>" "" s)) list))
@@ -317,9 +317,7 @@
".java")
package (jde-parse-get-package-from-name outer-class))
(catch 'found
- (loop for path in jde-sourcepath do
- (progn
- (setq path (jde-normalize-path path 'jde-sourcepath))
+ (loop for path in (jde-expand-wildcards-and-normalize jde-sourcepath 'jde-sourcepath) do
(if (and (file-exists-p path)
(or (string-match "\.jar$" path)
(string-match "\.zip$" path)))
@@ -355,7 +353,7 @@
(pkg-dir (expand-file-name pkg-path path))
(file-path (expand-file-name file pkg-dir)))
(if (file-exists-p file-path)
- (throw 'found file-path))))))))))
+ (throw 'found file-path)))))))))
(defcustom jde-preferred-packages
'("java.util" "java" "javax")
Index: jdee/lisp/jde-package.el
===================================================================
--- jdee/lisp/jde-package.el (revision 220)
+++ jdee/lisp/jde-package.el (working copy)
@@ -152,7 +152,7 @@
(jde-package-get-classpath)))
-(defun jde-package-seach-package-directories ()
+(defun jde-package-search-package-directories ()
"Return a list of package directory candidates or nil if not found."
(let ((dir (jde-normalize-path default-directory))
;; case-insensitive for Windows
@@ -166,9 +166,8 @@
(append (jde-package-get-directories-in-classpath)
(mapcar
(lambda (p)
- (file-name-as-directory
- (jde-normalize-path p 'jde-sourcepath)))
- jde-sourcepath)))))
+ (file-name-as-directory p))
+ (jde-expand-wildcards-and-normalize jde-sourcepath 'jde-sourcepath))))))
(defun jde-package-best-package-candidate (candidates)
"Return the best package directory candidate from CANDIDATES.
@@ -181,7 +180,7 @@
"Return the package directory, if found; otherwise,
`jde-package-unknown-package-name'."
(or (jde-package-best-package-candidate
- (jde-package-seach-package-directories))
+ (jde-package-search-package-directories))
jde-package-unknown-package-name))
Index: jdee/lisp/jde-xref.el
===================================================================
--- jdee/lisp/jde-xref.el (revision 220)
+++ jdee/lisp/jde-xref.el (working copy)
@@ -190,7 +190,12 @@
(when (and (eq major-mode 'jde-mode) jde-sourcepath)
(let ((first-prefix (car (split-string (jde-parse-get-package-name)
"\\."))) (prefixes))
- (dolist (path (remove-if-not (lambda (path) (file-exists-p path)) jde-sourcepath) prefixes)
+ (dolist (path (remove-if-not
+ (lambda (path)
+ (file-exists-p path))
+ (jde-expand-wildcards-and-normalize jde-sourcepath
+ 'jde-sourcepath))
+ prefixes)
(when (member first-prefix (directory-files path nil "[^.]$"))
(message (concat "path = " path))
(add-to-list 'prefixes (get-prefix path first-prefix))))))))
Index: jdee/lisp/jde.el
===================================================================
--- jdee/lisp/jde.el (revision 220)
+++ jdee/lisp/jde.el (working copy)
@@ -542,7 +542,7 @@
source files corresponding to class files. When entering paths in the
custom buffer, enter each path as a separate item in a separate edit
field. Do NOT put more than one path in the same edit field. You'll
-only confuse JDE. Paths may contain environment variables."
+only confuse JDE. Paths may contain environment variables or wildcards."
:group 'jde-project
:type '(repeat (file :tag "Path")))
@@ -1483,6 +1483,30 @@
(setq p (jde-convert-cygwin-path p))
p))
+(defcustom jde-expand-wildcards-in-paths-p t
+ "Expands entries in the 'jde-sourcepath which are wildcards patterns into a list of matching files or directories which are interpolated into the sourcepath list."
+ :group 'jde-project
+ :type 'boolean)
+
+(defun jde-expand-wildcards-and-normalize (path &optional symbol)
+ "Expand any entries with wildcard patterns in path and interpolate them into the result"
+ (if jde-expand-wildcards-in-paths-p
+ (mapcan
+ (lambda (path)
+ (let ((exp-paths (file-expand-wildcards path)))
+ (if exp-paths exp-paths (list path))))
+ (jde-normalize-paths path symbol))
+ (jde-normalize-paths path symbol)
+ ))
+
+(defmacro jde-normalize-paths (pathlist &optional symbol)
+ "Normalize all paths of the list PATHLIST and returns a list with the
+expanded paths."
+ `(mapcar (lambda (path)
+ (jde-normalize-path path ,symbol))
+ ,pathlist))
+
+
(defun jde-directory-files-recurs (dir &optional include-regexp)
"Get all the files in DIR, and any subdirectories of DIR, whose
names match INCLUDE-REGEXP."