* lisp/org-plot.el (org-plot/gnuplot): When called with point at the
start of the #+plot: line, the behaviour of `org-table-begin' (called in
`org-table-to-lisp') caused no table to be detected. To work around
this, when the point is at the zeroth column, it is temporarily shifted
one character to the right.
* lisp/org-plot.el (org-plot/gnuplot): `ignore-error' was introduced
in Emacs 27, and Org's minimum supported Emacs is 24. So, to maintain
compliance I replaced the `ignore-error' call with a `condition-case`.
* lisp/org-plot.el (org-plot/gnuplot): Expanding the `save-excursion'
block to include `org-plot/goto-nearest-table` prevents the current
point from being moved, and doesn't affect the rest of the function.
* lisp/org-plot.el (org-plot/gnuplot-script): The gnuplot process this
generated content is sent to may be operating in a different directory,
and hence this may write to a different file than intended. By
expanding the file name first, this is no longer a concern.
* lisp/org-plot.el (org-plot/gnuplot): When
`gnuplot-send-buffer-to-gnuplot` is called, it may emit the error
"kill-region: Text is read-only: #<buffer *gnuplot*>" when the plot
operation has been successful. This prevents `org-plot/gnuplot` from
executing the rest of the function, which is undesirable.
It's preferable just to ignore this error.
* lisp/org-plot.el (org-plot/redisplay-img-in-buffer): New function
which searches the current Org buffer for overlays of a certain image,
and refreshes those overlays.
(org-plot/gnuplot): Use `org-plot/redisplay-img-in-buffer' after
plotting to redisplay any associated inline images.
* lisp/ob-latex.el (org-babel-latex-begin-env):
(org-babel-latex-pdf-svg-process): Shorten docstring to under 80
characters.
* lisp/org-plot.el (org-plot/preset-plot-types): Fill long lines and
add two spaces after periods.
With Emacs 28.0.50 the byte-compiler now warns about docstrings that
are too wide. The recent ports from the Emacs repo covered all of the
cases that have already made their way to the Emacs tree.
* lisp/org-plot.el (org--plot/values-stats): Replace `log10' with
`log'.
(org--plot/nice-frequency-pick): Replace obsolete `case' with `cl-case`.
(org--plot/radar): Replace `s-join' with `mapconcat', removing the
implicit dependency on s.el.
(org-plot/gnuplot-script): Remove unused let bindings.
(org-plot/gnuplot-script): Replace free variable reference with
expression only using given variables.
* lisp/org-plot.el (org--plot/values-stats): A set of numbers with the
same value (i.e. 0 range) should not produce an arithmetic overflow
error.
This error was caused by taking the log of 0 (when the range is
0). This is mitigated by explicit checking against this case.
* lisp/org-plot.el (org-plot/preset-plot-types): Adapt structure to
cover all type-specific logic within org-plot.
(org-plot/gnuplot-script, org-plot/gnuplot): Replace type-specific logic
with references to properties of the type from
`org-plot/preset-plot-types'.
* lisp/org-plot.el (org-plot/gnuplot): If statement in transposition
treated condition as its negative, to fix this the condition was
inverted.
It was also noticed that the code could not operate as expected as the
user-supplied #+plot options were not fetched. Resolved by re-inserting
relevant code from an older version of org-plot.
* lisp/org-plot.el (org--plot/radar): Implement a new plot type "radar".
(org--plot/radar-template): A huge template sting for `org-plot/radar'.
(org--plot/radar-ticks, org--plot/radar-setup-template): Smaller
template strings for use in `org-plot/radar'.
(org-plot/preset-plot-types): Add the new "radar" type to the list of
default types.
The radar type has a long and complex implementation, but that's exactly
what makes it perfect for something like this. A complex plot can be
produced with a simple keyword in the #+PLOT options. There are still a
few kinks that would benefit from being ironed out, but the current
state is fully-functional.
* lisp/org-plot.el (org-plot/gnuplot-script): Call the term and preamble
functions (mentioned below) with the plot type as the argument.
(org-plot/gnuplot-script-preamble, org-plot/gnuplot-term-extra): update
docstring.
* lisp/org-plot.el (org-plot/gnuplot-term-extra): New option to let
the user to tweak the gnuplot term settings. This allows for setting
characteristics such as default size, or background colour.
(org-plot/gnuplot-script): Use the new option for customisation of
org-plot's term.
* lisp/org-plot.el (org-plot/add-options-to-plist): Add the options :ymin
:ymax :xmin :xmax, as well as :min and :max as aliases to the y{min,max}
options. The :ticks option is also added, for specifying how many ticks
should be used.
(org--plot/values-stats, org--plot/sensible-tick-num,
org--plot/nice-frequency-pick, org--plot/merge-alists,
org--plot/item-frequencies, org--plot/prime-factors): New utility
functions added to allow for somewhat sensible determination of a :ticks
value when none is provided. This turns out to be harder than expected,
and so a number of functions are used to attempt to do so. The essence
of the method used, is to round values and find their prime
decompositions. From this we try to select the most common components
to give a reasonable step size. We also add a 'ticks' parameter for
manually setting the number of ticks, and (y)min/max parameters
similarly.
* lisp/org-plot.el (org-plot/preset-plot-types): New option to declare
plot types and provide a lambda which is called with a fixed signature
to generate associated gnuplot code. The previously hardcoded types
are implemented as the default value.
(org-plot/gnuplot-script): Abstract the generation of gnuplot commands
from the three hardcoded types: 2d, 3d, and grid.
* lisp/org-plot.el (org-plot/gnuplot-script-preamble): New option
which can be either a string or a function. The value of this (when
executed, in the case of the function) is inserted near the top of the
generated gnuplot script.
(org-plot/gnuplot-script): Use the new variable
`org-plot/gnuplot-script-preamble' in the manner described.
This allows for the user to set the font/colour-scheme, default
precision, and much more.
* lisp/org-plot.el (org-plot/add-options-to-plist,
org-plot/add-options-to-plist): Add a new option :transpose, and a
shorter alias :trans. Transposition is performed if the argument is yes,
y, or t. This treats the table as a matrix and performs matrix
transposition on it. If an hline is present, it is assumed that it is a
marks a separation from a first header row. The first row is then
treated as the new header by inserting a hline in the transposed data.
This is quite useful for some plots, where across multiple categories,
there are a large number of data points. Without this, the data points
would be columns and the table can spread irritatingly wide.
* lisp/org-plot.el (org-plot/gnuplot): Make indentation consistent, by
replacing a few spaces with tabs.
Only 6 of 347 lines used spaces instead of tabs.
* lisp/org-table.el (org-table-collapse-header): New function.
* lisp/org-plot.el (org-plot/gnuplot): Use org-table-collapse-header
and trust there will be no more leading `hline' symbols in lisp table.
* testing/lisp/test-org-table.el (test-org-table/to-lisp):
Adding tests to already existing to-lisp function.
(test-org-table/collapse-header): Adding tests to new
collapse-header function.
* testing/lisp/test-ox.el (test-org-export/has-header-p): Testing
exporting table with multi-line header.
These changes are the combination of the commits below (in order
applied). Unlike other backports, these are applied in one commit
because they are closely related and because some of the later commits
reverse changes in earlier commits. Changes to message and help quote
display for Emacs 25 seem to be here to stay. The quote protections are
required to ensure grave accents and apostrophes are displayed as
intended in Emacs 25, and they should not affect earlier versions.
Quoting fixes in lisp/org
6cd2629bd1b3ce77d29ac28e29237c94a4197116
Paul Eggert
Mon Aug 31 00:29:40 2015 -0700
More-conservative ‘format’ quote restyling
fbb5531fa11d13854b274d28ccd329c9b6652cfc
Paul Eggert
Sun Aug 23 22:39:06 2015 -0700
Prefer directed to neutral quotes
875a5d0ead827d3da32ecbd30e739a29f07bbc87
Paul Eggert
Mon Aug 24 23:57:25 2015 -0700
Escape ` and ' in doc
19532d147b431a4fe34f088d6de07891c48e2c5c
Paul Eggert
Tue Sep 1 18:23:21 2015 -0700
Fix some more docstring etc. quoting problems
26bd978d87dfbf9baa115cd961a67d42b416c4bf
Paul Eggert
Thu Sep 3 15:32:54 2015 -0700
Go back to grave quoting in source-code docstrings etc.
6afef3f6ca2f3009c722b84e249903b7f807b044
Paul Eggert
Mon Sep 7 16:09:27 2015 -0700