* org-table.el (org-table-copy-down): Don't move cursor when
getting the field.
This prevents the point from moving when inadvertently calling
S-RET outside of a table.
(org-table-make-reference): A range with only empty fields should lead
to length 0.
* testing/lisp/test-org-table.el: Adapt expected for several
ert-deftest.
The range len bugs may lead to wrong calculations for range references
with empty fields when the range len is relevant. Affects typically
Calc vmean on simple range and without format specifier EN. Also
Lisp with e. g. `length' on simple range or with L.
It is worth a small compatibility change: For a range with only empty
fields it is now possible and necessary to choose different behaviors
of vmean by adding the format specifiers E and/or N.
This is a follow-up of commit
764315b3fc.
* org-table.el (org-calc-current-TBLFM): Ensure to remove the
currently inserted TBLFM line, when calling `org-table-recalculate'
returns an error and the processing stops.
* testing/lisp/test-org-table.el: Add test.
When you hit =C-c C-c= at the line of "#+TBLFM: $2=$1*2::$2=$1**2" in
| 1 | |
| 2 | |
#+TBLFM: $2=$1*1
#+TBLFM: $2=$1*2::$2=$1**2
you got:
| 1 | |
| 2 | |
#+TBLFM: $2=$1*2::$2=$1**2
#+TBLFM: $2=$1*1
#+TBLFM: $2=$1*2::$2=$1**2
with the error message of:
user-error: Double definition `$2=' in TBLFM line, please fix by hand
In this case, you expected:
| 1 | |
| 2 | |
#+TBLFM: $2=$1*1
#+TBLFM: $2=$1*2::$2=$1**2
* org-table.el (org-calc-current-TBLFM): New function to
re-calculate the table by applying the #+TBLFM in the line
where the point is.
* org.el (org-ctrl-c-ctrl-c): Call `org-calc-current-TBLFM' when
point is in the #+TBLFM line.
* testing/lisp/test-org-table.el: Add test.
* lisp/org-table.el (org-table-eval-formula): Work-around for
calc-eval regression.
Calc-eval can no longer be called without initializing the
*Calculator* buffer first.
* org-table.el (orgtbl-to-generic): New parameter `backend' to
export cells content using a specific backend.
(orgtbl-to-latex, orgtbl-to-texinfo): Export cells to LaTeX
and Texinfo before sending the table.
Thanks to Luca Sabbatini for reporting a problem that led to this change.
* org.el (org-set-regexps-and-options): Use
`org-table-set-constants'.
* org-table.el (org-table-set-constants): New function.
(orgtbl-ctrl-c-ctrl-c): Use it.
Thanks to Oliver Večerník for reporting problems here.
* lisp/org-table.el (org-table-eval-formula): The condition-case to
check for must be "error", not "user-error".
This fixes these test failures:
4 unexpected results:
FAILED test-org-table/references/format-specifier-E
FAILED test-org-table/references/format-specifier-EL
FAILED test-org-table/references/format-specifier-L
FAILED test-org-table/references/format-specifier-none
Reported in:
http://permalink.gmane.org/gmane.emacs.orgmode/67450http://permalink.gmane.org/gmane.emacs.orgmode/67503
* org.el (org-move-subtree-down, org-forward-element)
(org-backward-element):
* org-table.el (org-table-previous-field)
(org-table-move-column, org-table-move-row):
* org-list.el (org-move-item-down, org-move-item-up)
(org-cycle-item-indentation): Use `user-error' when moving or
modifying the element at point is not possible.
* org-table.el (org-table-align): Only set the window start
when table alignment is performed in the selected window.
Thanks to Michael Brand for reporting this.
When opening an .org file from another .org file, org-mode
is initialized in the second one while the window is not yet
selected. So, functions run during org-mode's initialization
need to check if the org-mode window is the selected one before
manipulating the "current window".
* contrib/lisp/org-mime.el (org-mime-htmlize, org-mime-compose): Use
new exporter.
* lisp/ob-haskell.el (org-babel-haskell-export-to-lhs): Use new
exporter.
* lisp/ob-latex.el (org-babel-execute:latex): Use new exporter.
* lisp/ob-org.el (org-babel-execute:org): Use new exporter.
* lisp/org-agenda.el (org-agenda-menu, org-agenda-write): Use new
iCalendar export back-end.
* lisp/org-table.el (org-table-export, orgtbl-export): Remove
dependency on `org-exp' library.
(org-table-clean-before-export): New function.
(org-table-colgroup-info): New variable.
(orgtbl-to-html): Use to new HTML export back-end.
* lisp/org.el (org-modules): Remove modules relative to obsolete
export framework and add those relative to the new one.
(org-create-formula-image-with-dvipng, org-format-latex
org-create-formula-image-with-imagemagick): Use new exporter.
(org-indent-line): INCLUDE keywords are indented like regular
keywords.
(org-mode-map): Bind C-c C-e to new export dispatcher.
(org-menu): Install new exporter in menu.
* doc/org.texi (Formula syntax for Calc): Add explanation and example
for empty field.
* lisp/org-table.el (org-table-eval-formula): Use `keep-empty' in more
places.
(org-table-make-reference): Use nan (not a number) for empty fields in
Calc formulas.
* testing/lisp/test-org-table.el: Adapt expected for several
ert-deftest.
(test-org-table/empty-field): New examples dealing with empty fields.
(test-org-table/copy-field): New ert-deftest with examples dealing with
empty fields.
This makes it possible to write spreadsheet Calc formulas that check
for empty fields: To sum the first two columns unless one or both
empty:
$3 = if("$1" = "nan" || "$2" = "nan", string(""), $1 + $2); E
* lisp/org-table.el (org-table-eval-formula): Keep empty fields during
preprocessing.
(org-table-make-reference): A range with only empty fields should not
always return 0 but also empty string, consistent with field reference
of an empty field. Use future design for nan but replicate current
behavior.
* testing/lisp/test-org-table.el: Adapt expected for several
ert-deftest.
The range len bugs may lead to wrong calculations for range references
with empty fields when the range len is relevant. Affects typically
Calc vmean on simple range and without format specifier EN. Also
Lisp with e. g. `length' on simple range or with L.
* org-table.el (org-table-fedit-lisp-indent)
(orgtbl-self-insert-command): Use `org-delete-backward-char'
instead of `backward-delete-char'.
* org.el (org-delete-backward-char, org-delete-char): Save
match data.
* org.el (org-delete-backward-char, org-delete-char): Save
match data (`delete-backward-char' and `delete-char' don't.)
(org-enable-table-editor, org-insert-heading)
(org-remove-timestamp-with-keyword, org-self-insert-command):
Use `delete-backward-char' instead of `backward-delete-char'.
* org-table.el (org-table-fedit-lisp-indent)
(orgtbl-self-insert-command): Ditto.
* org-latex.el (org-export-latex-subcontent): Ditto.
* org-clock.el (org-clocktable-write-default): Ditto.
* org-ascii.el (org-export-ascii-preprocess): Ditto.
Thanks to Vegard Vesterheim for raising this issue and proposing a patch,
and to Carsten for pointing at the root of the problem.
* org-table.el (org-table-eval-formula): Handle localized
time-stamps by internally converting them to english during
formulas evaluation.
Thanks to Viktor Rosenfeld for suggesting this.
* lisp/org-table.el: added macro org-define-lookup-function and the
calls to this macro that generate the lookup functions
org-lookup-first, org-lookup-last and org-lookup-all
* doc/org.texi: documented lookup functions
* org-table.el (org-table-eval-formula): Convert time-stamps
to inactive time-stamp so that Calc can handle them correctly.
Thanks to Daniel E. Doherty for reporting this.
* org-table.el (org-table-number-regexp): Allow the user to
set it to a new regexp, which allows commas as decimal mark.
The default is to not use this setting, but the one before
commit 7ff8c1, which has ben reverted.
See the discussion here:
http://thread.gmane.org/gmane.emacs.orgmode/59389