Commit Graph

1286 Commits

Author SHA1 Message Date
Nicolas Goaziou 45d57bb4db org-list: Implement `org-list-to-org'
* lisp/org-list.el (org-list-to-org): New function.
* testing/lisp/test-org-list.el (test-org-list/to-org): New test.
2016-12-19 12:19:58 +01:00
Nicolas Goaziou 835b8e05e5 org-list: Tweak `org-list-to-generic'
* 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.
2016-12-19 12:14:48 +01:00
Nicolas Goaziou 753b90e321 org-element: Do not support nested links anymore
* lisp/org-element.el (org-element-object-restrictions):
(org-element--object-lex): Do not support nested links.

* testing/lisp/test-org-element.el (test-org-element/link-parser):
* testing/lisp/test-org-lint.el (test-org-lint/link-to-local-file):
  Remove tests.
2016-12-17 11:35:50 +01:00
Nicolas Goaziou f5b7de222d Fix level of newly inserted headlines
* lisp/org.el (org-insert-heading): Fix level of new headline when
  creating it from a regular text line.

* testing/lisp/test-org.el (test-org/insert-heading): Add tests.

Reported-by: swflint@flintfam.org (Samuel W. Flint)
<http://permalink.gmane.org/gmane.emacs.orgmode/110842>
2016-12-15 00:15:12 +01:00
Nicolas Goaziou 4691033abb Merge branch 'maint' 2016-12-13 22:14:02 +01:00
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 9fb2e047d2 Split `org-emph-re' and `org-verbatim-re'
* 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'.
2016-12-12 22:21:17 +01:00
thibault cb33cd066d ob-plantuml: Add support for prologue and header variables
* 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.
2016-12-10 12:06:04 +01:00
Nicolas Goaziou 24219e93fb Merge branch 'maint' 2016-12-10 01:02:06 +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
Nicolas Goaziou c8da8529f5 `org-insert-heading' doesn't create items anymore
* lisp/org.el (org-insert-heading): Specialize function for headlines,
  not items.
(org-meta-return): Update according to new specifications above.
* lisp/org-list.el (org-insert-item): Add interactive spec.
* doc/org.texi (Structure editing): Update documentation.

* testing/lisp/test-org.el (test-org/insert-heading): Remove tests.
* testing/lisp/test-org-list.el (test-org-list/insert-item): Add test.
2016-12-10 00:32:15 +01:00
Nicolas Goaziou 68d8f860cd Improve blank line handling in `org-insert-heading'
* lisp/org.el (org--blank-before-heading-p): New function.
(org-insert-heading): Use previous function.  Major refactoring.

* testing/lisp/test-org.el (test-org/insert-heading):
(test-org/insert-todo-heading-respect-content): Update tests.
2016-12-10 00:32:14 +01:00
Kyle Meyer 3d80b3545e Merge branch 'maint' 2016-11-28 18:56:17 -05: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 b06259357a Merge branch 'maint' 2016-11-20 09:38:13 +01: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 db0377ddc6 Merge branch 'maint' 2016-11-19 23:09:33 +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
Charles Berry 3b5ce449c4 Replace `org-export-babel-evaluate' with `org-export-use-babel'
* 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.
2016-11-13 15:29:33 -08: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