* lisp/ob-core.el (org-babel-temp-directory): Fix return value for
remote directory.
(org-babel-temp-file): Simplify using `org-babel-temp-directory'. Fix
incorrect file location when PREFIX is "".
(org-babel-temp-stable-directory): New macro returning suitable
temporary stable directory.
(org-babel-temp-stable-file): Simplify using
`org-babel-temp-stable-directory'. Fix incorrect file location when
PREFIX is "".
* lisp/ob-java.el (org-babel-execute:java): Use
`org-babel-temp-directory'.
Reported-by: Ferdinand Pieper <fer@pie.tf>
Link: https://orgmode.org/list/87r0yz7u9q.fsf_-_@pie.tf
* lisp/ob-java.el (org-babel-header-args:java): Complete the list of
header arguments supported for Java source blocks.
* testing/lisp/test-ob-java.el (ob-java/lint-header-arguments): Test
that the linter approves of all the supported arguments.
* lisp/ob-core.el (org-babel-temp-directory): New macro, returning
suitable temporary directory. The macro considers remote
`default-directory' and nil values of
`org-babel-temporary-directory'.
* lisp/ob-gnuplot.el (org-babel-gnuplot-process-vars):
* lisp/ob-java.el (org-babel-execute:java):
* lisp/ob-processing.el (org-babel-processing-view-sketch): Use the
new macro.
Reported-by: Christian Köstlin <christian.koestlin@gmail.com>
Emacs now advises using "website" (instead of "homepage") and
consequently to use the "URL" comment header instead of "Homepage".
* README:
* README_ELPA:
* doc/org-guide.org (Creating Footnotes):
* doc/org-manual.org (Creating Footnotes):
* etc/styles/README (URL): Prefer "website" to "homepage".
* lisp/*.el:
* mk/org-fixup.el: Replace the "Homepage" header comment with "URL".
* lisp/ob-java.el (org-babel-execute:java): Restore inspection of
:dir's value to decide whether to run from temporary directory.
My compatibility fix in the previous commit incorrectly changed the
documented and intended behavior for (:dir . nil).
Reported-by: Ian Martins <ianxm@jhu.edu>
lisp/ob-java.el: Allow source block headers to override the java
compiler or runtime commands.
Currently the java compiler and runtime commands are customizable, but
cannot be overridden locally in source block hearders. ob-python
allows overriding the runtime command and I've found it to be useful.
This does the same for ob-java.
* lisp/ob-java.el(org-babel-execute:java): Previously the source file
was always written to the local machine so execution on the remote
machine was not possible. Now we write the source file to the remote
temp directory when the current directory is remote.
* lisp/ob-java.el(org-babel-default-header-args:java): Add :dir
default.
(org-babel-execute:java): Check for existence of :dir in params using
alist-get instead of assq because we want a nil cdr to be false.
* testing/lisp/test-ob-java.el
(ob-java/simple, ob-java/simple-with-bracket)
(ob-java/simple-with-quote, ob-java/simple-return-int)
(ob-java/simple-return-float, ob-java/simple-return-string)
(ob-java/simple-with-main, ob-java/simple-with-two-methods)
(ob-java/simple-with-no-main, ob-java/simple-with-main-args-array)
(ob-java/simple-with-main-whitespace, ob-java/simple-with-class)
(ob-java/simple-with-non-public-class)
(ob-java/simple-with-class-and-package)
(ob-java/simple-with-class-attr)
(ob-java/simple-with-class-attr-with-package, ob-java/one-arg)
(ob-java/args-quoted-string, ob-java/integer-var)
(ob-java/var-with-main, ob-java/var-with-class)
(ob-java/var-with-class-and-package)
(ob-java/var-with-class-and-hanging-curlies, ob-java/two-vars)
(ob-java/string-var, ob-java/multiline-string-var)
(ob-java/return-vector-using-list, ob-java/return-vector-using-array)
(ob-java/read-return-list, ob-java/read-list-return-array)
(ob-java/read-return-list-with-package)
(ob-java/output-list-with-spaces, ob-java/list-var, ob-java/vector-var)
(ob-java/matrix-var, ob-java/matrix-var-with-header)
(ob-java/output-table-with-header, ob-java/inhomogeneous_table)
(ob-java/import_library, ob-java/import_library_inline)
(ob-java/tangle): Set :dir to nil to prevent tests from writing files
outside of temporary directory.
(ob-java/tangle-with-package, ob-java/simple-dir):
(ob-java/simple-dir-with-package): Move :dir param to be consistent
with other tests.
Most languages write tempfiles to babel's temporary directory, but
ob-java originally had to write them to the current directory instead.
I suspect this is because java puts the source file in package
directories, and babel doesn't expect subdirectories in the babel
temporary directory. This change brings back the original behavior.
Reported-by: Jarmo Hurri <jarmo.hurri@iki.fi>
Ref: https://orgmode.org/list/87mtzk9n30.fsf@iki.fi
* lisp/ob-java.el (org-babel-java--package-re)
(org-babel-java--imports-re, org-babel-java--class-re)
(org-babel-java--main-re, org-babel-java--any-method-re):
Updated regexps to allow for more whitespace in the content of java
code blocks. Convert regexps to `rx' to improve clarity.
* testing/lisp/test-ob-java.el (ob-java/simple-with-main-whitespace):
Added test case with excessive whitespace.
Reported-by: Jarmo Hurri <jarmo.hurri@iki.fi>
Ref: https://orgmode.org/list/87o8k68w05.fsf@iki.fi
* 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.
* lisp/ob-java.el (org-babel-default-header-args:java): Change the
default to scripting mode.
* testing/lisp/test-ob-java.el: Modify the first test to use the
default for `:results' and all others to specify it.
A recent commit added functional mode and made it default, but this
would break java source blocks for anyone that relied on the old
default. This sets the default back to scripting mode.
* lisp/ob-java.el: Use customizable variables for java compiler and
runtime commands. Move variable declarations to fix byte-compile
warnings. Change Author. Change tabs to spaces.
A recent patch replaced `defcustom' with `defvar' for variables that
point to the java compiler and runtime commands, which would break
functionality for anyone who had customized the variable. This
reverts that change.
ob-java is using features not available on older versions of emacs
which org supports. This replaces them with alternatives.
* lisp/ob-java.el: Add support for variables and return values. Write
tempfiles to the `org-babel-temporary-directory'. Make package,
class, and main method definitions optional.
* testing/lisp/test-ob-java.el: Add tests.
ob-java was missing features common to many other org-babel
implementations, such as the ability to accept variables and return a
value. This brings those features to ob-java, making the experience
more consistent across org-babel languages, and expanding the ways
java source blocks interact with org mode buffers.
A simple java program requires boilerplate code to declare a class and
main method. This boilerplate code makes java source blocks more
tedious to write and more effort to read. This is more evident in an
org buffer where there may be many small source blocks. This change
makes that code optional. If it is not provided, the source block
will be wrapped in the boilerplate code just before compilation.
Most org babel implementation write temporary files to the
`org-babel-temporary-directory'. That avoids polluting the current
directory and provides built-in support for tramp. ob-java would
write source files and binaries to the directory containing the org
file by default. This may be unexpected and unwanted, and didn't work
with tramp. This change writes all tempfiles to the
`org-babel-temporary-directory'.
Executing an ob-java source block would always try to compile and run
the code in the source block, so a source block that wasn't
runnable (didn't contain a main method) would error during run. This
change adds a generic main method just before compilation if one isn't
included in the source block so that the run will succeed.
There were no tests for ob-java. This adds tests.
Add changes from Emacs repo that should have been backported with
bb77dd2.
Update copyright year to 2015
7e09ef09a479731d01b1ca46e94ddadd73ac98e3
Paul Eggert
Thu Jan 1 14:26:41 2015 -0800