Commit Graph

1272 Commits

Author SHA1 Message Date
Nicolas Goaziou 1c95729788 ox: Fix internal references when using `org-export-(data-)with-backend'
* 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.
2016-12-13 22:11:41 +01:00
Nicolas Goaziou 00ea6a286c ob-tangle: Fix last commit
* 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.
2016-12-10 00:59:08 +01:00
Kyle Meyer 6983f8e8bf Issue user-error when trying to drag before first element
* 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.
2016-11-28 18:40:43 -05:00
Nicolas Goaziou 0bdf18befd test-ob: Fix failing test on MacOS
* 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>
2016-11-20 09:36:42 +01:00
Nicolas Goaziou 9e2dc98eef Fix error when exporting body only of an empty buffer
* lisp/ox.el (org-export-filter-apply-functions): Return empty string
  instead of nil when a filter returns the empty string.

* testing/lisp/test-ox.el (test-org-export/export-scope): Add test.
(test-org-export/filter-apply-functions): New test.

Reported-by: "Stefan-W. Hahn" <stefan.hahn@s-hahn.de>
<http://permalink.gmane.org/gmane.emacs.orgmode/110371>
2016-11-19 23:08:12 +01:00
Nicolas Goaziou ebbc675bd9 Fix TODO keywords case sensitivity
* lisp/org.el (org-todo-regexp):
(org-not-done-regexp):
(org-not-done-heading-regexp):
(org-todo-line-regexp):
(org-complex-heading-regexp): Improve docstrings.

(org-insert-todo-heading):
(org-fix-position-after-promote):
(org-link-search):
(org-block-todo-from-children-or-siblings-or-parent):
(org-get-todo-state):
(org-priority):
(org-point-at-end-of-empty-headline):
* lisp/org-agenda.el (org-fix-agenda-info):
(org-agenda-get-todos):
(org-cmp-alpha):
* lisp/org-archive.el (org-archive-subtree):
(org-archive-all-done):
* lisp/org-list.el (org-toggle-item):
* lisp/org-pcomplete.el (pcomplete/org-mode/searchhead): Bind
`case-fold-search' to nil when matching aginst one of the regexp
above.

* testing/lisp/test-org.el (test-org/fuzzy-links): Add tests.
2016-11-13 11:26:17 +01:00
Nicolas Goaziou 27b10fb265 ox: Fix duplicate internal references for same title headings
* 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>
2016-11-11 17:47:09 +01:00
Nicolas Goaziou a3c366eb98 org-colview: Fix time sum when mixing duration and H:MM:SS time
* 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>
2016-11-11 12:02:34 +01:00
Nicolas Goaziou c93a17dd8a ox: Fix subtree export when starting with meta-data
* 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.
2016-11-11 10:17:15 +01:00
Nicolas Goaziou 9f98979ff0 org-element: Prevent parsing meta-data after blank lines
* 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.
2016-11-10 00:25:34 +01:00
Nicolas Goaziou 1dc6c4bc9c org-element: Fix inlinetask parsing
* lisp/org-element.el (org-element-headline-parser): Small refactoring.
(org-element-inlinetask-parser): Add missing :pre-blank property.  Small
refactoring.  Also fix regexp for task end.

* testing/lisp/test-org-element.el (test-org-element/inlinetask-parser):
  Add test.
