Commit | Line | Data |
---|---|---|
4d902e6f CY |
1 | ;;; srecode-java.el --- Srecode Java support |
2 | ||
114f9c96 | 3 | ;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. |
4d902e6f CY |
4 | |
5 | ;; Author: Eric M. Ludlam <eric@siege-engine.com> | |
6 | ||
7 | ;; This file is part of GNU Emacs. | |
8 | ||
9 | ;; GNU Emacs is free software: you can redistribute it and/or modify | |
10 | ;; it under the terms of the GNU General Public License as published by | |
11 | ;; the Free Software Foundation, either version 3 of the License, or | |
12 | ;; (at your option) any later version. | |
13 | ||
14 | ;; GNU Emacs is distributed in the hope that it will be useful, | |
15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | ;; GNU General Public License for more details. | |
18 | ||
19 | ;; You should have received a copy of the GNU General Public License | |
20 | ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | |
21 | ||
22 | ;;; Commentary: | |
23 | ;; | |
24 | ;; Special support for the Java language. | |
25 | ||
26 | ;;; Code: | |
27 | ||
28 | (require 'srecode/dictionary) | |
29 | ||
30 | ;;;###autoload | |
31 | (defun srecode-semantic-handle-:java (dict) | |
32 | "Add macros into the dictionary DICT based on the current java file. | |
33 | Adds the following: | |
34 | FILENAME_AS_PACKAGE - file/dir converted into a java package name. | |
35 | FILENAME_AS_CLASS - file converted to a Java class name." | |
36 | ;; A symbol representing | |
37 | (let* ((fsym (file-name-nondirectory (buffer-file-name))) | |
38 | (fnox (file-name-sans-extension fsym)) | |
39 | (dir (file-name-directory (buffer-file-name))) | |
40 | (fpak fsym) | |
41 | ) | |
42 | (while (string-match "\\.\\| " fpak) | |
43 | (setq fpak (replace-match "_" t t fpak))) | |
44 | (if (string-match "src/" dir) | |
45 | (setq dir (substring dir (match-end 0))) | |
46 | (setq dir (file-name-nondirectory (directory-file-name dir)))) | |
47 | (while (string-match "/" dir) | |
48 | (setq dir (replace-match "_" t t dir))) | |
49 | (srecode-dictionary-set-value dict "FILENAME_AS_PACKAGE" | |
50 | (concat dir "." fpak)) | |
51 | (srecode-dictionary-set-value dict "FILENAME_AS_CLASS" fnox) | |
52 | )) | |
53 | ||
54 | (provide 'srecode/java) | |
55 | ||
56 | ;; Local variables: | |
57 | ;; generated-autoload-file: "loaddefs.el" | |
4d902e6f CY |
58 | ;; generated-autoload-load-name: "srecode/java" |
59 | ;; End: | |
60 | ||
3999968a | 61 | ;; arch-tag: d796b86c-3a0e-457c-a346-9f1ccfdc5e2c |
4d902e6f | 62 | ;;; srecode/java.el ends here |