aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/cedet/srecode/java.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/cedet/srecode/java.el')
-rw-r--r--lisp/cedet/srecode/java.el21
1 files changed, 18 insertions, 3 deletions
diff --git a/lisp/cedet/srecode/java.el b/lisp/cedet/srecode/java.el
index db4d2deee28..29a8465c45c 100644
--- a/lisp/cedet/srecode/java.el
+++ b/lisp/cedet/srecode/java.el
@@ -42,9 +42,24 @@ FILENAME_AS_CLASS - file converted to a Java class name."
42 ) 42 )
43 (while (string-match "\\.\\| " fpak) 43 (while (string-match "\\.\\| " fpak)
44 (setq fpak (replace-match "_" t t fpak))) 44 (setq fpak (replace-match "_" t t fpak)))
45 (if (string-match "src/" dir) 45 ;; We can extract package from:
46 (setq dir (substring dir (match-end 0))) 46 ;; 1) a java EDE project source paths,
47 (setq dir (file-name-nondirectory (directory-file-name dir)))) 47 (cond ((ede-current-project)
48 (let* ((proj (ede-current-project))
49 (pths (ede-source-paths proj 'java-mode))
50 (pth)
51 (res))
52 (while (and (not res)
53 (setq pth (expand-file-name (car pths))))
54 (when (string-match pth dir)
55 (setq res (substring dir (match-end 0))))
56 (setq pths (cdr pths)))
57 (setq dir res)))
58 ;; 2) a simple heuristic
59 ((string-match "src/" dir)
60 (setq dir (substring dir (match-end 0))))
61 ;; 3) outer directory as a fallback
62 (t (setq dir (file-name-nondirectory (directory-file-name dir)))))
48 (setq dir (directory-file-name dir)) 63 (setq dir (directory-file-name dir))
49 (while (string-match "/" dir) 64 (while (string-match "/" dir)
50 (setq dir (replace-match "." t t dir))) 65 (setq dir (replace-match "." t t dir)))