branch: externals-release/org commit 7de3d3cb3274f29e53bdeb9e6d0b2640614cf79a Author: Mattias EngdegÄrd <matti...@acm.org> Commit: Kyle Meyer <k...@kyleam.com>
Backport commit 2075411ed from Emacs * lisp/org-element.el (org-element-citation-key-re): * lisp/ox-org.el (org-org-identity): Remove repeated chars in alternatives. * lisp/ob-java.el (org-babel-execute:java): Remove superfluous backslash. * lisp/ob-java.el (org-babel-java--main-re) (org-babel-java--any-method-re): Remove (0+ space) expressions subsumed by adjacent expressions. Fix regexp snags in org 2075411edbad954c0fdf2aa141757d834a6708b7 Mattias EngdegÄrd Thu Sep 30 17:16:41 2021 +0200 --- lisp/ob-java.el | 44 +++++++++++++++++++++++--------------------- lisp/org-element.el | 2 +- lisp/ox-org.el | 2 +- 3 files changed, 25 insertions(+), 23 deletions(-) diff --git a/lisp/ob-java.el b/lisp/ob-java.el index 60ef33b..dd35387 100644 --- a/lisp/ob-java.el +++ b/lisp/ob-java.el @@ -96,27 +96,29 @@ like javac -verbose." (group (1+ (in alnum ?_))) ; capture the class name (0+ space) ?{) "Regexp for the class declaration.") -(defconst org-babel-java--main-re (rx line-start (0+ space) "public" - (1+ space) "static" - (1+ space) "void" - (1+ space) "main" - (0+ space) ?\( - (0+ space) "String" - (0+ space) (1+ (in alnum ?_ ?\[ ?\] space)) ; "[] args" or "args[]" - (0+ space) ?\) - (0+ space) (opt "throws" (1+ (in alnum ?_ ?, ?. space))) - ?{) +(defconst org-babel-java--main-re + (rx line-start (0+ space) "public" + (1+ space) "static" + (1+ space) "void" + (1+ space) "main" + (0+ space) ?\( + (0+ space) "String" + (1+ (in alnum ?_ ?\[ ?\] space)) ; "[] args" or "args[]" + ?\) + (0+ space) (opt "throws" (1+ (in alnum ?_ ?, ?. space))) + ?{) "Regexp for the main method declaration.") -(defconst org-babel-java--any-method-re (rx line-start - (0+ space) (opt (seq (1+ alnum) (1+ space))) ; visibility - (opt (seq "static" (1+ space))) ; binding - (1+ (in alnum ?_ ?\[ ?\])) ; return type - (1+ space) (1+ (in alnum ?_)) ; method name - (0+ space) ?\( - (0+ space) (0+ (in alnum ?_ ?\[ ?\] ?, space)) ; params - (0+ space) ?\) - (0+ space) (opt "throws" (1+ (in alnum ?_ ?, ?. space))) - ?{) +(defconst org-babel-java--any-method-re + (rx line-start + (0+ space) (opt (seq (1+ alnum) (1+ space))) ; visibility + (opt (seq "static" (1+ space))) ; binding + (1+ (in alnum ?_ ?\[ ?\])) ; return type + (1+ space) (1+ (in alnum ?_)) ; method name + (0+ space) ?\( + (0+ (in alnum ?_ ?\[ ?\] ?, space)) ; params + ?\) + (0+ space) (opt "throws" (1+ (in alnum ?_ ?, ?. space))) + ?{) "Regexp for any method.") (defconst org-babel-java--result-wrapper "\n public static String __toString(Object val) { if (val instanceof String) { @@ -192,7 +194,7 @@ replaced in this string.") ;; the dir to write the source file (packagedir (if (and (not run-from-temp) packagename) (file-name-as-directory - (concat basedir (replace-regexp-in-string "\\\." "/" packagename))) + (concat basedir (replace-regexp-in-string "\\." "/" packagename))) basedir)) ;; the filename of the source file (src-file (concat packagedir classname ".java")) diff --git a/lisp/org-element.el b/lisp/org-element.el index ed684df..f8334cc 100644 --- a/lisp/org-element.el +++ b/lisp/org-element.el @@ -118,7 +118,7 @@ ;; to current setup. (defconst org-element-citation-key-re - (rx "@" (group (one-or-more (any word "-.:?!`'/*@+|(){}<>&_^$#%&~")))) + (rx "@" (group (one-or-more (any word "-.:?!`'/*@+|(){}<>&_^$#%~")))) "Regexp matching a citation key. Key is located in match group 1.") diff --git a/lisp/ox-org.el b/lisp/ox-org.el index 11d9c09..fcf8768 100644 --- a/lisp/ox-org.el +++ b/lisp/ox-org.el @@ -141,7 +141,7 @@ CONTENTS and INFO are ignored." CONTENTS is its contents, as a string or nil. INFO is ignored." (let ((case-fold-search t)) (replace-regexp-in-string - "^[ \t]*#\\+attr_[-_a-za-z0-9]+:\\(?: .*\\)?\n" "" + "^[ \t]*#\\+attr_[-_a-z0-9]+:\\(?: .*\\)?\n" "" (org-export-expand blob contents t)))) (defun org-org-headline (headline contents info)