emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: John Herrlin <jherrlin@gmail.com>
To: org-mode-email <emacs-orgmode@gnu.org>
Subject: [PATCH] ob-java: Allow import to end with asterisk
Date: Tue, 26 Jan 2021 08:53:38 +0100	[thread overview]
Message-ID: <87sg6o6sn2.fsf@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 225 bytes --]


Hey,

I found this case:

#+BEGIN_SRC java
  import static java.lang.System.*;

  out.println("Hejsan");
#+END_SRC

And it seems to me that the import regex dont see the asterisk.

I attached a possible patch.

Stay safe!



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ob-java-Allow-import-to-end-with-asterisk.patch --]
[-- Type: text/x-patch, Size: 1082 bytes --]

From a9c37a8a56fd1f91f4a2789b0d7d983fec9a2c1f Mon Sep 17 00:00:00 2001
From: John Herrlin <jherrlin@gmail.com>
Date: Tue, 26 Jan 2021 08:19:19 +0100
Subject: [PATCH] ob-java: Allow import to end with asterisk

* lisp/ob-java.el (org-babel-java--imports-re): Allow import to end
with asterisk.

TINYCHANGE
---
 lisp/ob-java.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/ob-java.el b/lisp/ob-java.el
index 07ff8e9ab..b205eacd6 100644
--- a/lisp/ob-java.el
+++ b/lisp/ob-java.el
@@ -88,7 +88,7 @@ like javac -verbose."
   "Regexp for the package statement.")
 (defconst org-babel-java--imports-re (rx line-start (0+ space) "import"
                                          (opt (1+ space) "static")
-					 (1+ space) (group (1+ (in alnum ?_ ?.))) ; capture the fully qualified class name
+					 (1+ space) (group (1+ (in alnum ?_ ?. ?*))) ; capture the fully qualified class name
 					 (0+ space) ?\; line-end)
   "Regexp for import statements.")
 (defconst org-babel-java--class-re (rx line-start (0+ space) (opt (seq "public" (1+ space)))
-- 
2.30.0


             reply	other threads:[~2021-01-26  7:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-26  7:53 John Herrlin [this message]
2021-01-27  3:21 ` [PATCH] ob-java: Allow import to end with asterisk ian martins
2021-01-27  7:24   ` John Herrlin
2021-01-28 20:03   ` John Herrlin
2021-01-30 10:50     ` ian martins
2021-04-25  3:43       ` Timothy
2021-04-25 10:40         ` ian martins
2021-04-26  6:52           ` Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sg6o6sn2.fsf@gmail.com \
    --to=jherrlin@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).