diff options
| author | Chong Yidong | 2012-10-02 02:10:29 +0800 |
|---|---|---|
| committer | Chong Yidong | 2012-10-02 02:10:29 +0800 |
| commit | 62a81506f802e4824b718cc30321ee3a0057cdf7 (patch) | |
| tree | d681d7b767b1c3f7e4aee24ce39f6bef0d7f1f7e /lisp/cedet/srecode/java.el | |
| parent | b3317662acc0157406c20c8e14c43b7126eaa8a0 (diff) | |
| download | emacs-62a81506f802e4824b718cc30321ee3a0057cdf7.tar.gz emacs-62a81506f802e4824b718cc30321ee3a0057cdf7.zip | |
Update CEDET from upstream.
Diffstat (limited to 'lisp/cedet/srecode/java.el')
| -rw-r--r-- | lisp/cedet/srecode/java.el | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/lisp/cedet/srecode/java.el b/lisp/cedet/srecode/java.el index 58d8efc41e2..3635a39d383 100644 --- a/lisp/cedet/srecode/java.el +++ b/lisp/cedet/srecode/java.el | |||
| @@ -26,6 +26,10 @@ | |||
| 26 | ;;; Code: | 26 | ;;; Code: |
| 27 | 27 | ||
| 28 | (require 'srecode/dictionary) | 28 | (require 'srecode/dictionary) |
| 29 | (require 'semantic/tag) | ||
| 30 | |||
| 31 | (eval-when-compile | ||
| 32 | (require 'semantic/find)) | ||
| 29 | 33 | ||
| 30 | ;;;###autoload | 34 | ;;;###autoload |
| 31 | (defun srecode-semantic-handle-:java (dict) | 35 | (defun srecode-semantic-handle-:java (dict) |
| @@ -33,7 +37,7 @@ | |||
| 33 | Adds the following: | 37 | Adds the following: |
| 34 | FILENAME_AS_PACKAGE - file/dir converted into a java package name. | 38 | FILENAME_AS_PACKAGE - file/dir converted into a java package name. |
| 35 | FILENAME_AS_CLASS - file converted to a Java class name." | 39 | FILENAME_AS_CLASS - file converted to a Java class name." |
| 36 | ;; A symbol representing | 40 | ;; Symbols needed by empty files. |
| 37 | (let* ((fsym (file-name-nondirectory (buffer-file-name))) | 41 | (let* ((fsym (file-name-nondirectory (buffer-file-name))) |
| 38 | (fnox (file-name-sans-extension fsym)) | 42 | (fnox (file-name-sans-extension fsym)) |
| 39 | (dir (file-name-directory (buffer-file-name))) | 43 | (dir (file-name-directory (buffer-file-name))) |
| @@ -44,12 +48,18 @@ FILENAME_AS_CLASS - file converted to a Java class name." | |||
| 44 | (if (string-match "src/" dir) | 48 | (if (string-match "src/" dir) |
| 45 | (setq dir (substring dir (match-end 0))) | 49 | (setq dir (substring dir (match-end 0))) |
| 46 | (setq dir (file-name-nondirectory (directory-file-name dir)))) | 50 | (setq dir (file-name-nondirectory (directory-file-name dir)))) |
| 51 | (setq dir (directory-file-name dir)) | ||
| 47 | (while (string-match "/" dir) | 52 | (while (string-match "/" dir) |
| 48 | (setq dir (replace-match "_" t t dir))) | 53 | (setq dir (replace-match "." t t dir))) |
| 49 | (srecode-dictionary-set-value dict "FILENAME_AS_PACKAGE" | 54 | (srecode-dictionary-set-value dict "FILENAME_AS_PACKAGE" dir) |
| 50 | (concat dir "." fpak)) | ||
| 51 | (srecode-dictionary-set-value dict "FILENAME_AS_CLASS" fnox) | 55 | (srecode-dictionary-set-value dict "FILENAME_AS_CLASS" fnox) |
| 52 | )) | 56 | ) |
| 57 | ;; Symbols needed for most other files with stuff in them. | ||
| 58 | (let ((pkg (semantic-find-tags-by-class 'package (current-buffer)))) | ||
| 59 | (when pkg | ||
| 60 | (srecode-dictionary-set-value dict "CURRENT_PACKAGE" (semantic-tag-name (car pkg))) | ||
| 61 | )) | ||
| 62 | ) | ||
| 53 | 63 | ||
| 54 | (provide 'srecode/java) | 64 | (provide 'srecode/java) |
| 55 | 65 | ||