Org-mode mailing list
 help / color / mirror / Atom feed
From: Kyle Meyer <kyle@kyleam.com>
To: ian martins <ianxm@jhu.edu>
Cc: Org-Mode mailing list <emacs-orgmode@gnu.org>
Subject: Re: [PATCH] ob-java.el: Allow for more whitespace
Date: Thu, 12 Nov 2020 22:46:32 -0500
Message-ID: <87d00h7wbr.fsf@kyleam.com> (raw)
In-Reply-To: <CAC=rjb6XwfFr-0fwsfNvLyViwUo+463XWhAj6Xdmfgtt+qDjcQ@mail.gmail.com>

ian martins writes:

> Subject: [PATCH 1/2] 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.

Sounds good.

> Subject: [PATCH 2/2] ob-java.el: Allow for more whitespace in java code
>
> * lisp/ob-java.el (defconst *-re): Updated regexps to allow for more
> whitespace in the content of java code blocks, and removed some
> redundancies.

Sorry, more change log nitpicking from me (which is even less fun to do
than other nitpicking because I dislike the practice of including change
logs in commit messages).

Please name each variable in full.  Here's the relevant bit from the
guidelines that Emacs's CONTRIBUTE points to:

    If you mention the names of the modified functions or variables,
    it’s important to name them in full.  Don’t abbreviate function or
    variable names, and don’t combine them.  Subsequent maintainers will
    often search for a function name to find all the change log entries
    that pertain to it; if you abbreviate the name, they won’t find it
    when they search.

https://www.gnu.org/prep/standards/html_node/Style-of-Change-Logs.html#Style-of-Change-Logs

We should probably link to that in worg's org-contribute.org.

> * testing/lisp/test-ob-java.el (ob-java/simple-with-main-whitespace):
> Added test case with lots of whitespace.

Is this related to Jarmo's report at
<https://orgmode.org/list/87o8k68w05.fsf@iki.fi>?  If so, it'd be good
to include a Reported-by trailer as well as a link.

> -(defconst org-babel-java--package-re "^[[:space:]]*package[[:space:]]+\\\([[:alnum:]_\.]+\\\);$"
> +(defconst org-babel-java--package-re "^[[:space:]]*package[[:space:]]+\\\([[:alnum:]_\.]+\\\)[[:space:]]*;$"
>    "Regexp for the package statement.")
> -(defconst org-babel-java--imports-re "^[[:space:]]*import[[:space:]]+\\\([[:alnum:]_\.]+\\\);$"
> +(defconst org-babel-java--imports-re "^[[:space:]]*import[[:space:]]+\\\([[:alnum:]_\.]+\\\)[[:space:]]*;$"
>    "Regexp for import statements.")
> -(defconst org-babel-java--class-re "^[[:space:]]*\\\(?:public[[:space:]]+\\\)?class[[:space:]]+\\\([[:alnum:]_]+\\\)[[:space:]]*\n?[[:space:]]*{"
> +(defconst org-babel-java--class-re "^[[:space:]]*\\\(?:public[[:space:]]+\\\)?class[[:space:]]+\\\([[:alnum:]_]+\\\)[[:space:]]*{"
>    "Regexp for the class declaration.")
> -(defconst org-babel-java--main-re "public static void main(String\\\(?:\\[]\\\)?[[:space:]]+[^ ]+\\\(?:\\[]\\\)?).*\n?[[:space:]]*{"
> +(defconst org-babel-java--main-re "public[[:space:]]+static[[:space:]]+void[[:space:]]+main[[:space:]]*([[:space:]]*String[[:space:]]*.*[[:space:]]*)[[:space:]]*.*[[:space:]]*{"
>    "Regexp for the main method declaration.")
> -(defconst org-babel-java--any-method-re "public .*(.*).*\n?[[:space:]]*{"
> +(defconst org-babel-java--any-method-re "public[[:space:]]+.*[[:space:]]*([[:space:]]*.*[[:space:]]*)[[:space:]]*.*[[:space:]]*{"
>    "Regexp for any method.")

Not speaking Java, I don't have anything actually valuable to say about
this change, but I wouldn't complain if these regular expressions were
switched over to rx (or at least tamed a bit in terms of line length).

Thanks for the fixes.


  reply	other threads:[~2020-11-13  3:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-12 10:38 ian martins
2020-11-13  3:46 ` Kyle Meyer [this message]
2020-11-14  9:40   ` ian martins
2020-11-14 18:21     ` Kyle Meyer
2020-12-14  6:11 ` 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://orgmode.org

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

  git send-email \
    --in-reply-to=87d00h7wbr.fsf@kyleam.com \
    --to=kyle@kyleam.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=ianxm@jhu.edu \
    /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

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