Org-mode mailing list
 help / color / mirror / Atom feed
* [PATCH] ob-java: Allow import to end with asterisk
@ 2021-01-26  7:53 John Herrlin
  2021-01-27  3:21 ` ian martins
  0 siblings, 1 reply; 5+ messages in thread
From: John Herrlin @ 2021-01-26  7:53 UTC (permalink / raw)
  To: org-mode-email

[-- 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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-01-30 10:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-26  7:53 [PATCH] ob-java: Allow import to end with asterisk John Herrlin
2021-01-27  3:21 ` ian martins
2021-01-27  7:24   ` John Herrlin
2021-01-28 20:03   ` John Herrlin
2021-01-30 10:50     ` ian martins

Org-mode mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://orgmode.org/list/0 list/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 list list/ https://orgmode.org/list \
		emacs-orgmode@gnu.org
	public-inbox-index list

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.emacs.orgmode
	nntp://news.gmane.io/gmane.emacs.orgmode


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git