* ob-table.el (org-sbe): Add an explicit case for handling list
arguments. This avoids doing the wrong thing (%s-formatting a list,
thus losing syntax like double-quotes). This enables passing org-table
ranges through org-sbe in a simple and correct manner.
* test-ob-table.el: Add test.
* ob-table.el (org-sbe): org-sbe did the wrong thing when given a
reference to a cell containing quotes or backslashes, because it would
simply wrap any $-prefixed value in quotes, without any escaping. Fix
this by using "%S" (instead of "\"%s\"").
* test-ob-table.el: Add test.
* lisp/ox.el (org-export--prepare-file-contents): Activate Org mode in
temporary buffer so all regexps are set. Also, be more strict when
updating links, i.e., do not bother if both includer and includee
belong to the same directory, or if there's no includer at all.
Eventually, only update links within lines specifications, if any.
* testing/lisp/test-ox.el (test-org/expand-include/links): Add tests.
Reported-by: Kaushal Modi <kaushal.modi@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2018-03/msg00394.html>
* lisp/org.el (org-set-tags-to): Do not throw an error on empty
headlines.
* testing/lisp/test-org.el (test-org/set-tags): Move test.
(test-org/set-tags-to): New test.
Reported-by: Adrian Bradd <a.bradd@columbia.edu>
<http://lists.gnu.org/r/emacs-orgmode/2018-03/msg00210.html>
* lisp/org.el (org-heading-delete-metadata): Move to...
* lisp/org-list.el (org-list--delete-metadata): ... here. Refactor
code.
(org-toggle-item): Use new function.
* testing/lisp/test-org-list.el (test-org-list/toggle-item): Add test.
At the moment, this function is only used internally in "org-list.el",
so it belongs there.
Also refrain from removing log or clock drawers, because they may not
contain all clocks or notes anyway. Besides, the information they
contain may still make sense in a plain list.
* org-table.el (org-table-sort-lines): Fix case sensitive sorting,
improve docstring.
* test-org-table.el (test-org-table/sort-lines): Enforce C locale when
testing alphabetic sorting.
‘sort-subr’ ignores ‘sort-fold-case’ when a predicate is provided. To
correctly handle case-sensitivity, we now bake it into the predicate.
Since we are now sorting according to the user’s locale, WITH-CASE
will not make a difference in most instances, since most locales
always sort case-insensitively (cf. how GNU sort ignores the ‘-f’
switch). We now mention this in the function docstring.
In order to meaningfully test case-sensitive sorting, we now enforce
the C locale in the respective unit test.
* test-org-table.el (test-org-table/sort-lines): Fix and improve
testcase.
Sorting and reversing «a C b» should result in «C b a», not in «b a
C». This test did not fail previously only because
org-table-sort-lines had an issue whereby sorts were always
case-sensitive.
* lisp/org.el (org-paste-subtree): Never split a section. Instead
always insert tree before the headline after point. Use `org-yank'
to split the section.
* testing/lisp/test-org.el (test-org/paste-subtree): New test.
* lisp/org-table.el (org-table--shrunk-field): Fix function when on
a hline.
* testing/lisp/test-org-table.el (test-org-table/shrunk-columns): Add
tests.
Reported-by: Kaushal Modi <kaushal.modi@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2018-02/msg00231.html>
* org.el (org-sort-entries): Use collated sorting.
(org-tags-sort-function): Use collated sorting.
(org-string-collate-greaterp): Add helper-function to use as defcustom
option, since there is no ‘string-collate-greaterp’ in Emacs.
* org-compat.el (org-string-collate-lessp): Add proxy to fall-back on
string-lessp when string-collate-lessp is missing (Emacs ≤ 24).
* test-org.el (test-org/string-collate-lessp): Add test.
(test-org/sort-entries): Add regression test for non-ASCII inputs.
‘org-sort-entries’ and ‘org-tags-sort-function’ advertise alphabetic
sorting, but actually sort based only on character code. This
produces non-alphabetic orderings of strings in non-ASCII locales.
E. g., German Umlauts “Ä Ü Ö” are alphabetically sorted as if they
were “A U O”, whereas sorting based on character-code will place them
after “Z”, which is unexpected.
* testing/lisp/test-ob.el (test-ob/org-babel-remove-result--results-list):
Removed the inner list. Expectation "- (quote (4 5))" did not match
the result "- '(4 5)". I think this difference is not worth testing
in this test.
* lisp/org-table.el (org-table-with-shrunk-field): New macro.
(org-table-get-field):
(org-table-toggle-column-width): Use new macro.
(org-table--shrunk-field): Update function.
(org-table--shrink-field): When there is a width cookie, leave first
characters editable.
* lisp/org.el (org-self-insert-command):
(org-delete-backward-char):
(org-delete-char): Small refactoring. Handle shrink overlays.
* testing/lisp/test-org-table.el (test-org-table/toggle-column-width):
Update tests.
* lisp/org-table.el (org-table-current-column): Return a meaningful
value also on hlines.
(org-table-toggle-column-width): Use `org-table-current-column'
instead of re-inventing wheel.
* testing/lisp/test-org-table.el (test-org-table/current-column): New
test.
* lisp/org.el (org-timestamp-to-time): New function.
(org-timestamp--to-internal-time): Remove function.
(org-timestamp-format): Use new function.
* testing/lisp/test-org.el (test-org/timestamp-to-time): New test.
* lisp/org-table.el (org-table-recalculate): Return an error when the
formula cannot create a necessary column.
(org-table-formula-create-columns): Fix docstring.
* testing/lisp/test-org-table.el (test-org-table/field-formula-outside-table):
Fix tests.
* lisp/ob-core.el (org-babel-expand-noweb-references): Get :noweb-ref
from definition instead of point of call.
* testing/lisp/test-ob.el (test-ob/noweb-expansion-1):
(test-ob/noweb-expansion-2): Merge tests. Add test.
* lisp/ob-python.el (orb-babel-python-evaluate-session): When :session
:results output, send multiline code blocks to tmpfile and execute in
Python with exec().
(org-babel-python--exec-tmpfile): New variable.
* testing/lisp/test-ob-python.el (test-ob-python/session-multiline):
Test for :session with multiple lines and indentation.
* lisp/org.el (org-return): Split the table before first column or
after last one.
* lisp/org-table.el (org-table-next-row): Remove code handling split.
* testing/lisp/test-org.el (test-org/return): Add test.
* lisp/ox-publish.el (org-publish-file-relative-name): New function.
* lisp/ox-html.el (org-html-link): Use new function.
* testing/lisp/test-ox-publish.el (test-org-publish/file-relative-name):
New test.
* lisp/ox.el (org-export-collect-headlines):
(org-export-excluded-from-toc-p): Allow to number headlines in the
middle of an otherwise unnumbered tree.
* testing/lisp/test-ox.el (test-org-export/collect-headlines):
(test-org-export/excluded-from-toc-p):
(test-org-export/toc-entry-backend): Update tests. Add more tests.
Reported-by: Akater <nuclearspace@gmail.com>
<http://lists.gnu.org/archive/html/emacs-orgmode/2017-11/msg00219.html>
* lisp/ox.el (org-export-numbered-headline-p): Use a less opinionated
definition of inheritance.
* testing/lisp/test-ox.el (test-org-export/numbered-headline-p):
Update test.
* doc/org.texi (Export settings): Insist on UNNUMBERED inheritance.
It is now possible to number a headline within an unnumbered tree.
* lisp/org-table.el (org-table-insert-column): Insert new column to
the right instead of the left.
* testing/lisp/test-org-table.el (test-org-table/insert-column): New
test.
* lisp/org-table.el (org-table-recalculate): Clean `:org-untouchable'
property once we no longer need it.
* testing/lisp/test-org-table.el (test-org-table/formula-priority):
New test.
Reported-by: Ruy Exel <ruyexel@gmail.com>
<http://lists.gnu.org/archive/html/emacs-orgmode/2017-11/msg00159.html>
* lisp/org-attach.el (org-attach-dired-to-subtree): Renamed from
`org-attach-dired-attach-to-next-best-subtree'. Convenience
functions have been dropped.
* testing/lisp/test-org-attach.el: Tests use
`org-test-with-temp-text-in-file' now and are cleaner now.
* lisp/org-attach.el (org-attach-attach-files): New.
(org-attach-dired-marked-files-in-dired): New
(org-attach-dired-marked-files-or-file-at-cursor-in-dired): New.
(org-attach-dired-attach-to-next-best-subtree): New command.
(org-attach-dired-attach-to-next-best-subtree-cp): New command.
(org-attach-dired-attach-to-next-best-subtree-mv): New command.
(org-attach-dired-attach-to-next-best-subtree-ln): New command.
(org-attach-dired-attach-to-next-best-subtree-lns): New command.
* testing/lisp/test-org-attach.el: Tests.
* lisp/org.el (org-insert-structure-template): New function for
wrapping region (or element at point) in a begin/end block.
(org-structure-predefined-blocks): New option holding predefined
blocks, for completion.
(org-try-structure-completion,
org-complete-expand-structure-template): Remove functions.
* doc/org.texi (Inserting structure templates): Document.
* testing/lisp/test-org.el (test-org/insert-template): New test.
* lisp/org-element.el (org-element--list-struct): Correctly handle end
of sub-lists and end of last item.
* testing/lisp/test-org-element.el (test-org-element/item-parser):
(test-org-element/plain-list-parser): Add tests.
* lisp/org-capture.el (org-capture-mark-kill-region): Set end marker
insertion type so that it advances when inserting text at the end of
the capture buffer.
* testing/lisp/test-org-capture.el (test-org-capture/insert-at-end-abort):
Add test case.
Inserting text at the end of the capture buffer does not advance the
end kill marker. This causes the narrowing region and the kill
markers to get out of sync, which prevents 'org-capture-finalize' from
correctly cleaning the target buffer when aborting the capture.
Setting the kill end marker insertion type fixes this.
TINYCHANGE
* testing/lisp/test-ox-publish.el (test-org-publish/resolve-external-link):
Rewrite test to prevent race condition which could affect results.
* testing/examples/pub/b.org: Add missing keyword.
* lisp/ob-core.el (org-babel-use-quick-and-dirty-noweb-expansion):
Remove variable.
(org-babel-expand-noweb-references): Update function.
* doc/org.texi (noweb-ref): Document new behaviour.
(Noweb reference syntax): Delete reference to removed variable.
`org-babel-use-quick-and-dirty-noweb-expansion' main use is to speed
up Noweb expansion when expanding only by name. By distinguishing
name and reference expansion, we no longer need this variable. In the
first case, the expansion is quicker anyway, and in the second case,
we most certainly need an accurate expansion.
* lisp/ob-tangle.el (org-babel-tangle-single-block): Prevent double unescaping
of source block by removing unnecessary call to `org-unescape-code-in-string'.
* testing/lisp/test-ob-tangle.el (ob-tangle/nested-block) New function.
* lisp/org.el (org-insert-todo-heading): Insert TODO keyword relative
to the original headline, not to the headline above.
* testing/lisp/test-org.el (test-org/insert-todo-heading-respect-content):
Add test.
* lisp/org-clock (org-clocktable-steps): Fix weekly-step clock report
ignoring hours between start of period and start of week, when start
of period is on a day of week numerically less than start of week.
Clock report now always inserts a "week" starting at the start of
the period, if necessary; all following weeks start on the start of
the week as expected.
TINYCHANGE
* lisp/org.el (org-backward-paragraph): Do not error when called from
a block opening line.
* testing/lisp/test-org.el (test-org/backward-paragraph): Add tests.
Reported-by: Omar Antolin <omar.antolin@gmail.com>
<http://lists.gnu.org/archive/html/emacs-orgmode/2017-10/msg00051.html>
* lisp/ox-publish.el (org-publish-get-base-files): Ensure MATCH regexp
is always a string since `directory-files-recursively' requires it.
* testing/lisp/test-ox-publish.el (test-org-publish/get-project-from-filename):
Add test.
Suggested-by: Jens Lechtenboerger <lechten@wi.uni-muenster.de>
<http://lists.gnu.org/archive/html/emacs-orgmode/2017-09/msg00528.html>
* lisp/org.el (org-buffer-property-keys): Remove optional argument
IGNORE-MALFORMED.
* lisp/org-pcomplete.el (pcomplete/org-mode/prop): Update call to
previous function.
* testing/lisp/test-org.el (test-org/buffer-property-keys): Remove
a test.
More often than not, the question just gets in the way. Use `M-x
org-lint' instead.
* lisp/ob-scheme.el (org-babel-scheme-execute-with-geiser): Return
"#<void>" or "#<unspecified>" when the REPL says so.
* testing/lisp/test-ob-scheme.el (test-ob-scheme/unspecified): New
test.
(test-ob-scheme/prologue): Fix tests.
Reported-by: Lawrence Bottorff <borgauf@gmail.com>
<http://lists.gnu.org/archive/html/emacs-orgmode/2017-09/msg00346.html>
* lisp/org-colview.el (org-columns-summary-types): Allow new format.
(org-columns--summarize): Update to new summary type format.
(org-columns--collect): New function.
(org-columns--compute-spec): Apply changes.
* testing/lisp/test-org-colview.el (test-org-colview/columns-summary):
Add test.
In addition to (LABEL . SUMMARIZE), org-columns-summary-types now
accepts (LABEL SUMMARIZE COLLECT) entries. The new COLLECT function is
called with one argument, the property being summarized.
TINYCHANGE
* lisp/org-duration.el (org-duration-to-minutes): Accept the empty
string.
* testing/lisp/test-org-duration.el (test-org-duration/to-minutes):
Add test.
For backward compatibility with `org-duration-string-to-minutes'
accept the empty string as a duration.
* lisp/org-table.el (org-table--align-field): New function.
(org-table-align): Use new function. Refactor code.
(org-table-justify-field-maybe): Use new function.
(org-table-get-remote-range): Remove duplicate bindings.
* doc/org.texi (Column width and alignment): Remove footnote.
* testing/lisp/test-org-table.el (test-org-table/align): New test.
* lisp/org-archive.el (org-archive-subtree): Update todo statistics
when calling `org-archive-subtree'.
(org-archive-to-archive-sibling): Update cookie statistics when
calling `org-archive-to-archive-sibling'.
* testing/lisp/test-org-archive.el: New file.
This can be disabled by setting `org-provide-todo-statistics' to nil.
* lisp/ob-sqlite.el (org-babel-sqlite-expand-vars): Stop interfering
with the 'orgtbl-to-csv' default formatting.
* testing/lisp/test-ob-sqlite.el: New file.
The problem here was that ob-sqlite was providing a format to the
`orgtbl-to-csv' that actually overwrote the default format in that
function, and in the case where there were commas in the content of
the table, broke the table as argument mechanism.
TINYCHANGE
* lisp/org.el (org-copy-visible): Rewrite function. Do not use
dubious `org-find-visible' and `org-find-invisible'.
* testing/lisp/test-org.el (test-org/copy-visible): New test.
Reported-by: Gary Cheng <garycheng12@gmail.com>
<http://lists.gnu.org/archive/html/emacs-orgmode/2017-08/msg00568.html>
* lisp/org-lint.el (org-lint-undefined-footnote-reference): Do not
warn when definition is inline.
* testing/lisp/test-org-lint.el (test-org-lint/undefined-footnote-reference):
Add tests.
Reported-by: Eric S Fraga <esflists@gmail.com>
<http://lists.gnu.org/archive/html/emacs-orgmode/2017-08/msg00577.html>
* lisp/org-table.el (org-table-sort-lines): Fix regexp. Also test
durations.
* testing/lisp/test-org-table.el (test-org-table/sort-lines): Update
tests. Add a new one.
* testing/lisp/test-ob-exp.el (test-ob-exp/org-babel-exp-src-blocks/w-no-headers):
(test-ob-exp/org-babel-exp-src-blocks/w-no-file): Fix test.
These tests fail when "htmlize" is not available on the machine.
* lisp/ob-vala.el: Add support for the Vala language to Babel.
* testing/lisp/test-ob-vala.el: Add tests for ob-vala.el.
* doc/org.texi (Working with source code): Add Vala to the list of
supported languages.
* lisp/org.el (org-time-string-to-time): Remove optional POS and
BUFFER arguments. Accept new optional ZONE argument.
(org-time-string-to-seconds): Accept optional ZONE argument.
(org-check-before-date):
(org-check-after-date):
(org-check-dates-range):
(org-goto-calendar):
* lisp/ob-gnuplot.el (org-time-string-to-time):
* lisp/org-agenda.el (org-agenda-get-blocks):
* lisp/org-clock.el (org-clock-timestamps-change):
* lisp/org-list.el (org-time-string-to-seconds): Use UTC for time
difference and time comparison.
* testing/lisp/test-org-clock.el (org-test-clock-create-clock): Use
UTC for time differences.
lisp/org-protocol.el (org-protocol-project-alist): Date-URL is added
as example.
(org-protocol-open-source): First match is processed in rewrite.
testing/lisp/test-org-protocol.el (test-org-protocol/org-protocol-open-source):
Configuration displaying a date-style URL is added.
TINYCHANGE
* lisp/org-element.el (org-element-latex-fragment-parser): Also check
border character right after opening "$" sign.
* testing/lisp/test-org-element.el (test-org-element/latex-fragment-parser):
Add tests.
Reported-by: thomas <thomas@friendlyvillagers.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/114285>
* lisp/org.el (org-open-at-point): Also open links in example blocks
and diary-sexps.
* testing/lisp/test-org.el (test-org/open-at-point/keyword):
(test-org/open-at-point/property):
(test-org/open-at-point/comment): Add tests.
Reported-by: Dieter Faulbaum <Dieter.Faulbaum@helmholtz-berlin.de>
<http://lists.gnu.org/archive/html/emacs-orgmode/2017-06/msg00277.html>
* lisp/org-clock.el (org-clock-out):
(org-clock-sum):
(org-clocktable-steps):
(org-clock-update-time-maybe): Use UTC to compute time differences.
* testing/lisp/test-org-clock.el (test-org-clock/clocktable/scope):
Update test.
* lisp/org-macro.el (org-macro--counter-increment): Rename the
optional arg RESET to ACTION, as now that action can mean setting,
resetting or even holding the specified counter. ACTION set to
"-" will hold the previous value of the counter. White-space is
now trimmed from the NAME arg too.
* doc/org.texi (Macro replacement): Document the new hold action.
* testing/lisp/test-org-macro.el (test-org-macro/n): Add new tests for
the hold action.
* lisp/org-table.el (org-table-duration-custom-format): Add new
HH:MM format.
(org-table-duration-hour-zero-padding): New option.
(org-table-eval-formula): Select second-less format if
requested.
(org-table-time-seconds-to-string): Implement formats without
seconds and without zero-padding for hours.
* testing/lisp/test-org-table.el (test-org-table/duration):
New test for second-less durations.
* doc/org.texi (Formula syntax for Calc)
(Durations and time values): Document the U mode switch.
* lisp/org.el (org--file-cache): New variable.
(org-reset-file-cache):
(org-file-url-p): New function.
(org-mode-restart): Use new function.
* lisp/org.el (org-file-contents): Allow the FILE argument to be a
URL. If the URL contents are already cached, return the cache
contents, else download the file and return contents of that. The
file is automatically cached each time it is downloaded. Add a new
optional argument NOCACHE. If this is non-nil, the URL is always
downloaded afresh. Use `org--file-cache' and `org-file-url-p'.
* lisp/org.el (org-edit-special): Do not allow editing the "file" if a
URL is specified for the "#+SETUPFILE".
* lisp/ox.el (org-export--list-bound-variables)
(org-export--prepare-file-contents):
* lisp/org-macro.el (org-macro--collect-macros) : Adapt to the
possibility that the input to `org-file-contents' can be a URL too.
* doc/org.texi (Export settings, In-buffer settings)
(The very busy C-c C-c key): Mention that #+SETUPFILE keyword can now
take a URL as a value, and that C-c C-c on the #+SETUPFILE line will
clear the org file cache.
* testing/lisp/test-org.el (test-org/org-file-contents-url)
(test-org/org-file-contents-file): Add tests for org-file-contents.
* testing/lisp/test-ox.el (test-org-export/get-inbuffer-options): Add
test for reading setupfile specified via a URL.
* lisp/ob-shell.el (org-babel--variable-assignments:bash): Do not
error when value is a list.
* testing/lisp/test-ob-shell.el (ob-shell/simple-list): New test.
Reported-by: Keith Amidon <camalot@picnicpark.org>
<http://permalink.gmane.org/gmane.emacs.orgmode/113920>
* lisp/org-src.el (org-edit-footnote-reference): Do not collapse
footnote definitions after editing remotely one of them.
* testing/lisp/test-org-src.el (test-org-src/footnote-references): New
test.
* lisp/org-macro.el (org-macro-replace-all): Expand macros only within
narrowed part of buffer.
* testing/lisp/test-org-macro.el (test-org/macro-replace-all): Update
test.
Expanding macros outside in the whole buffer could make sense, e.g.,
if a macro expands to some Babel code, which, in turn, is evaluated
prior to export. However, by principle of least surprise, it is
better to limit expansion to current accessible part of the buffer.
* lisp/org-clock.el (org-clocktable-write-default): Limit number of
time columns to the deepest headline level.
* testing/lisp/test-org-clock.el (test-org-clock/clocktable/maxlevel):
Update tests.
* lisp/org-macro.el (org-macro--counter-table): New variable.
(org-macro--counter-initialize):
(org-macro--counter-increment): New functions.
(org-macro-initialize-templates): Use new functions.
* doc/org.texi (Macro replacement): Document new macro.
* testing/lisp/test-org-macro.el (test-org-macro/n):
(test-org-macro/property): New tests.
* lisp/org-capture.el (org-capture-finalize): Remove blank lines
number fix, which only applies to narrowed capture buffers.
(org-capture-insert-template-here):
(org-capture-place-plain-text):
(org-capture-place-item):
(org-capture-place-entry): Do not hard-code number of blank lines
after entry.
Reported-by: Igor Perepelytsya <igorquail@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/113093>
Reported-by: Jay Dresser <jay@jaydresser.us>
<http://permalink.gmane.org/gmane.emacs.orgmode/113449>
* lisp/org.el (org-fill-element): New function.
(org-fill-paragraph): Use new function. Also handle region, when
called interactively.
* testing/lisp/test-org.el (test-org/fill-element): Renamed from
test-org/fill-paragraph. Update tests.
Reported-by: Oskar Kvist <oskar.kvist@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/113542>
* lisp/org.el (org-store-link): When a double C-u prefix argument is
given, do not reverse the meaning of the org-context-in-file-links
option.
* testing/lisp/test-org.el (test-org/store-link): Add tests.
This allows the user to fall back to the core link storing functions
without also reversing their org-context-in-file-links preference,
because wanting to do the former does not mean a user also wants to do
the latter.
Reported-by: York Zhao <gtdplatform@gmail.com>
<https://lists.gnu.org/archive/html/emacs-orgmode/2017-05/msg00254.html>
* lisp/org-colview.el (org-columns--displayed-value): When value is
a number and a format string is specified, apply it.
* testing/lisp/test-org-colview.el (test-org-colview/columns-summary):
Add tests.
Reported-by: Hendrik Tews <hendrik@askra.de>
<http://permalink.gmane.org/gmane.emacs.orgmode/113547>
* lisp/org-element.el (org-element-context): Do not parse timestamps
within planning line.
* testing/lisp/test-org-element.el (test-org-element/context): Remove test.
Strictly speaking, timestamps within planning lines are parameters
values that use timestamp syntax, not real timestamps belonging to the
document contents.
* lisp/org-element.el (org-element-latex-fragment-parser):
* lisp/org.el (org-latex-regexps): Allow an apostrophe right after
a fragment.
* testing/lisp/test-org-element.el (test-org-element/latex-fragment-parser):
Add test.
In Text mode, and, as a consequence, in Org mode, "'" is not treated
as punctuation, but as word constituent. The apostrophe isn't caught
by "\s." regexp.
Reported-by: Joe Corneli <holtzermann17@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/113464>
* lisp/org.el (org-N-empty-lines-before-current): Insert empty lines
before point, not after.
* testing/lisp/test-org.el (test-org/insert-heading): Add test.
* lisp/org.el (org--get-expected-indentation): Correctly indent line
when last element in an item is not a greater element.
* testing/lisp/test-org.el (test-org/indent-line): Add test.
* lisp/ox.el (org-export-get-loc):
(org-export-unravel-code):
(org-export-format-code):
(org-export-format-code-default): Do not trim leading and trailing
blank lines from code during export.
* testing/lisp/test-ox.el (test-org-export/unravel-code): Update tests.
(test-org-export/format-code-default): Add tests.
Reported-by: Li DebugFan <debugfanli@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/113205>
* lisp/org-src.el (org-src--source-type):
(org-src--tab-width): New variables.
(org-src--edit-element): Set variables above.
(org-src--contents-for-write-back): Re-indent properly non-blank lines
before inserting contents back into the source buffer.
(org-edit-src-code): Delegate block indentation to
`org-src--contents-for-write-back'.
* testing/lisp/test-org-src.el (test-org-src/indented-blocks): New
test.
Reported-by: Brent Goodrick <bgoodr@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/113207>
* lisp/org-element.el (org-element--object-lex): Fix parsing of radio
links within emphasis.
* testing/lisp/test-org-element.el (test-org-element/link-parser): Add
test.
Reported-by: R C <recifx@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/113063>
* lisp/org.el (org-forward-heading-same-level): Do not fail when
heading is at the beginning of the buffer.
* testing/lisp/test-org.el (test-org/forward-heading-same-level): New
test.
Reported-by: Rafael Laboissière <rafael@laboissiere.net>
<http://permalink.gmane.org/gmane.emacs.orgmode/113084>
* lisp/ox.el (org-export-as): Remove uninterpreted data from back-end
specific parsed keywords.
* testing/lisp/test-ox.el (test-org-export/uninterpreted): Add test.
This fixes 6cd42b08f9.
* lisp/org-agenda.el (org-agenda-list): Reset `org-agenda-buffer-name'
to the original name.
* testing/lisp/test-org-agenda.el: Pertaining unit test. + 2 basic
agenda tests.
* testing/examples/agenda-file.org: File to produce content for an
agenda to test.
* lisp/org.el (org-N-empty-lines-before-current): Do not hide newline
character before current headline.
* testing/lisp/test-org.el (test-org/insert-heading): Add test.
Reported-by: Rick Frankel <rick@rickster.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/112751>
* lisp/ox.el (org-export--remove-uninterpreted-data): Do not modify
communication channel. Change "blob" to "datum".
(org-export--remove-uninterpreted-data-1): Remove function.
(org-export-as): Remove uninterpreted data from parsed keyword before
applying filters.
* testing/lisp/test-ox.el (test-org-export/uninterpreted): Add test.
Reported-by: Rasmus <rasmus@gmx.us>
<http://permalink.gmane.org/gmane.emacs.orgmode/112730>
* lisp/org-capture.el (org-capture-fill-template): Escape backslash
characters in %i contents when those are inserted within a S-exp.
Also prevent adding any prefix to %i contents spanning over multiple
lines when they are inserted within a S-exp.
* testing/lisp/test-org-capture.el (test-org-capture/fill-template):
Add tests.
Reported-by: Samuel Wales <samologist@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/112232>
* lisp/org-clock.el (org-dblock-write:clocktable): Funcall the scope
argument if it is a function.
* doc/org.texi: Document the feature of using a nullary function as the
scope for the clocktable.
* testing/lisp/test-org-clock.el: Adds a test for the above
feature. Also, fix the number of hours of a test that seemed to be
broken.
TINYCHANGE
* lisp/ob-core.el (org-babel-examplify-region): Escape Org syntax
before wrapping it.
* testing/lisp/test-ob.el (test-ob/org-babel-insert-result): Add test.
Renamed from `test-ob/org-babel-insert-result--improper-lists'.
Reported-by: D M German <dmg@turingmachine.org>
* lisp/org-duration.el (org-duration-to-minutes): Fix bug where the
same unit with a decimal unit would be matched multiple times.
* testing/lisp/test-org-duration.el (test-org-duration/to-minutes):
Fix test.
* lisp/org-capture.el (org-capture-refile): Preserve location of point
when refiling.
* testing/lisp/test-org-capture.el (test-org-capture/refile): New
test.
Reported-by: Liu Hui <liuhui1610@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/112202>
* lisp/org-clock.el (org-clocktable-write-default): Do not ignore
properties specified by :properties parameter.
* testing/lisp/test-org-clock.el (test-org-clock/clocktable/properties):
New test.
The regression was introduced in b897ab722.
Reported-by: Dale <dale@codefu.org>
<http://permalink.gmane.org/gmane.emacs.orgmode/112219>
* lisp/org-clock.el (org-clock--translate): New function.
(org-clocktable-write-default): Use new function.
* testing/lisp/test-org-clock.el (test-org-clock/clocktable/lang): New
test.
* lisp/org-element.el (org-element-link-parser):
Handle drive names in uri like file:///c:/dir/file
* lisp/ox.el (org-export-file-uri):
Handle drive names in uri like file:///c:/dir/file
* testing/lisp/test-ox.el (test-org-export/file-uri):
Generate the right uri to be tested against link exporter.
* lisp/org-clock.el (org-clocktable-write-default): Do not raise an
error when :maxlevel is 0. Small refactoring.
* testing/lisp/test-org-clock.el (test-org-clock/clocktable): Split
into ...
(test-org-clock/clocktable/ranges):
(test-org-clock/clocktable/tags):
(test-org-clock/clocktable/scope):
(test-org-clock/clocktable/maxlevel):
(test-org-clock/clocktable/formula): ... these. Add tests.
This fixes regression introduced in ccf832e83.
Reported-by: Christoph LANGE <math.semantic.web@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/112091>
* lisp/org-element.el (org-element-insert-before): Do not call
`reverse' as contents might use `eq' objects.
* testing/lisp/test-ox.el (test-org-export/uninterpreted): Add test
Reported-by: Justin Kirby <justinkirby@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/112065>
* contrib/lisp/org-depend.el (org-depend-trigger-todo): Use new
functions.
* contrib/lisp/org-invoice.el (org-invoice-heading-info):
(org-invoice-info-to-table):
(org-invoice-list-to-table): Use new functions.
* contrib/lisp/ox-taskjuggler.el (org-taskjuggler--build-task): Use
new functions.
* lisp/org-agenda.el (org-agenda-show-clocking-issues):
(org-agenda-format-item):
(org-agenda-filter-effort-form): Use new functions.
* lisp/org-clock.el (org-clock-get-clock-string):
(org-clock-modify-effort-estimate):
(org-clock-notify-once-if-expired):
(org-clock-out):
(org-clock-display):
(org-clock-put-overlay):
(org-clocktable-write-default): Use new functions.
* lisp/org-table.el (org-table-sort-lines): Use new functions.
* lisp/org.el (org-properties-postprocess-alist):
(org-refresh-effort-properties):
(org-set-effort):
(org-entry-properties):
(org-property-next-allowed-value): Use new functions.
(org-time-clocksum-format):
(org-time-clocksum-use-fractional):
(org-time-clocksum-use-fractional-format):
(org-time-clocksum-use-effort-durations): Declare as obsolete. Move
to "org-compat.el".
(org-minutes-to-clocksum-string):
(org-hh:mm-string-to-minutes):
(org-duration-string-to-minutes): Declare as obsolete. Move to
"org-compat.el".
(org-hours-to-clocksum-string): Remove function.
* lisp/org-colview.el (org-columns--collect-values): Use new
functions.
(org-columns--duration-re): Remove variable.
(org-columns--time-to-seconds): Rename to...
(org-columns--age-to-minutes): ... this.
(org-columns--format-age): New function.
(org-columns--summary-apply-times):
(org-columns--summary-min-age):
(org-columns--summary-max-age):
(org-columns--summary-mean-age): Use new functions.
* testing/lisp/test-org-clock.el (test-org-clock-clocktable-contents-at-point):
* testing/lisp/test-org-colview.el (test-org-colview/columns-summary):
Update tests.
* lisp/org-clock.el (org-clocktable-write-default): Fix percent computation.
(org-clock-time%): Remove function.
* testing/lisp/test-org-clock.el (test-org-clock/clocktable): Update
test.
As a consequence of this patch, a ":formula %" doesn't generate
a TBLFM line anymore.
* lisp/org.el (org-get-repeat): Make sure matching group refers to the
proper regexp.
* testing/lisp/test-org.el (test-org/get-repeat): New test.
The bug was introduced in aef7eef0f.
* lisp/org.el (org-get-repeat): Wrap call to save match data against
side effects.
* testing/lisp/test-org.el (test-org/get-repeat): New test for
`org-get-repeat'.
* lisp/org-table.el (org-table-get-field): Do not return
`beginning-of-buffer' error when called at beginning of buffer.
* testing/lisp/test-org-table.el (test-org-table/get-field): New test.
* lisp/org.el (org-refresh-properties): Handle inheritance from global
values (e.g., from "#+PROPERTY:" keyword).
(org-refresh-property): Handle property inheritance with a new
optional argument.
* testing/lisp/test-org.el (test-org/refresh-properties): New test.
* lisp/org.el (org--deadline-or-schedule): New function.
(org-schedule):
(org-deadline): Use new function.
* testing/lisp/test-org.el (test-org/deadline):
(test-org/schedule): New tests.
Reported-by: Michael Welle <mwe012008@gmx.net>
<http://permalink.gmane.org/gmane.emacs.orgmode/111569>
* lisp/org.el (org-entry-properties): Fix special property value in
current entry, do not leak into next entry.
* testing/lisp/test-org.el (test-org/entry-properties): Add test.
Reported-by: Samuel Wales <samologist@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/111648>
* lisp/org.el (org-entry-delete): Also remove erroneously inserted
special properties in properties drawer. Small refactoring.
* testing/lisp/test-org.el (test-org/entry-delete): Add test.
Reported-by: Michael Welle <mwe012008@gmx.net>
<http://permalink.gmane.org/gmane.emacs.orgmode/111564>
* lisp/org-info.el (org-info-export): Handle links when exporting to
"texinfo" back-end.
* lisp/ox-texinfo.el (org-texinfo-link): Delegate "info" links
handling to the function above.
* lisp/org.el (org-clone-subtree-with-time-shift): Don't choke on a
blank SHIFT argument.
* testing/lisp/test-org.el (test-org/clone-with-time-shift): Add
test.
This fixes a regression introduced by c31462f33.
* lisp/org-table.el (org-table-eval-formula): Result is not always a string.
* testing/lisp/test-org-table.el (test-org-table/copy-field): Update
test.
* lisp/org.el (org-drag-element-backward): When point is on empty
lines below a headline, call `org-move-subtree-up'.
* testing/lisp/test-org.el (test-org/drag-element-backward): Add test.
* lisp/org-element.el (org-element-normalize-contents): Fix return
value when any line after the first has no indentation.
* testing/lisp/test-org-element.el (test-org-element/normalize-contents):
Add test.
* lisp/ox.el (org-export--skip-p): Handle comments and comment blocks
removal.
(org-export--delete-comments): Rename to...
(org-export--delete-comment-trees): ... this. Now only take care of
commented trees and inlinetasks.
* testing/lisp/test-ox.el (test-org-export/comments): Add test.
(org-test-with-parsed-data): Apply renaming.
* lisp/org.el (org-N-empty-lines-before-current): Preserve point when
calling the function from the beginning of a line.
* testing/lisp/test-org.el (test-org/insert-heading): Add tests.
* lisp/ox.el (org-export-table-has-special-column-p): Tiny
refactoring.
(org-export-table-has-header-p): Fix cache use, i.e., no longer
re-compute return value when the table is already known to have no
header.
(org-export-table-row-group):
(org-export-table-row-number): Populate cache with all the rows
whenever a row is queried. This fixes previous quadratic behaviour.
Reported-by: Thierry Banel <tbanelwebmin@free.fr>
<http://permalink.gmane.org/gmane.emacs.orgmode/111131>
* lisp/ox-publish.el (org-publish-get-base-files): Make sure to remove
directories.
* testing/examples/pub/file.txt:
* testing/examples/pub/noextension: New files.
* testing/lisp/test-ox-publish.el (test-org-publish/base-extension):
New test.
* lisp/org-element.el (org-element-class): Make it a defsubst.
* lisp/org-table.el (orgtbl-to-generic): Do not use cache when
building Org table. Factor out calls to Org Export functions when
they are not necessary.
(org-table--to-generic-row): Factor out calls to Org Export functions
when they are not necessary.
* lisp/ox.el (org-export-resolve-fuzzy-link):
(org-export-table-has-header-p):
(org-export-table-row-group):
(org-export-table-cell-width):
(org-export-table-cell-alignment): Small refactoring.
(org-export-table-row-number): Add caching.
* testing/lisp/test-org-element.el (test-org-element/class): Remove
test.
* lisp/org.el (org-set-tags): Reveal newly inserted tags.
* testing/lisp/test-org.el (test-org/set-tags): New test.
Sometimes freshly added tags can be sucked into invisible outline
region (denoted by ellipsis) - and to see them you need to do the full
global visibilty cycle.
* lisp/org-list.el (org-list-to-generic): :istart, :icount, :iend
and :isep are now called with an additional argument, the type of the
list. Also add a new property :ifmt.
(org-list--to-generic-item): Use new property.
(org-list-to-subtree): Adapt to new requirements for :istart and :iend.
* testing/lisp/test-org-list.el (test-org-list/to-generic): Update
tests.
* lisp/ox.el (org-export-data-with-backend):
(org-export-with-backend): Preserve internal references once the local
back-end has been applied.
* testing/lisp/test-ox.el (test-org-export/get-reference): Add tests.
* lisp/org.el (org-set-emph-re): Refactor code. Rip "~" and "="
markers off `org-emph-re'.
(org-do-emphasis-faces):
(org-sort-remove-invisible): Handle both `org-emph-re' and
`org-verbatim-re'.
(org-in-verbatim-emphasis): Use `org-verbatim-re' instead of
`org-emph-re'.
* lisp/org-element.el (org-element-code-parser):
(org-element-verbatim-parser): Use `org-verbatim-re' instead of
`org-emph-re'.
* testing/lisp/test-org-element.el (test-org-element/bold-parser):
(test-org-element/code-parser):
(test-org-element/italic-parser):
(test-org-element/strike-through-parser):
(test-org-element/underline-parser):
(test-org-element/verbatim-parser): Update tests, which no longer need
to bind `org-emph-re'.
* lisp/ob-plantuml.el (org-babel-execute:plantuml) Include prologue and
header variables to temporary file body.
(org-babel-plantuml-make-body): New function.
(org-babel-variable-assignments:plantuml): New function.
* testing/lisp/test-ob-plantuml.el: New file.
* lisp/ob-tangle.el (org-babel-tangle-single-block):
`org-babel-expand-noweb-references' specifically needs to be run in
the Org document so as to resolve references.
* testing/lisp/test-ob-tangle.el (ob-tangle/continued-code-blocks-w-noweb-ref):
Make sure a failing test doesn't leave a file behind it.
* lisp/org.el (org-drag-element-backward):
(org-drag-element-forward): Check that org-element-at-point returns a
non-nil value to avoid a type-error when called before first element.
* testing/lisp/test-org.el (test-org/drag-element-backward):
(test-org/drag-element-forward): Add test for when point is before
first element. Adjust existing should-error calls to specify
user-error.
* testing/lisp/test-ob.el (test-ob/indented-cached-org-bracket-link):
Use `expand-file-name' to prevent introducing "//" patterns in file
name.
Reported-by: David Talmage <david.talmage@shoutpoint.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/110285>
* lisp/ob-exp.el (org-babel-exp-process-buffer): Change variable
name `org-export-babel-evaluate' to `org-export-use-babel'. Also
change the name in its `defcustom' and set the `:safe' key.
* lisp/ox-icalendar.el (org-icalendar-export-current-agenda): Change
variable name.
* lisp/ox.el (org-export-as): Change variable name.
* doc/org.texi (Exporting code blocks): Change variable name. Amplify
the explanation of what the variable does. Add variable index entry.
* testing/lisp/test-ob-exp.el: Change variable name.
* testing/lisp/test-ob-lob.el: Change variable name.
* testing/lisp/test-ox.el: Change variable name.
Users were often confused that setting this variable to `nil' will
cause header arguments to be ignored in addition to preventing code
from being evaluated. It is hoped that the documentation changes and
the name `org-export-use-babel' will better convey that everything
babel does can be switched off with this variable.
* lisp/ox.el (org-export-get-reference): Ensure different elements or
objects generating the same search cell do not get the same internal
reference.
* testing/lisp/test-ox.el (test-org-export/get-reference): Add test.
Reported-by: mstrey@strey.biz
<http://permalink.gmane.org/gmane.emacs.orgmode/110211>
* lisp/org-colview.el (org-columns--time-to-seconds): Recognize
a duration even when it contains a H:MM:SS part.
* testing/lisp/test-org-colview.el (test-org-colview/columns-summary):
Add test.
Reported-by: Björn Döring <bjoern@doering.io>
<http://permalink.gmane.org/gmane.emacs.orgmode/110144>
* lisp/ox.el (org-export-as): Skip planning info and first property
drawer when exporting a subtree.
* testing/lisp/test-ox.el (test-org-export/export-scope): Add test.
* lisp/org-element.el (org-element--current-element): Check that
planning info and property drawers are correctly located before
parsing them.
* testing/lisp/test-org-element.el (test-org-element/planning-parser):
(test-org-element/property-drawer-parser): Add tests.
* lisp/org.el (org-return): Recognize non-keywords and split text
accordingly.
* testing/lisp/test-org.el (test-org/return): Add test.
Reported-by: Samuel Wales <samologist@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/109929>
* lisp/org-clock.el (org-dblock-write:clocktable): Small refactoring.
(org-clocktable-write-default): Avoid writing a "File" column when using
`file-with-archives' scope instead of deleting it at the end of the
process.
* testing/lisp/test-org-clock.el (test-org-clock/clocktable): Add test.
Reported-by: Dale <dale@codefu.org>
<http://permalink.gmane.org/gmane.emacs.orgmode/109856>
* lisp/org-element.el (org-element--object-lex): Do not re-match past
1-character long radio links.
* testing/lisp/test-org-element.el (test-org-element/link-parser): Add
test.
Reported-by: Daniel Clemente <n142857@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/109861>
* lisp/org-element.el (org-element-class): New function.
(org-element-map):
(org-element-interpret-data):
* lisp/org-footnote.el (org-footnote--allow-reference-p):
* lisp/org-src.el (org-src--on-datum-p):
* lisp/ox-odt.el (org-odt-footnote-reference):
(org-odt-table-cell):
* lisp/ox.el (org-export-data):
(org-export-expand): Use new function.
* testing/lisp/test-org-element.el (test-org-element/class): New test.
Using generic `org-element-class' allows to handle unknown, i.e.,
pseudo, object or element types. It also reduces code duplication in
`org-element-interpret-data' and `org-export-data', preventing, e.g.,
bugs as the one fixed in c58e1b5.
* lisp/org-element.el (org-element-link-interpreter): % in description
are confused with format string placeholders. Escape them so as to
fix the error.
* testing/lisp/test-org-element.el (test-org-element/link-interpreter):
Add test.
Reported-by: Daniel Clemente <n142857@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/109878>
* lisp/org-element.el (org-element-interpret-data):
* lisp/ox.el (org-export-data): Correctly guess if a pseudo element or
object should be followed by spaces or blank lines.
* testing/lisp/test-ox.el (test-org-export/pseudo-objects):
(test-org-export/pseudo-elements): New tests.
* lisp/org-table.el (org-table-recalculate-buffer-tables): Align all
tables in a buffer.
(org-table-iterate-buffer-tables): Align a table only once, align all
tables in a buffer.
* lisp/org.el (org-beginning-of-line): Move to beginning of visual line
when appropriate. Fix docstring.
* testing/lisp/test-org.el (test-org/beginning-of-line): Add tests.
* lisp/org.el (org-end-of-line): Correctly go to the end of visible
line, when appropriate.
* testing/lisp/test-org.el (test-org/end-of-line): Add tests.
* lisp/org.el (org-beginning-of-line): Leave point before any invisible
character at column 0. Small refactoring.
* testing/lisp/test-org.el (test-org/beginning-of-line): Add tests.
The regression was introduced in
3baf246f4f.
* lisp/org-element.el (org-element-link-parser): Add :format property.
Tiny refactoring.
* testing/lisp/test-org-element.el (test-org-element/link-interpreter):
Add one test. Update some others.
Since the link format is lost during parsing, the interpreter can hardly
handle nested links. Indeed, in that case, the inner link is
interpreted as a bracket link, thus breaking the outer link.
Another option could be to guess a safe format for the link to be
interpreted. E.g.,
- any inner link could default to angle format unless it contains ">",
it which case it would become a plain link;
- other links would have the bracket format, unless they contain "][" or
"]]".
In any case, defining :format is less error prone and is similar to what
entities and sub/super-scripts have for curly brackets.
Reported-by: Thibault Marin <thibault.marin@gmx.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/109623>
* lisp/ob-core.el (org-babel--insert-results-keyword):
(org-babel-where-is-src-block-result): Control better the number of
empty lines around results of a source block evaluation.
* testing/lisp/test-ob.el (test-ob/blocks-with-spaces): Add tests.
(test-ob/specific-colnames): Fix test.
* lisp/org.el (org-align-tags-here): Renamed to...
(org--align-tags-here): ... this.
This change emphasizes the fact that, as an internal function, it
shouldn't be used without special care. This also prevents confusing
between this function and `org-set-tags' called with a non-nil ALIGN
argument.
* lisp/org.el (org-align-tags-here): Do not use `org-move-to-column',
which may move point on the other side of some invisible text.
Refactor code.
* testing/lisp/test-org.el (test-org/tag-align): Add test.
Reported-by: Michael Fiano <michael.fiano@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/109435>
* lisp/org-table.el (org-table-insert-row): Fix inserting a new row when
the buffer doesn't end with a newline character. Tiny refactoring.
* testing/lisp/test-org-table.el (test-org-table/next-field): New test.
* testing/lisp/test-ob-maxima.el:
(ob-maxima/matrix-output): Remove filtering of informational output.
Credit to Leo Butler. From his post:
Since those informational messages are written to stdout, do
with_stdout("/dev/null", load(numericalio))$
write_data ....
to muffle the messages. Note that sbcl warnings are muffled by
:lisp (setf sb-ext::*muffled-warnings* 'warning)
* testing/lisp/test-ob-maxima.el (ob-maxima/matrix-output): Remove lines
starting with ";;" from the result of `org-babel-execute-src-block'.
This fix works around the occurance of lines like
;; loading #P"/home/b/.../numericalio/encode-decode-float.fasl"
in the output of maxima.
Maxima version: "5.38.1"
Lisp implementation type: "SBCL"
Lisp implementation version: "1.3.6"