0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-09-29 21:37:50 +00:00

ob-java.el: Do not wrap a main method in a main method

* lisp/ob-java.el (org-babel-expand-body:java): The code was checking
for existence of a class declaration before wrapping the content of
the code block in a main method, but it should be checking for
existence of a main method.
This commit is contained in:
Ian Martins 2020-11-12 05:09:11 -05:00
parent ff8683aa35
commit c38fda993d

View file

@ -296,7 +296,7 @@ is simplest to expand the code block from the inside out."
;; wrap main. If there are methods defined, but no main method
;; and no class, wrap everything in a generic main method.
(goto-char (point-min))
(when (and (not (re-search-forward org-babel-java--class-re nil t))
(when (and (not (re-search-forward org-babel-java--main-re nil t))
(not (re-search-forward org-babel-java--any-method-re nil t)))
(org-babel-java--move-past org-babel-java--package-re) ; if package is defined, move past it
(org-babel-java--move-past org-babel-java--imports-re) ; if imports are defined, move past them