2016-11-09 23:30:39 +01:00
Nicolas Goaziou e8b4eeb482 Fix `org-return' on non-keyword
* 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>
2016-10-29 00:00:32 +02:00
Nicolas Goaziou 4f9ec1adeb org-element: Fix export of LaTeX math in headlines
* lisp/org-element.el (org-element-class): Find pseudo-objects in
  secondary strings.
* testing/lisp/test-org-element.el (test-org-element/class): Add test.

This bug was introduced in 1a88cf920e.

Reported-by: Stefanos Carlström <stefanos.carlstrom@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/109922>
2016-10-28 15:46:22 +02:00
Nicolas Goaziou 33f8f8adaa org-clock: Fix clock table with `file-with-archives' scope
* 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>
2016-10-27 11:42:27 +02:00
Nicolas Goaziou a300f362a0 org-element: Fix parsing radio links
* 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>
2016-10-27 00:41:19 +02:00
Nicolas Goaziou 1a88cf920e org-element: Improve support for pseudo objects and elements
* 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.
2016-10-25 13:13:26 +02:00
Nicolas Goaziou dd670073de org-element: Fix interpreting links with % in description
* 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>
2016-10-24 23:56:34 +02:00
Nicolas Goaziou c58e1b565b Fix :post-blank handling for pseudo elements and objects
* 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.
2016-10-24 23:32:15 +02:00
Michael Brand 359afa6806 Fix table align when recalculating buffer tables
* 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.
2016-10-21 17:35:13 +02:00
Michael Brand e66298dfd9 Add test for table alignment
* testing/lisp/test-org-table.el (test-org-table/align-buffer-tables):
New test to document current behavior.
2016-10-21 17:33:13 +02:00
Michael Brand ed86b1aa3c Fix table header text in test
* testing/lisp/test-org-table.el
(test-org-table/simple-formula/with-grouping/no-title-row): Fix table
header text.
2016-10-21 17:31:45 +02:00
Nicolas Goaziou a2b1be7461 Add tests for `C-a' and `C-e'
* testing/lisp/test-org.el (test-org/beginning-of-line):
(test-org/end-of-line): Add tests.

Tests are for bug fixed in e4d4c6e1bc.
2016-10-18 09:30:50 +02:00
Nicolas Goaziou 8d2f0a4411 Fix `C-a' with visual lines and arguments
* 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.
2016-10-15 12:00:43 +02:00
Nicolas Goaziou 45048eb783 Fix `C-e' with visible lines and arguments
* 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.
2016-10-15 11:36:09 +02:00
Nicolas Goaziou 2971c48cf1 Remove unnecessary workaround
* lisp/org.el (org-beginning-of-line): Remove unnecessary workaround for
  bug #14346.

* testing/lisp/test-org.el (test-org/beginning-of-line): Update tests.
2016-10-15 11:26:10 +02:00
Nicolas Goaziou 756bb87d81 Fix regression in `org-beginning-of-line'
* 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.
2016-10-13 09:41:54 +02:00
Nicolas Goaziou 05794b13b3 org-element: Add :format property to link objects
* 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>
2016-10-09 09:34:26 +02:00
Nicolas Goaziou 2116162fe6 ob-core: Prevent spurious blanks lines when executing code
* 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.
2016-10-07 23:56:37 +02:00
Nicolas Goaziou 966e0bff56 Change `org-align-tags-here' into `org--align-tags-here'
* 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.
2016-10-05 11:54:49 +02:00
Nicolas Goaziou e992a2846b Add more tests for `org-insert-heading'
* testing/lisp/test-org.el (test-org/insert-heading): Add tests.
2016-10-04 11:35:57 +02:00
Nicolas Goaziou 9d7d650cd7 ob-core: Fix hash with time stamp
* lisp/ob-core.el (org-babel-result-regexp): Fix regexp.
(org-babel--insert-results-keyword): Simplify format-string.
(org-babel--clear-results-maybe): Fix return value.

* testing/lisp/test-ob.el (test-ob/where-is-src-block-result): Add
  tests.

Reported-by: Thomas Alexander Gerds <tag@biostat.ku.dk>
<http://permalink.gmane.org/gmane.emacs.orgmode/109418>
2016-10-01 10:30:53 +02:00
Nicolas Goaziou b3c556d83a Fix tags alignment when headline contains invisible text
* 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>
2016-09-30 00:58:21 +02:00
Nicolas Goaziou 2b22d503e1 org-table: Fix inserting a new row
* 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.
2016-09-28 23:33:32 +02:00
Aaron Ecay 407b0d41a2 contrib, test suite: use assq instead of assoc for :keywords 2016-09-23 11:20:55 +01:00
Nicolas Goaziou 582233dc08 Add tests for Org Lint
* testing/lisp/test-org-lint.el: New file.
2016-09-19 00:57:20 +02:00
Nicolas Goaziou 149b8046ac `org-open-line' ignores tables at the very beginning of the document
* lisp/org.el (org-open-line): Ignore tables at the very beginning of
  the document.
* testing/lisp/test-org.el (test-org/open-line): New test.
2016-09-18 17:22:48 +02:00
thibault 2090efaed7 ob-lua.el: Update library for Org 9.0
* lisp/ob-lua.el (org-babel-lua-evaluate-external-process):
(org-babel-lua-evaluate-session): Update for Org 9.0 compatibility.

* testing/test-ob-lua.el: New file.

TINYCHANGE
2016-08-29 08:57:10 +02:00
Nicolas Goaziou a9aad1c8e1 Merge branch 'maint' 2016-08-29 00:45:07 +02:00
Nicolas Goaziou 2dfdafd35a org-table: Fix column formulas
* lisp/org-table.el (org-table-recalculate): Fix column formulas in
  tables consisting of a single row group.

Reported-by: Michael Welle <mwe012008@gmx.net>
<http://permalink.gmane.org/gmane.emacs.orgmode/108886>
2016-08-29 00:43:38 +02:00
Nicolas Goaziou 3b3fc520aa Fix coderef handling in source blocks
* lisp/ob-core.el (org-babel--normalize-body): Do not remove coderef.
(org-babel-get-src-block-info): Add coderef label information, when
available, to the return value.
(org-babel-execute-src-block): Expand noweb and remove coderefs
non-destructively.
* lisp/ob-lob.el (org-babel-lob-get-info): Adapt to new INFO.

* testing/lisp/test-ob-exp.el (ob-export/body-with-coderef):
* testing/lisp/test-ob.el (test-ob/evaluate-body-with-coderefs): Add
  tests.

Reported-by: Thibault Marin <thibault.marin@gmx.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/108888>
2016-08-28 11:56:14 +02:00
Nicolas Goaziou de24694f05 Turn org-mode into Org or Org mode
Use Org or Org mode instead of org-mode or Org-mode according to
"Documentation standards".
2016-08-23 22:13:56 +02:00
Marco Wahl 29942e6aa8 test-ob-maxima: Revert last commit
* 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)
2016-08-20 23:43:35 +02:00
Marco Wahl 7afd7ebff5 ob-maxima-test: Clarify matrix test
* testing/examples/ob-maxima-test.org: Suppress informational output at
  load of numericalio.  (This output made testing complicated.)
2016-08-20 23:36:41 +02:00
Marco Wahl b7b93a0c2c test-ob-maxima: Fix maxima matrix test
* 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"
2016-08-20 21:48:16 +02:00
Marco Wahl b394cfd9ed ob-maxima-test: Tiny cleanup
* testing/examples/ob-maxima-test.org: Removed superfluous source block
  variable.
2016-08-20 19:33:16 +02:00
Nicolas Goaziou c0924db32c Merge branch 'maint' 2016-08-20 00:27:33 +02:00
Nicolas Goaziou 589e96321b org-clock: Fix infloop when creating a clock table
* lisp/org-clock.el (org-clock-sum): Fix infloop when first headline in
  scope has a level strictly greater than 1.

Reported-by: Yichao Woo <wooyichao@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/108606>
2016-08-20 00:22:13 +02:00
Nicolas Goaziou 3771f35f80 org-src: Fix coderef regexp
* lisp/org-src.el (org-src-coderef-regexp): A coderef label cannot be
  consist of white spaces only.

* testing/lisp/test-org-src.el (test-org-src/coderef-regexp): Add test.
2016-08-18 01:04:28 +02:00
Nicolas Goaziou 48af4166fd Consider edit buffers in `org-src-coderef-regexp'
* lisp/org-src.el (org-src-coderef-format): New function
(org-src-coderef-regexp): Change signature.

* lisp/ob-core.el (org-babel--normalize-body):
* lisp/ox.el (org-export-unravel-code): Use new functions.

* testing/lisp/test-org-src.el (test-org-src/coderef-format): New test.
2016-08-17 23:43:38 +02:00
Nicolas Goaziou 8e51a88bf0 Fix indentation in tests
* testing/lisp/test-org-src.el (test-org-src/basic):
(test-org-src/empty-block):
(test-org-src/blank-line-block):
(test-org-src/preserve-tabs): Fix indentation and tab issues.
2016-08-17 23:36:32 +02:00