Commit Graph

1463 Commits

Author SHA1 Message Date
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
Nicolas Goaziou 9f47b37231 Ignore coderef labels when evaluating a code block
* lisp/ob-core.el (org-babel--normalize-body): New function.
(org-babel-get-src-block-info): Use new function.

* lisp/org-src.el (org-src-coderef-regexp): New function.
* lisp/ox.el (org-export-unravel-code): Use new function.

* testing/lisp/test-ob.el (test-ob/evaluate-body-with-coderefs): New
  test.
2016-08-08 14:04:11 +02:00
Nicolas Goaziou 406ad6eb52 `org-get-heading' is more consistent on empty headlines
* lisp/org.el (org-get-heading): Ensure that return value is always
  a string.
* testing/lisp/test-org.el (test-org/get-heading): Add tests.

Reported-by: Joe Schafer <joesmoe10@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/108559>
2016-07-30 22:30:19 +02:00
Nicolas Goaziou 6277246a74 test-ob: Fix test
* testing/lisp/test-ob.el (test-ob/multi-line-header-arguments): Fix test.
2016-07-25 16:14:17 +02:00
Nicolas Goaziou 14c51bae5f org-test: Require cl-lib in interactive tests
* testing/org-test.el: Require `cl-lib'.  Remove support for Emacs 22.
(org-test-string-exact-match): Fix docstring.
2016-07-25 16:11:51 +02:00
Nicolas Goaziou 72461eaeaf Use `string-match-p' instead of `org-string-match-p'
* contrib/lisp/org-contacts.el (org-contacts-filter):
(org-contacts-complete-group):
(org-contacts-complete-tags-props):
* contrib/lisp/org-wl.el (org-wl-open):
* contrib/lisp/ox-bibtex.el (org-bibtex-merge-contiguous-citations):
* lisp/ob-core.el (org-babel-demarcate-block):
* lisp/ob-processing.el (org-babel-processing-view-sketch):
* lisp/ob-stan.el (org-babel-execute:stan):
* lisp/org-agenda.el (org-agenda-get-category-icon):
* lisp/org-clock.el (org-clock-into-drawer):
* lisp/org-element.el (org-element-link-parser):
* lisp/org-lint.el (org-lint-orphaned-affiliated-keywords):
(org-lint-invalid-babel-call-block):
(org-lint-colon-in-name):
* lisp/org-list.el (org-list-item-body-column):
* lisp/org-macro.el (org-macro-replace-all):
* lisp/org-plot.el (org-plot/gnuplot-script):
* lisp/org-table.el (org-table-export):
(org-table-align):
(org-table-get-range):
(org-table-recalculate):
(org-table-expand-lhs-ranges):
(org-table-formula-substitute-names):
(org-table-show-reference):
(orgtbl-to-texinfo):
(org-table-remote-reference-indirection):
* lisp/org.el (org-make-link-string):
(org--open-elisp-link):
(org-open-at-point):
(org-store-log-note):
(org-cached-entry-get):
(org--valid-property-p):
(org-entry-properties):
(org-buffer-property-keys):
(org-insert-drawer):
(org-display-inline-images):
(org-in-commented-heading-p):
* lisp/ox-ascii.el (org-ascii-keyword):
* lisp/ox-beamer.el (org-beamer--format-frame):
* lisp/ox-html.el (org-html-keyword):
* lisp/ox-latex.el (org-latex--label):
(org-latex-headline):
(org-latex-item):
(org-latex-keyword):
(org-latex--inline-image):
(org-latex-src-block):
* lisp/ox-odt.el (org-odt-styles-dir):
(org-odt-keyword):
(org-odt--translate-latex-fragments):
* lisp/ox-texinfo.el (org-texinfo-template):
(org-texinfo-keyword):
(org-texinfo-src-block):
* lisp/ox.el (org-export-inline-image-p):
(org-export-file-uri):
* testing/lisp/test-org-table.el (test-org-table/to-generic):
(test-org-table/to-latex):
(test-org-table/to-html):
(test-org-table/named-field):
(test-org-table/named-column):
(test-org-table/tab-indent):
(test-org-table/first-rc):
(test-org-table/last-rc): Use `string-match-p' instead of
`org-string-match-p'.
2016-07-25 15:21:12 +02:00
Nicolas Goaziou 47138a986e org-table: Fix calculations with locale specific time-stamps
* lisp/org-table.el (org-table-eval-formula): Fix calculations with
  locale specific time-stamps.
* testing/lisp/test-org-table.el (test-org-table/time-stamps): New test.

Reported-by: "Ulrich J. Herter" <ujh@posteo.de>
<http://permalink.gmane.org/gmane.emacs.orgmode/108165>
2016-07-21 11:49:15 +02:00
John Kitchin 9bc2940034 Create `org-link-parameters'
* lisp/org-element.el: Replace `org-link-types' variable with
  `org-link-types' function.

* lisp/org.el: Replace the `org-link-types' variable with
  `org-link-types' function. Create `org-link-get-parameter' and
  `org-link-set-parameters' functions. Remove `org-add-link-type'. Add
  `org-store-link-functions' function and remove
  `org-store-link-functions' variable. Add `org--open-file-link' for use
  as a :follow function for file type links.

* lisp/org.el: Set :follow functions for file links in `org-link-parameters.
Define `org-open-file-link' that opens a file link with an app.

* testing/lisp/test-ox.el: Remove usage of the `org-link-types'
  variable.

* lisp/org-compat.el: Move `org-add-link-type' and mark it as obsolete.

* lisp/ox.el: Change org-add-link-type comment in ox.el.
2016-07-18 22:47:42 +02:00
Nicolas Goaziou 610ec90cf4 Move `org-toggle-item' in "org-list.el"
* lisp/org.el (org-toggle-item): Move function ...
* lisp/org-list.el (org-toggle-item): ... here.

* testing/lisp/test-org-list.el (test-org-list/toggle-item): New test.
2016-07-04 23:52:40 +02:00
Nicolas Goaziou f38f83b4f1 Remove deprecated syntax for Babel properties
* doc/org.texi (Header arguments in Org mode properties): Remove
  reference to deprecated syntax.
* lisp/ob-core.el (org-babel-params-from-properties): Ignore deprecated
  syntax.
* testing/examples/babel.org:
* testing/examples/normal.org:
* testing/examples/ob-header-arg-defaults.org:
* testing/examples/property-inheritance.org:
* testing/lisp/test-ob-header-arg-defaults.el
(test-ob-header-arg-defaults/global/noweb):
(test-ob-header-arg-defaults/global/call):
(test-ob-header-arg-defaults/tree/overwrite/call):
(test-ob-header-arg-defaults/tree/overwrite/noweb):
(test-ob-header-arg-defaults/tree/accumulate/call):
(test-ob-header-arg-defaults/tree/accumulate/noweb):
(test-ob-header-arg-defaults/tree/complex/call):
(test-ob-header-arg-defaults/tree/complex/noweb):
* testing/lisp/test-ob.el (test-ob/elisp-in-header-arguments):
* testing/lisp/test-property-inheritance.el
(test-org-property-accumulation-overwrite-use): Update syntax.
(test-org-property-accumulation-append-use): Use new syntax.
(test-org-property-accumulation-top-val)
(test-org-property-accumulation-overwrite-val)
(test-org-property-accumulation-append-val): Remove tests.
2016-07-04 00:41:56 +02:00
Nicolas Goaziou adcaf91648 Mark `org-link-escape-browser' as obsolete
* lisp/org-compat.el (org-link-escape-browser): Make function an alias
  for `url-encode-url'.
* lisp/org.el (org-link-escape-chars-browser): Remove variable.
(org-link-escape-browser): Remove function.
(org-open-at-point):
* lisp/ox-html.el (org-html-link): Use `url-encode-url'.
* testing/lisp/test-org.el(test-org/org-link-escape-chars-browser):
  Remove test.
2016-07-01 12:00:23 +02:00
Nicolas Goaziou f0ff257fa7 Merge branch 'maint' 2016-06-28 00:31:09 +02:00
Nicolas Goaziou 07de65e1ea ox: Small fix
* lisp/ox.el (org-export--missing-definitions): Fix typo and remove
  useless comment
* testing/lisp/test-ox.el (test-org-export/footnotes): Add test.
2016-06-28 00:28:47 +02:00
Nicolas Goaziou 8285ff4cf2 Merge branch 'maint' 2016-06-28 00:24:50 +02:00
Nicolas Goaziou 5e37a5c116 ox: Fix export of footnote definitions in pruned parts of tree
* lisp/ox.el (org-export--missing-definitions):
(org-export--install-footnote-definitions): New functions
(org-export--merge-external-footnote-definitions): Remove function
(org-export-as):
(org-export--prune-tree): Use new functions.
* testing/lisp/test-ox.el (test-org-export/footnotes): Add tests.

Reported-by: Mark Edgington <edgimar@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/107940>
2016-06-27 23:57:42 +02:00
Michael Brand 994e9ebf0b Update testing/README
* testing/README: Minor update, add how to run several tests.
2016-06-25 17:08:23 +02:00
Michael Brand 4b2aa43ce6 ERT: Spreadsheet references more sensitive
* testing/lisp/test-org-table.el:
(test-org-table/org-table-convert-refs-to-an/1):
(test-org-table/org-table-convert-refs-to-rc/1): Row and column number
different.
2016-06-25 17:06:12 +02:00
Nicolas Goaziou 411524a31c Merge branch 'maint' 2016-06-22 22:38:07 +02:00
Nicolas Goaziou 85dd02b0dd ox: Fix export of empty footnote definitions outside scope
* lisp/ox.el (org-export-get-footnote-definition): When a definition is
  empty, but does exist, return the empty string instead of raising an
  error.
* testing/lisp/test-ox.el (test-org-export/get-footnote-definition): New
  test.

Reported-by: Mark Edgington <edgimar@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/107873>
2016-06-22 22:34:53 +02:00
Nicolas Goaziou 4f63cfabb3 Deprecate `org-babel-trim' in favor of `org-trim'
* lisp/org.el (org-trim): Add optional argument.

* contrib/lisp/ob-mathematica.el (org-babel-execute:mathematica):
* contrib/lisp/org-bibtex-extras.el (obe-html-export-citations):
* contrib/lisp/org-mime.el (org-mime-compose):
* lisp/ob-C.el (org-babel-C-execute):
* lisp/ob-calc.el (org-babel-execute:calc):
* lisp/ob-clojure.el (org-babel-expand-body:clojure):
* lisp/ob-core.el (org-babel-initiate-session):
(org-babel-parse-multiple-vars):
(org-babel-read-element):
(org-babel-insert-result):
(org-babel-expand-noweb-references):
(org-babel-trim): Mark obsolete.
* lisp/ob-forth.el (org-babel-forth-session-execute):
* lisp/ob-fortran.el (org-babel-execute:fortran):
* lisp/ob-haskell.el (org-babel-execute:haskell):
* lisp/ob-latex.el (org-babel-expand-body:latex):
* lisp/ob-lisp.el (org-babel-expand-body:lisp):
* lisp/ob-ocaml.el (org-babel-execute:ocaml):
* lisp/ob-octave.el (org-babel-octave-evaluate-session):
* lisp/ob-python.el (org-babel-python-evaluate-external-process):
(org-babel-python-evaluate-session):
* lisp/ob-ref.el (org-babel-ref-split-args):
* lisp/ob-ruby.el (org-babel-ruby-evaluate):
* lisp/ob-shell.el (org-babel-sh-evaluate):
* lisp/ob-table.el (org-sbe):
* lisp/ob-tangle.el (org-babel-spec-to-string):
* lisp/org-bibtex.el (org-bibtex-get):
* testing/lisp/test-ob.el (test-ob/parse-header-args): Use `org-trim'
  instead of `org-babel-trim'.
2016-06-21 15:33:00 +02:00
Nicolas Goaziou cfaf0d54d7 ox: Remove `org-export-execute-babel-code'
* lisp/ox.el (org-export-execute-babel-code): Remove function.
(org-export-as): Replace previous function with
`org-babel-exp-process-buffer'.
* lisp/ob-exp.el (org-babel-exp-process-buffer): Change signature.
  Copy buffer before evaluating code.

* testing/lisp/test-ob-exp.el (ob-exp/exports-inline-code):
(ob-exp/exports-inline-code-double-eval):
(ob-exp/exports-inline-code-eval-code-once):
(ob-exp/exports-inline-code-double-eval-exports-both):
(ob-export/export-with-results-before-block):
(ob-export/export-src-block-with-switches):
(ob-export/export-src-block-with-flags):
(ob-export/export-and-indentation):
(ob-export/export-under-commented-headline):
(ob-export/reference-in-post-header):
(ob-export/babel-evaluate):
(org-test-with-expanded-babel-code):
* testing/lisp/test-ob-lob.el (test-ob-lob/export-lob-lines):
(test-ob-lob/do-not-eval-lob-lines-in-example-blocks-on-export): Apply
change.

This patch merges `org-export-execute-babel-code' within
`org-babel-exp-process-buffer', removing one level of indirection.  Now,
all the Babel evaluation is on the Babel side.
2016-06-18 22:11:14 +02:00
Nicolas Goaziou ee7ca3cc43 org-list: Allow multiple receiver locations for radio lists
* lisp/org-list.el (org-list-send-list): Allow multiple receiver
  locations.
* testing/lisp/test-org-list.el (test-org-list/send-list): Add test.
2016-06-17 10:19:07 +02:00
Nicolas Goaziou 3781a3dbbd org-table: Allow multiple receiver locations for radio tables
* lisp/org-table.el (orgtbl-send-replace-tbl): Allow multiple receiver
  locations.
* testing/lisp/test-org-table.el (test-org-table/send-region): Add test.
2016-06-17 10:05:40 +02:00
Nicolas Goaziou c3b42e917f ob: Remove `org-babel-lob-execute'
* lisp/ob-lob.el (org-babel-lob-execute): Remove function
(org-babel-lob-execute-maybe):
* lisp/ob-ref.el (org-babel-ref-resolve):
* testing/lisp/test-ob-header-arg-defaults.el (test-ob-header-arg-defaults/global/call):
(test-ob-header-arg-defaults/tree/overwrite/call):
(test-ob-header-arg-defaults/tree/accumulate/call):
(test-ob-header-arg-defaults/tree/complex/call):
* testing/lisp/test-ob-lob.el (test-ob-lob/named-caching-call-line):
(test-ob-lob/caching-call-line):
(test-ob-lob/call-with-header-arguments): Apply removal.
2016-06-16 23:37:40 +02:00
Nicolas Goaziou dbb375fdfc Simplify Babel calls evaluation
* lisp/ob-lob.el (org-babel-default-lob-header-args): Merge value with
  `org-babel-default-header-args' since this variable is meant to
  replace the latter.
(org-babel-lob-ingest): Make sure `org-babel-default-lob-header-args' is
used instead of `org-babel-default-header-args'.
(org-babel-lob--src-info): New function.
(org-babel-lob-get-info): Use new function.  Make return value
a replacement for `org-babel-get-src-block-info'.
(org-babel-lob-execute): Use `org-babel-execute-src-block' instead of
duplicating functionalities.
* lisp/ob-exp.el (org-babel-exp-process-buffer): Apply changes to
  `org-babel-lob-get-info' return value.

* testing/examples/ob-header-arg-defaults.org:
* testing/lisp/test-ob-header-arg-defaults.el (test-ob-header-arg-defaults/tree/accumulate/call):
(test-ob-header-arg-defaults/tree/complex/call):
(test-ob-header-arg-defaults/tree/overwrite/call):
* testing/lisp/test-ob-lob.el (test-ob-lob/caching-call-line):
(test-ob-lob/named-caching-call-line): Update tests.

The purpose of this commit is to make Babel calls more
predictable (e.g., wrt property inheritance) and to remove code
duplication.  Also, Babel calls results are no longer treated as Emacs
Lisp values.
2016-06-16 23:15:01 +02:00
Marco Wahl 613b27795b Follow compiler recommendation
* testing/org-test.el (org-test-load): Switch to the seasonable
  `cl-flet'.
2016-06-14 21:26:11 +02:00
Charles Berry dd944fb590 org-babel-goto-named-src-block bugfix
* lisp/ob-core.el (org-babel-goto-named-src-block): The user prompt
  (i.e. `initial-input' arg of `completing-read') will be the name of
  the results block, noweb reference, call reference, or symbol if
  point is in such.

* testing/lisp/test-ob.el (test-ob/goto-named-src-block): Simulate
  interactive use of `org-babel-goto-named-src-block'.
2016-06-14 09:40:35 -07:00
Nicolas Goaziou 65e4370d46 Merge branch 'maint' 2016-06-11 13:40:52 +02:00
Nicolas Goaziou c792d694b7 Fix typo in test
* testing/lisp/test-org.el (test-org/deadline-close): Fix typo.
2016-06-11 13:36:45 +02:00
Nicolas Goaziou 819cdb3a09 Preserve list visibility when inserting a new item
* lisp/org.el (org-insert-heading): Do not reveal gratuitously too much
  context before inserting an item.
* testing/lisp/test-org.el (test-org/insert-heading): Add test.

Reported-by: Steinar Bang <sb@dod.no>
<http://permalink.gmane.org/gmane.emacs.orgmode/107665>
2016-06-11 13:33:50 +02:00
Nicolas Goaziou 0603f42cb7 org-element: Fix inline src blocks parameter syntax
* lisp/org-element.el (org-element--parse-paired-brackets): New function.
(org-element-inline-babel-call-parser):
(org-element-inline-src-block-parser): Use new function.

* testing/lisp/test-org-element.el (test-org-element/inline-src-block-parser):
Add test.

Reported-by: Charles Millar <millarc@verizon.net>
<http://permalink.gmane.org/gmane.emacs.orgmode/107629>
2016-06-10 23:42:50 +02:00
Marco Wahl 7e57cf5d40 org: Fix tags extraction
* lisp/org.el (org-get-tags-at): Use non-greedy match up to colon to
  match all tags (and not just the last.)
* testing/lisp/test-org.el (test-org/tags-at): One test to cover the
  issue.
2016-06-09 10:06:14 +02:00
Nicolas Goaziou 480d3523bc org-element: Fix failing test
* testing/lisp/test-org-element.el (test-org-element/link-parser): Fix
  failing test.  The bug was introduced in 827413e.
2016-06-04 21:48:02 +02:00
Nicolas Goaziou daa11e13de Fix a test 2016-06-04 21:27:55 +02:00
Nicolas Goaziou 827413ef2f Silence byte-compiler in "testing/" 2016-06-04 21:12:30 +02:00
Don March bd49486db9 Make today's deadlines "close" without lead time
* lisp/org.el (org-deadline-close): A timestamp is close if the days
  between now and the timestamp are less then or equal to the days of
  lead time.

* testing/lisp/test-org.el: Add tests for org-deadline-close.
2016-06-04 20:45:41 +02:00
Don March 42620c1efa Rename org-deadline-is-close to have -p suffix
* lisp/org-agenda.el
  (org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item):
* lisp/org.el (org-deadline-close): Rename to...
  (org-deadline-close-p): ...this.

* testing/lisp/test-org.el (test-org/deadline-close): Rename to...
  (test-org/deadline-close-p): ...this.
2016-06-04 20:39:15 +02:00
Don March 43b5ca1626 Make today's deadlines "close" without lead time
* lisp/org.el (org-deadline-close): A timestamp is close if the days
  between now and the timestamp are less then or equal to the days of
  lead time.

* testing/lisp/test-org.el: Add tests for org-deadline-close.
2016-06-04 20:39:15 +02:00
Nicolas Goaziou 3fd361eb77 Merge branch 'maint' 2016-06-02 13:33:34 +02:00
Yasushi SHOJI 5111c3a5fa Add tests for tag width calculation
* testing/lisp/test-org.el (test-org/tag-align): New test.
2016-06-02 13:31:54 +02:00
Nicolas Goaziou ecf20715e2 Merge branch 'maint' 2016-06-01 14:54:20 +02:00
Nicolas Goaziou 1f3d72e8b4 Fix TODO case-sensitivity in `org-get-heading'
* lisp/org.el (org-get-heading): Prevent removing false-positive TODO
  keywords due to case-insensitivity.
* testing/lisp/test-org.el (test-org/get-heading): New test.
2016-06-01 14:49:59 +02:00
Nicolas Goaziou 11d6ebc60f Fix `org-in-regexp'
* lisp/org.el (org-in-regexp): Fix VISUALLY optional argument.  Also
  prevent useless searches past the point.  Improve docstring.

* testing/lisp/test-org.el (test-org/in-regexp): New test.
2016-05-31 23:34:14 +02:00
Nicolas Goaziou 21ba5f510e Refuse to follow link right after the link
* lisp/org.el (org-open-at-point):
(org-return): Refuse to follow link right after the link.

* testing/lisp/test-org.el (test-org/return): Add tests.
(test-org/coderef):
(test-org/custom-id):
(test-org/fuzzy-links): Update tests.

Reported-by: "Stefan-W. Hahn" <stefan.hahn@s-hahn.de>
<http://permalink.gmane.org/gmane.emacs.orgmode/102054>
2016-05-31 23:34:00 +02:00
Nicolas Goaziou 0ac099a6f8 Remove final parts of XEmacs compatibility code
* lisp/org-compat.el: Declare `org-add-hook', `org-decompose-region',
  `org-detach-overlay', `org-file-equal-p', `org-float-time',
  `org-indent-line-to', `org-indent-to-column', `org-looking-at-p',
  `org-looking-back', `org-propertize', `org-re' and
  `org-select-frame-set-input-focus' as obsolete.
(org-overlay-display, org-overlay-before-string, org-find-overlays):
Move to "org.el"
(org-xemacs-key-equivalents, org-xemacs-p): Remove variables.
(org-region-active-p): Drop XEmacs support.
(org-xemacs-without-invisibility): Remove macro.
(org-get-x-clipboard-compat): Remove function.
* lisp/org-macs.el (org-match-string-no-properties): Remove function.

* lisp/ob-core.el:
* lisp/org-agenda.el:
* lisp/org-archive.el:
* lisp/org-clock.el:
* lisp/org-colview.el:
* lisp/org-crypt.el:
* lisp/org-element.el:
* lisp/org-faces.el:
* lisp/org-feed.el:
* lisp/org-footnote.el:
* lisp/org-habit.el:
* lisp/org-id.el:
* lisp/org-indent.el:
* lisp/org-inlinetask.el:
* lisp/org-lint.el:
* lisp/org-list.el:
* lisp/org-mouse.el:
* lisp/org-pcomplete.el:
* lisp/org-src.el:
* lisp/org-table.el:
* lisp/org-timer.el:
* lisp/org.el:
* lisp/ox-ascii.el:
* lisp/ox-odt.el:
* lisp/ox.el:
* contrib/lisp/org-notify.el:
* contrib/lisp/ox-taskjuggler.el:
* contrib/lisp/org-wikinodes.el:
* testing/lisp/test-org-src.el:
* testing/lisp/test-org.el: Silence byte-compiler.
2016-05-26 13:56:25 +02:00
Nicolas Goaziou 96cfef229d ox: Small refactoring
* lisp/ox.el (org-export-get-loc): Refactor code.  Speed-up processing
  when the element doesn't require line numbering.
* testing/lisp/test-ox.el (test-org-gen-loc-list): Reformat code.
2016-05-24 21:40:43 +02:00
Brian Carlson af8e3d84ee ox: Provide offset to [+-]n in SRC/EXAMPLE export
* lisp/org-element.el (org-element-example-block-parser): Use cons cell
  for :number-lines specifying offset in addition to type (new/continue).
  ('continue . offset) for :number-lines will add this offset count to
  the last line number. ('new . offset) for :number-lines will reset the
  line number counting starting at offset
(org-element-src-block-parser): same for SRC block as EXAMPLE block

* lisp/ox-html.el (org-html-format-code):
* lisp/ox-latex.el (org-latex-src-block):
* lisp/ox-odt.el (org-odt-format-code):
* lisp/ox.el (org-export-resolve-coderef):
(org-export-get-loc):
(org-export-format-code-default):
* contrib/lisp/ox-groff.el (org-groff-src-block): Use new cons cell
  for :number-lines.

* testing/lisp/test-ox.el  (ert-deftest test-org-export/get-loc): Tests for
changes
(test-org-gen-loc-list): Helper function for `test-org-export/get-loc'.
2016-05-24 21:40:35 +02:00
Nicolas Goaziou 0a98500363 Fix `org-open-at-point' tests
* testing/lisp/test-org.el (test-org/open-at-point-in-keyword):
(test-org/open-at-point-in-property):
(test-org/open-at-point-in-comment):
(test-org/open-at-point/inline-image): Simplify tests so as to not rely
on info.

(test-org/open-at-point/info): Remove test as it fails on the build bot.
2016-05-20 21:59:50 +02:00
Nicolas Goaziou 2d846210eb Implement conditional case-fold search in org-occur
* lisp/org.el (org-occur-case-fold-search): New variable.
(org-occur): Use new variable.

* testing/lisp/test-org.el (test-org/occur): Add tests.
2016-05-20 14:04:04 +02:00
Nicolas Goaziou a540e894b6 org-element: Properly unescape data in export blocks
* lisp/org-element.el (org-element-export-block-parser): Remove commas
  in export blocks.
* testing/lisp/test-org-element.el (test-org-element/export-block-parser):
  Add test.
2016-05-13 17:55:30 +02:00
Nicolas Goaziou b687cf37a5 Merge branch 'maint' 2016-05-11 18:46:28 +02:00
Nicolas Goaziou ee5d40b001 org-clock: Fix `org-clock-drawer-name'
* lisp/org-clock.el (org-clock-drawer-name): When
  `org-clock-into-drawer' is a number and `org-log-into-drawer' is t,
  default to "LOGBOOK".

* testing/lisp/test-org-clock.el (test-org-clock/into-drawer):
(test-org-clock/drawer-name): New tests.
2016-05-11 18:44:02 +02:00
Nicolas Goaziou 8127b3c30d Merge branch 'maint' 2016-05-05 13:15:34 +02:00
Nicolas Goaziou 83e373f109 Fix `org-occur' when regexp matches a single char
* lisp/org.el (org-occur): Fix infloop when regexp matches a single
  char.  Improve docstring.

(org-check-before-date):
(org-check-after-date):
(org-check-dates-range): Match correct object since point may be at the
beginning of the next one.

* testing/lisp/test-org.el (test-org/occur): New test.
2016-05-05 12:59:46 +02:00
Nicolas Goaziou 590cb1227a Merge branch 'maint' 2016-05-01 01:30:57 +02:00
Nicolas Goaziou af853dd3aa Fix `org-flag-drawer' with optional argument
* lisp/org.el (org-flag-drawer): Do not require point to be at a drawer
  in order to call the function with an optional argument.

* testing/lisp/test-org.el (test-org/flag-drawer): Narrow test.
2016-05-01 01:27:30 +02:00
Nicolas Goaziou bb034dfe04 `org-show-context' always displays point
* lisp/org.el (org-show-set-visibility): Always show point, even when it
  is hidden in a block or a drawer.

* testing/lisp/test-org.el (test-org/show-set-visibility): Add tests.

Reported-by: Derek Feichtinger <dfeich@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/106744>
2016-05-01 01:14:10 +02:00
Nicolas Goaziou ec615b192d Fix `org-export-babel-evaluate' handling
* lisp/ob-exp.el (org-babel-exp-process-buffer): Handle
  `org-export-babel-evaluate' handling.
(org-babel-exp-results): Ignore `org-export-babel-evaluate' since it is
handled as a higher level.

* lisp/ox.el (org-export-as): Allow to short-circuit babel evaluation if
  `org-export-babel-evaluate' is nil.

* testing/lisp/test-ob-exp.el (ob-export/babel-evaluate): New test.

Reported-by: Nicolas Richard <nrichard@ulb.ac.be>
<http://permalink.gmane.org/gmane.emacs.orgmode/106767>
2016-04-28 17:29:14 +02:00
Nicolas Goaziou bbf5b455c6 Fix failing test
* testing/lisp/test-ox.el (test-org-export/get-reference): Fix failing
  test.
2016-04-28 16:55:24 +02:00
Nicolas Goaziou 1daac70fc5 Merge branch 'maint' 2016-04-26 21:03:45 +02:00
Nicolas Goaziou e818699113 Fix storing links to headlines containing multiple links
* lisp/org.el (org-store-link): Fix storing links to headlines
  containing multiple links.

* testing/lisp/test-org.el (test-org/store-link): New test.

Reported-by: Georgiy Tugai <georgiy.tugai@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/106606>
2016-04-26 20:59:33 +02:00
Nicolas Goaziou 4743d43dd8 Properly handle `org-tag-persistent-alist'
* lisp/org.el (org-current-tag-alist): New variable.
(org-set-tags):
(org-global-tags-completion-table):
(org-agenda-prepare-buffers): Use new variable.
(org-set-regexps-and-options): Use new variable.  Handle STARTUP early
so that "#+STARTUP: noptag" is taken into consideration.

* lisp/org-agenda.el (org-agenda-bulk-action): Use new variable.

* lisp/org-mobile.el (org-mobile-create-index-file): `org-tag-alist' is
  no longer buffer-local.

* testing/lisp/test-org.el (test-org/set-regexps-and-options): Add
  tests.
2016-04-18 18:07:40 +02:00
Nicolas Goaziou 74d3bd484f Factorize tags parsing
* lisp/org.el (org-tag-string-to-alist):
(org-tag-alist-to-string):
(org-tag-alist-to-groups): New functions.
(org-set-regexps-and-options): Use new functions.

(org--setup-process-tags): Remove function.

(org--setup-collect-keywords): Return tag groups as a string instead of
a list so as to be compatible with new functions.

* lisp/org-mobile.el (org-mobile-create-index-file): Use new functions.

* lisp/org-pcomplete.el (pcomplete/org-mode/file-option/tags): Use new
  functions.
(pcomplete/org-mode/tag): Small refactoring.

* testing/lisp/test-org.el (test-org/tag-string-to-alist):
(test-org/tag-alist-to-string):
(test-org/tag-alist-to-groups): New tests.
2016-04-18 17:40:15 +02:00
Nicolas Goaziou 716e339c96 Allow angular links within link descriptions
* lisp/org-element.el (org-element-object-restrictions):
(org-element--object-lex): Allow angular links as equivalent to plain
links in description.

* testing/lisp/test-org-element.el (test-org-element/link-parser): Add
  test.
2016-04-06 11:08:53 +02:00
Nicolas Goaziou ff236e5c85 Merge branch 'maint' 2016-03-30 15:36:16 +02:00
Nicolas Goaziou 954103dd9b Fix indentation bug
* lisp/org.el (org--get-expected-indentation): Return correct columns
  when at the end of an empty item.
* testing/lisp/test-org.el (test-org/indent-line): Add test.
2016-03-30 15:34:24 +02:00
Nicolas Goaziou 6f543959ed Merge branch 'maint' 2016-03-26 00:20:47 +01:00
Nicolas Goaziou a737f20ca4 org-table: Add tests
* testing/lisp/test-org-table.el (test-org-table/eval-formula):
(test-org-table/last-rc): New tests.
(test-org-table/first-rc): Add tests.
2016-03-26 00:20:08 +01:00
Nicolas Goaziou 0fd7fd072e Merge branch 'maint' 2016-03-24 14:00:44 +01:00
Nicolas Goaziou a5623bc502 org-table: Fix LaTeX snippets in radio tables
* lisp/org-table.el (orgtbl-to-generic): Call back-end specific filters.
* testing/lisp/test-org-table.el (test-org-table/to-latex): Add test.

Reported-by: Uwe Brauer <oub@mat.ucm.es>
<http://permalink.gmane.org/gmane.emacs.orgmode/105876>
2016-03-24 13:59:29 +01:00
Nicolas Goaziou 0ccdceeb87 Merge branch 'maint' 2016-03-17 17:15:53 +01:00
Nicolas Goaziou 6f439a29b1 Remove failing test
* testing/lisp/test-ox.el (test-org-export/activate-smart-quotes):
  Comment out failing test.
2016-03-17 17:15:17 +01:00
Nicolas Goaziou bf40aba6cd Merge branch 'maint' 2016-03-17 16:51:43 +01:00
Nicolas Goaziou 261eadb9d4 Fix indentation bug
* lisp/org.el (org--get-expected-indentation): Fix indentation.
* testing/lisp/test-org.el (test-org/indent-line): Add test.
2016-03-17 16:50:54 +01:00
Nicolas Goaziou 1d781b3365 Use Babel cache when exporting src blocks
* lisp/ob-core.el (org-babel-process-params): Normalize return value.
* testing/lisp/test-ob.el (test-ob/process-params-no-duplicates): Fix
  test.
2016-03-17 00:23:02 +01:00
Nicolas Goaziou 5135540ba7 Fix failing test
* testing/lisp/test-org-element.el (test-org-element/inline-src-block-parser):
  Fix failing test.
2016-03-16 18:17:50 +01:00
Nicolas Goaziou dcfe011998 org-element: Fix inline src block parsing
* lisp/org-element.el (org-element--pair-curly-table): Fix typo.
* testing/lisp/test-org-element.el (test-org-element/inline-src-block-parser):
Add tests.

Reported-by: William Denton <wtd@pobox.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/105748>
2016-03-16 18:15:39 +01:00
Nicolas Goaziou 32c3f33d00 ox: Use a new scheme for internal references
* lisp/ox.el (org-export-get-reference): Use randomly generated labels.
(org-export-new-reference):
(org-export-format-reference): New functions.

* testing/lisp/test-ox.el (test-org-export/get-reference): New test.

The new scheme is better when datum type cannot be known ahead of time
or when references are not created sequentially, e.g., during
a publishing process where a reference to a file can be require before
the file is published.
2016-03-12 23:18:55 +01:00
Nicolas Goaziou 6ec06dcff9 ox: Abstract fuzzy link searches with search cells
* lisp/ox.el (org-export-search-cells):
(org-export-string-to-search-cell):
(org-export-match-search-cell-p): New functions.

(org-export-resolve-fuzzy-link): Use new functions.

* testing/lisp/test-ox.el (test-org-export/fuzzy-link): Tiny
  refactoring.
(test-org-export/resolve-fuzzy-link): Fix failing test.
2016-03-12 23:18:55 +01:00
Nicolas Goaziou 0b59a5994e Merge branch 'maint' 2016-03-10 10:11:24 +01:00
Nicolas Goaziou 5a735b0b80 ox: Fix smart quotes within tables
* lisp/ox.el (org-export--smart-quote-status): Handle smart quotes
  within objects.

* testing/lisp/test-ox.el (test-org-export/activate-smart-quotes): Add
  tests.

Reported-by: Philipp Middendorf <pmi@hacon.de>
<http://permalink.gmane.org/gmane.emacs.orgmode/105586>
2016-03-10 10:10:29 +01:00
Nicolas Goaziou 194b754597 Merge branch 'maint' 2016-03-01 01:06:02 +01:00
Nicolas Goaziou 105a446697 Fix return value for `org-get-outline-path'
* lisp/org.el (org--get-outline-path-1): Replace links with their
description, or path, in addition to removing statistics cookies.
(org-get-outline-path): Add an optional argument to include current
headline in path.
(org-refile-get-targets): Make use of new argument.  Remove call to
`org-link-display-format', which is now handled in
`org--get-outline-path-1'.

* testing/lisp/test-org.el (test-org/get-outline-path): Add tests.

Reported-by: Tobias Getzner <tobias.getzner@gmx.de>
<http://permalink.gmane.org/gmane.emacs.orgmode/105425>
2016-03-01 01:01:07 +01:00
Nicolas Goaziou cec775fa06 Merge branch 'maint' 2016-02-29 16:27:19 +01:00
Nicolas Goaziou 2971ab6126 Fix `org-get-outline-path'
* lisp/org.el (org--get-outline-path-1): Fix wrong type arrayp error
  when trying to get the outline path of an empty headline.
* testing/lisp/test-org.el (test-org/get-outline-path): Add test.

Reported-by: Tobias Getzner <tobias.getzner@gmx.de>
<http://permalink.gmane.org/gmane.emacs.orgmode/105407>
2016-02-29 16:25:24 +01:00
Nicolas Goaziou ae0d9fbb09 org-footnote: Handle un-referenced definitions
* lisp/org-footnote.el (org-footnote-sort):
(org-footnote-normalize): Insert un-referenced definitions upon sorting.

* testing/lisp/test-org-footnote.el (test-org-footnote/sort):
(test-org-footnote/normalize): Add tests.
2016-02-27 16:05:35 +01:00
Nicolas Goaziou 07e514b58b org-colview: Fix :id in columnview
* lisp/org-colview.el (org-dblock-write:columnview): Fix typo in pcase
  so ID are properly recognized in current document.

* testing/lisp/test-org-colview.el (test-org-colview/dblock): Add tests.
2016-02-27 09:25:01 +01:00
Nicolas Goaziou 0f3cb188a9 ob-core: Fix Invalid search bound (wrong side of point)
* lisp/ob-core.el (org-babel-where-is-src-block-result): Return nil when
  anonymous results would be located outside of the container of the
  source block.

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

Reported-by: Dominik Schrempf <dominik.schrempf@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/105309>
2016-02-25 14:53:00 +01:00
Nicolas Goaziou 2db95a7755 Merge branch 'maint' 2016-02-25 14:41:08 +01:00
Nicolas Goaziou 66fbceb727 Fix `org-refile-get-targets'
* lisp/org.el (org-refile-get-targets): Fix bug when using
  `org-refile-target-verify-function'.  Improve speed.

(org-olpa): Remove variable.
(org-outline-path-cache): New variable.

(org--get-outline-path-1): New function.
(org-get-outline-path): Use new function.  This fixes return value when
cache is used and calls are not in the same path.

* testing/lisp/test-org.el (test-org/get-outline-path): New test.

Reported-by: Florian Adamsky <fa-org-mode@haktar.org>
<http://permalink.gmane.org/gmane.emacs.orgmode/104829>
2016-02-25 14:32:57 +01:00
Nicolas Goaziou 41d005822e Fix indentation bug
* lisp/org.el (org--get-expected-indentation): Fix indentation bug.
* testing/lisp/test-org.el (test-org/indent-line): Add test.

In the following document, the last line would be indented to "|"

- item

  #+BEGIN_SRC emacs-lisp
    (+ 1 1)
  #+END_SRC
    |
2016-02-24 20:58:55 +01:00
Nicolas Goaziou 099d84c76d org-colview: Fix editing values altering headings
* lisp/org-colview.el (org-columns-edit-value):
(org-columns-next-allowed-value): Make sure overlays are still in place
when a property altering current headline is modified.  Refactor code.
Do not limit allowed values to 10.

* testing/lisp/test-org-colview.el (test-org-colview/columns-next-allowed-value):
New test.
2016-02-23 22:32:47 +01:00
Nicolas Goaziou a4ad618f62 org-colview: Fix `org-columns-view' and `org-columns-edit-value'
* lisp/org-colview.el (org-columns-new): Change signature to allow both
  editing and column creation non-interactively.
(org-columns-edit-attributes): Use new signature.
* testing/lisp/test-org-colview.el (test-org-colview/columns-new):
  Update tests.
2016-02-23 17:36:48 +01:00
Nicolas Goaziou acef7d8a43 org-colview: Do not compute values swapping columns
* lisp/org-colview.el (org-columns-move-right): Do not compute values
  swapping columns.  Comment about a corner case.

* testing/lisp/test-org-colview.el (test-org-colview/columns-move-left):
(test-org-colview/columns-move-right): New tests.
2016-02-23 17:36:41 +01:00
Nicolas Goaziou 14d81d38e0 org-colview: Fix columns format extraction
* lisp/org-colview.el (org-columns-get-format): Do not assume
  `org-columns-default-format' contains valid columns format.  Look for
  COLUMNS keyword if necessary.
(org-columns-quit): Reset `org-columns-current-fmt'.
(org-columns-redo): Provide `org-columns-current-fmt' as the active
format so as to avoid extracting it again.

* testing/lisp/test-org-colview.el (test-org-colview/get-format): New
  test.
2016-02-23 15:20:02 +01:00
Nicolas Goaziou 24033e3c67 Move `org-edit-headline'
* lisp/org-colview.el (org-edit-headline): Move from here...
* lisp/org.el (org-edit-headline): ... to here.  Also refactor code.
  Accept to set headline non-interactively.

* testing/lisp/test-org.el (test-org/edit-headline): New test.
2016-02-23 14:07:32 +01:00
Nicolas Goaziou 7c0618b04d org-colview: Fix COLUMNS keyword update
* lisp/org-colview.el (org-columns-store-format): Make sure we're really
  at a COLUMNS keyword before replacing it.  Also replace only the first
  one, not all of them.

* testing/lisp/test-org-colview.el (test-org-colview/columns-new): Add
  tests.
2016-02-23 13:18:38 +01:00
Nicolas Goaziou de439a68c8 org-colview: Allow multiple summaries for a single property
* lisp/org-colview.el (org-columns--collect-values):
(org-agenda-colview-summarize): Use column format specification as the
  unique identifier for the returned alist.

* lisp/org-colview.el (org-columns--display-here): Store column format
  specification in a new overlay property.

(org-columns--set-widths):
(org-columns--display-here): Use column format specification instead of
(org-columns--displayed-value): Since the same property can have
multiple titles, use column specification instead of property as keys.

(org-columns--collect-values): Apply signature change.

(org-columns-update): Handle multiple columns for the same property.
Also apply signature change to `org-columns--displayed-value'.

(org-columns--compute-spec): New function.
(org-columns-compute):
(org-columns-compute-all): Use new function.

* testing/lisp/test-org-colview.el (test-org-colview/columns-summary):
(test-org-colview/columns-update): Add tests.

* doc/org.texi (Column attributes): Document computation with multiple
  summary types for a given property.
2016-02-23 13:18:34 +01:00
Nicolas Goaziou 9dfe3d8079 org-colview: Make `org-columns-current-maxwidths' a vector
* lisp/org-colview.el (org-columns-current-maxwidths): Update docstring.
(org-columns--autowidth-alist): Rename to...
(org-columns--set-widths): ... this.
(org-columns--display-here):
(org-columns--display-here-title):
(org-columns-widen):
(org-columns-update): Use new type.

(org-columns):
(org-agenda-columns): Apply renaming.

* testing/lisp/test-org-colview.el (test-org-colview/columns-width):
  Update test.
2016-02-22 22:15:13 +01:00
Nicolas Goaziou ebf7bbb308 org-colview: Store properties in upper case
* lisp/org-colview.el (org-columns-compile-format): Property is
  upper-cased.  Title is not, however.
(org-columns--displayed-value):
(org-columns--collect-values):
(org-columns--autowidth-alist):
(org-columns--overlay-text):
(org-columns--display-here):
(org-columns--display-here-title):
(org-columns-next-allowed-value):
(org-columns):
(org-columns-widen):
(org-columns-update):
(org-columns--capture-view):
(org-dblock-write:columnview):
(org-agenda-colview-summarize): Since properties in compiled format are
upper-cased, remove the `upcase' or `assoc-string' dance.

* testing/lisp/test-org-colview.el (test-org-colview/columns-new):
(test-org-colview/columns-update): Add case-sensitivity tests.

`assoc-string' is still necessary in functions where property is
provided by the user, e.g. `org-columns-update'.
2016-02-22 22:15:13 +01:00
Nicolas Goaziou 2b3c72e231 org-colview: Fix failing test
* lisp/org-colview.el (org-columns-new): Tiny refactoring.
* testing/lisp/test-org-colview.el (test-org-colview/columns-new): Fix
  typo in test.
2016-02-21 20:21:48 +01:00
Nicolas Goaziou b386089ee6 org-colview: Fix `org-columns-new'
* lisp/org-colview.el (org-columns-new): Fix location of inserted
  column.  Properly handle non-interactive cases.
* testing/lisp/test-org-colview.el (test-org-colview/columns-new): New
  test.
2016-02-21 14:59:52 +01:00
Nicolas Goaziou fedd6be97a org-colview: Introduce custom summary types
* lisp/org-colview.el (org-columns-summary-types): New variable.
(org-columns-compile-map): Rename into...
(org-columns-summary-types-default): ... this.

(org-columns-new):
(org-columns-compile-format): Use new variables.

* testing/lisp/test-org-colview.el (test-org-colview/columns-summary):
  Add test.

* doc/org.texi (Column attributes): Document new variable.  Improve
  description of time and age based summary types.
2016-02-21 00:44:17 +01:00
Nicolas Goaziou 15101fe7a6 org-colview: Remove now useless functions
* lisp/org-colview.el (org-columns-number-to-string):
(org-columns-string-to-number): Remove functions.

(org-columns--displayed-value): Apply removal.

* lisp/org.el (org-entry-properties): Ditto.

* testing/lisp/test-org-colview.el (test-org-colview/columns-summary):
  Ditto.
2016-02-21 00:44:17 +01:00
Nicolas Goaziou 58d387661a org-colview: Rationalize summary process
* lisp/org-colview.el (org-columns-compile-map): Externalize summary
  functions.  Remove "none" summary.
(org-columns-new): Apply previous removal.

(org-columns--fractional-duration-re): Rename variable to...
(org-columns--duration-re): ... this.

(org-columns-compute): Change how values are computed.  This is now done
in one pass.  A summarize function is given a list of strings and
possible a format string.  It has to return the computed value as
a string.

(org-columns--time-to-seconds):
(org-columns--age-to-seconds):
(org-columns--summary-apply-times):
(org-columns--summary-sum):
(org-columns--summary-currencies):
(org-columns--summary-checkbox):
(org-columns--summary-checkbox-count):
(org-columns--summary-checkbox-percent):
(org-columns--summary-min):
(org-columns--summary-max):
(org-columns--summary-mean):
(org-columns--summary-sum-times):
(org-columns--summary-min-time):
(org-columns--summary-max-time):
(org-columns--summary-mean-time):
(org-columns--summary-min-age):
(org-columns--summary-max-age):
(org-columns--summary-mean-age): New functions.

(org-columns--summary-estimate):
(org-agenda-colview-summarize): Update functions to new process.

(org-columns-string-to-number): Apply variable renaming.

* testing/lisp/test-org-colview.el (test-org-colview/columns-summary):
  Fix test.  Add some more.
2016-02-21 00:44:17 +01:00
Nicolas Goaziou d59d96efaa org-colview: Ignore "fmt" format property
* lisp/org-colview.el (org-columns--displayed-value):
(org-columns-next-allowed-value):
(org-columns-new):
(org-columns-compute):
(org-columns-number-to-string):
(org-columns-string-to-number):
(org-columns-uncompile-format):
(org-columns-compile-format):
(org-agenda-colview-summarize):
(org-agenda-colview-compute): Ignore "fmt" property.  Use "op" instead.

* lisp/org.el (org-entry-properties): Ditto.

* testing/lisp/test-org-colview.el (test-org-colview/columns-summary):
  Ditto.
2016-02-21 00:44:17 +01:00
Nicolas Goaziou 027681c352 Fix typo
* testing/lisp/test-ob.el (test-ob/results-in-narrowed-buffer): Fix
  typo.
2016-02-19 23:58:01 +01:00
Nicolas Goaziou a4a6d65c4b ob-core: Fix inline results
* lisp/ob-core.el (org-babel-where-is-src-block-result): Find results
  for inline src-blocks or inline babel call not located on a subsequent
  line, e.g., because of filling.
(org-babel-insert-result): When inline results exist, replace them
in-place.
(org-babel-remove-inline-result): Also remove results not located on the
same line as the source code.
(org-babel-examplify-region): Change signature.  Properly mark inline
results at the beginning of a line.

* testing/lisp/test-ob.el (test-ob/inline-src_blk-default-results-replace-line-1):
Add tests.
2016-02-18 23:17:15 +01:00
Nicolas Goaziou 62ec8c0a48 org-colview: Fix `org-columns-compute' with inlinetasks
* lisp/org-colview.el (org-columns-compute): Properly summarize values
  obtained through inline tasks.

* testing/lisp/test-org-colview.el (test-org-colview/columns-update):
  Add test.

Previously, the summary of values from inline tasks was added to to the
summary of values from children.
2016-02-18 11:40:17 +01:00
Nicolas Goaziou 9e3090a5a0 org-colview: Fix `org-columns-update'
* lisp/org-colview.el (org-columns--overlay-text): New function.
(org-columns--display-here): Use new function.
(org-columns-update): Properly handle additional decorations to
displayed values (e.g., ellipses).

* testing/lisp/test-org-colview.el (test-org-colview/columns-update):
  New test.
2016-02-17 22:49:19 +01:00
Nicolas Goaziou c158bf2f16 org-colview: Refactor low-high estimates
* lisp/org-colview.el (org-columns-string-to-number):
(org-columns-number-to-string): Handle estimates.

(org-columns-estimate-combine): Rename this to...
(org-columns--estimate-combine): ... this.

(org-columns-compile-map):
(org-columns-compute): Apply renaming.

(org-estimate-mean-and-var):
(org-estimate-print):
(org-string-to-estimate): Remove functions.

* testing/lisp/test-org-colview.el (test-org-colview/columns-summary):
  Add tests.
2016-02-17 22:49:19 +01:00
Nicolas Goaziou 923f512ee4 org-colview: Add tests
* testing/lisp/test-org-colview.el (test-org-colview/columns-summary):
  New test.
2016-02-17 22:49:19 +01:00
Nicolas Goaziou d14d14b479 org-colview: Add tests
* testing/lisp/test-org-colview.el: New file.
2016-02-17 22:49:19 +01:00
Erik Hetzner c56ff1071d org-attach: Fix git annex test directories
* testing/lisp/test-org-attach-annex.el: `default-directory' should end
  in a slash to function properly. This was causing test failures on
  older versions of git-annex.
2016-02-16 21:40:37 +01:00
Erik Hetzner a4cfd3343a org-attach: Prevent test fails on systems without git-annex
* testing/lisp/test-org-attach-annex.el: Move all org-attach tests that
  use git-annex to this file, which can test for the presence of
  git-annex. Prevents tests failing on systems where git-annex is not
  installed.
2016-02-14 12:14:24 +01:00
Nicolas Goaziou 5d817df125 Merge branch 'maint' 2016-02-11 09:50:55 +01:00
Nicolas Goaziou 9f737bdf14 org-element: Fix search failed error in `org-element-context'
* lisp/org-element.el (org-element-context): Make sure point is on tag
  line before searching for it.

* testing/lisp/test-org-element.el (test-org-element/context): Add test.
  Small refactoring.

Reported-by: Kaushal Modi <kaushal.modi@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/105018>
2016-02-11 09:47:54 +01:00
Nicolas Goaziou 867263c207 ob: Remove `org-babel-get-inline-src-block-matches'
* lisp/ob-core.el (org-babel-get-inline-src-block-matches): Remove
  function.
(org-babel-when-in-src-block):
(org-babel-insert-result): Do not use removed function.

(org-babel-remove-inline-result): Add an optional argument for a tiny
speed-up.

* testing/examples/babel.org:
* testing/lisp/test-ob.el (test-ob/inline-src_blk-default-results-replace-line-1):
  Remove needless tests.
2016-02-10 23:50:45 +01:00
Nicolas Goaziou 9738da4732 ob: Rewrite `org-babel-get-src-block-info' using parser
* lisp/ob-core.el (org-babel-get-src-block-info): Rewrite function.
  Change signature.
(org-babel-parse-src-block-match):
(org-babel-parse-inline-src-block-match): Remove functions.
(org-babel-execute-src-block): Remove useless function call.

* lisp/ob-exp.el (org-babel-exp-process-buffer): Make use of signature
  change.
(org-babel-exp-results): Use new return value from
`org-babel-get-src-block-info'.  Tiny refactoring.

* testing/lisp/test-ob.el (test-ob/nested-code-block): Fix test.
* contrib/lisp/org-eldoc.el (org-eldoc-get-src-lang): Use parser instead
  of removed function.

* testing/examples/babel.org: Fix test environment.
2016-02-10 23:50:45 +01:00
Nicolas Goaziou 33aeec4a61 Remove `org-babel-in-example-or-verbatim'
* lisp/ob-exp.el (org-babel-in-example-or-verbatim): Remove function.

* testing/lisp/test-ob.el (test-ob/combining-scalar-and-raw-result-types):
Update test.

This function is unused and inaccurate.  If needed, the parser should be
used instead.
2016-02-10 23:50:45 +01:00
Nicolas Goaziou e079c02016 Fix `org-babel-where-is-src-block-result'
* lisp/ob-core.el (org-babel--insert-results-keyword):
(org-babel--clear-results-maybe): New functions.
(org-babel-where-is-src-block-result): Rewrite function.  Improve
accuracy, in particular when RESULTS is not the closest affiliated
keyword from the results.

* testing/lisp/test-ob.el (test-ob/where-is-src-block-result): New test.
2016-02-10 23:50:19 +01:00
Nicolas Goaziou 9e8c968bff Replace TBLNAME with NAME in tests
* testing/examples/ob-C-test.org:
* testing/examples/ob-fortran-test.org:
* testing/examples/ob-maxima-test.org:
* testing/lisp/test-ob-python.el (test-ob-python/colnames-yes-header-argument-again):
(test-ob-python/colnames-no-header-argument-again):
* testing/lisp/test-ob.el (test-ob/do-not-resolve-to-partial-names-data):
  Use NAME instead of TBLNAME.

TBLNAME is deprecated syntax since Org 8.
2016-02-10 15:40:11 +01:00
Nicolas Goaziou ec04d27bc2 Fix some tests' prefix
* testing/lisp/test-ob.el (test-ob/indented-cached-org-bracket-link):
(test-ob/multi-line-header-regexp):
(test-ob/src-block-regexp):
(test-ob/default-inline-header-args):
(test-ob/get-src-block-info-language):
(test-ob/get-src-block-info-body):
(test-ob/get-src-block-info-tangle):
(test-ob/elisp-in-header-arguments):
(test-ob/simple-named-code-block):
(test-ob/simple-variable-resolution):
(test-ob/multi-line-header-arguments):
(test-ob/parse-header-args):
(test-ob/parse-header-args2):
(test-ob/inline-src-blocks):
(test-ob/org-babel-get-inline-src-block-matches):
(test-ob/inline-src_blk-default-results-replace-line-1):
(test-ob/inline-src_blk-default-results-replace-line-2):
(test-ob/inline-src_blk-manual-results-replace):
(test-ob/inline-src_blk-results-silent):
(test-ob/inline-src_blk-results-raw):
(test-ob/inline-src_blk-results-file):
(test-ob/inline-src_blk-results-scalar):
(test-ob/inline-src_blk-results-verbatim):
(test-ob/combining-scalar-and-raw-result-types):
(test-ob/no-defaut-value-for-var):
(test-ob/just-one-results-block):
(test-ob/nested-code-block):
(test-ob/partial-nested-code-block):
(test-ob/inline-src_blk-preceded-punct-preceded-by-point):
(test-ob/file-ext-and-output-dir):
(test-ob/script-escape):
(test-ob/process-params-no-duplicates):
(test-ob/check-eval): Use "test-ob" instead of "test-org-babel".
2016-02-10 15:40:11 +01:00
Nicolas Goaziou 7fcc1c710b ob-core: Prevent false positive in `org-find-named-result'
* lisp/ob-core.el (org-babel-find-named-result): Prevent false positive
  using parser.
(org-babel-current-result-hash):
(org-babel-set-current-result-hash):
(org-babel-where-is-src-block-result): Do not rely on some undocumented
match data.

* testing/lisp/test-ob.el (test-ob/find-name-result): New test.
2016-02-10 15:40:11 +01:00
Nicolas Goaziou 44e45d5284 Parse inline src blocks and babel calls with newlines
* lisp/org-element.el (org-element--pair-round-table):
(org-element--pair-curly-table): New variables.
(org-element-inline-babel-call-parser):
(org-element-inline-src-block-parser): Allow newline characters in
contents and parameters.

* testing/lisp/test-org-element.el (test-org-element/inline-babel-call-parser):
(test-org-element/inline-src-block-parser): Add test.
2016-02-10 15:40:10 +01:00
Nicolas Goaziou 111905ff84 org-element: Do not alter indentation upon parsing
* lisp/org-element.el (org-element-src-block-parser):
(org-element-example-block-parser): Do not remove any indentation when
  parsing the element.
* testing/lisp/test-org-element.el (test-org-element/src-block-parser):
* testing/lisp/test-org-element.el (test-org-element/src-block-parser):
  Update test.

Properly handling indentation requires knowing about
`org-src-preserve-indentation''s value.  This is out of the scope of the
parser.
2016-02-09 23:23:31 +01:00
Erik Hetzner 5040718945 org-attach.el: Get attachments from git annex
* org-attach.el (org-attach-use-annex): New function to check if git
  annex should be used.
  (org-attach-annex-get-maybe): New function to get a file from git
  annex if necessary.
  (org-attach-annex-auto-get): New defcustom to determine behavior
  of org-attach-annex-get-maybe.
  (org-attach-open): Automatically get attached files from git annex when
  opening if necessary.
* testing/lisp/test-org-annex.el: New file for testing org-attach. Only
  contains code for testing org-attach with git annex at the moment.
* mk/targets.mk: Fix cleantest target so it can delete git annex repos.
2016-02-06 13:17:33 +01:00
Nicolas Goaziou 00f0c70418 Special property "ITEM" contains headline without stars
* lisp/org.el (org-entry-properties): "ITEM" contains headline without
  stars.
* lisp/org-colview.el (org-columns-display-here): Apply changes.
* doc/org.texi (Special properties): Update documentation.
* testing/lisp/test-org.el (test-org/entry-properties): Update tests.
2016-02-04 23:06:03 +01:00
Kyle Meyer e44524b3b2 Merge branch 'maint' 2016-02-03 23:37:26 -05:00
Kyle Meyer 2fc29a1796 Fix "it's" typos
* lisp/ob-C.el (org-babel-expand-body:cpp):
(org-babel-expand-body:C++):
(org-babel-expand-body:D):
(org-babel-expand-body:C):
(org-babel-C-expand-C++):
(org-babel-C-expand-C):
(org-babel-C-expand-D):
* lisp/ob-exp.el (org-babel-exp-src-block):
* lisp/ob-fortran.el (org-babel-expand-body:fortran):
* testing/org-test.el (org-test-buffer):
Correct "it's" typo in docstring.

* doc/org.texi:
Correct "it's" typos.
2016-02-03 23:33:28 -05:00
Nicolas Goaziou 06e144adef Merge branch 'maint' 2016-01-31 20:47:06 +01:00
Nicolas Goaziou 67efff2fd8 ob-tangle: Fix `org-babel-tangle-jump-to-org'
* lisp/ob-tangle.el (org-babel-tangle-jump-to-org): Find correct
  location in the Org document.

* testing/lisp/test-ob-tangle.el (ob-tangle/jump-to-org): New test.
2016-01-31 20:38:35 +01:00
Nicolas Goaziou 7d6b8f51ec ob: Fix `org-babel-update-block-body'
* lisp/ob-core.el (org-babel-update-block-body): Correctly handle block
  indentation.
(org-babel-where-is-src-block-head): Accept an optional argument in
order to avoid parsing twice the same element.

* testing/lisp/test-ob.el (org-test-ob/update-block-body): New test.
2016-01-31 20:38:35 +01:00
Michael Brand b4105b430c org-table: Fix ranges in `orgtbl-ascii-draw'
* lisp/org-table.el (orgtbl-ascii-draw): Fix float to integer
  conversion.
* testing/lisp/test-org-table.el (test-org-table/orgtbl-ascii-draw):
  Adapt test.
2016-01-30 16:30:52 +01:00
Michael Brand 6b03fd9a86 org-table: Add test for `orgtbl-ascii-draw'
* testing/lisp/test-org-table.el (test-org-table/orgtbl-ascii-draw):
  New test.
2016-01-30 16:29:14 +01:00
Nicolas Goaziou f8c5c4825e Merge branch 'maint' 2016-01-29 00:53:58 +01:00
Nicolas Goaziou 9ab973d0a6 org-macro: Fix expansion in narrowed buffers
* lisp/org-macro.el (org-macro-replace-all): Expand macro even outside
  narrowed part of the buffer.

* testing/lisp/test-org-macro.el (test-org/macro-replace-all): Add test.

Reported-by: Kaushal Modi <kaushal.modi@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/104562>
2016-01-29 00:52:49 +01:00
Nicolas Goaziou 4c2b52bd8b org-element: Do not remove TAB characters from parsed text
* lisp/org-element.el (org-element--parse-objects): Do not remove TAB
  characters from plain text.
(org-element-normalize-contents): Handle TAB characters in indentation.

* testing/lisp/test-org-element.el (test-org-element/normalize-contents):
Update test.
2016-01-26 22:53:55 +01:00
Charles Berry 27b590c395 testing/lisp/test-ob-R.el: Initialize ESS vars for :session tests
* test-ob-R.el: (test-ob-R/simple-session, test-ob-R/results-file)
  tests start sessions.  As a consequence `ess-ask-for-ess-directory'
  and `ess-history-file' are let bound to `nil' to avoid prompting for
  the startup directory and using a history file.

Bug Reported by: Achim Gratz
Subject: [Bug] Testing: ESS (*R*, R (newest)) starting data directory?
Archived-At: <http://permalink.gmane.org/gmane.emacs.orgmode/104424>
2016-01-24 10:08:31 -08:00
Charles Berry 3142d139fa ob-R.el: Trim extraneous newline from results
* lisp/ob-R.el: org-babel-R-evaluate-external-process and
  org-babel-R-evaluate-session trim the extraneous newlines from the
  end of R output.

* testing/lisp/test-ob-R.el: test-ob-R/results-file tests that
  `:results file' yields one line enclosed in square brackets for a
  result like "abc/def.ghi".

Fixes issue noted by Andreas Leha
Subject: [babel] return file from R
Archived-At: <http://permalink.gmane.org/gmane.emacs.orgmode/103658>
2016-01-19 20:10:43 -08:00
Nicolas Goaziou 1c8ed102e9 Merge branch 'maint' 2016-01-16 14:53:48 +01:00
Nicolas Goaziou 6e57a371ff Fix tags looking like plain links
* lisp/org-element.el (org-element-context): Do not look for objects
  within TODO keyword, priority cookie, comment keyword or tags.
* lisp/org.el (org-activate-tags): Fix regexp.

* testing/lisp/test-org-element.el (test-org-element/context): Add test.

Reported-by: John Kitchin <jkitchin@andrew.cmu.edu>
2016-01-16 14:50:25 +01:00
Nicolas Goaziou d85ff34086 Merge branch 'maint' 2016-01-14 09:41:22 +01:00
Nicolas Goaziou 7d0104f449 org-element: Fix footnote definition parsing
* lisp/org-element.el (org-element--footnote-separator): New variable.
(org-element-footnote-definition-parser): Handle footnotes with
affiliated keywords.

* testing/lisp/test-org-element.el (test-org-element/footnote-definition-parser):
Add test.
2016-01-14 09:40:43 +01:00
Nicolas Goaziou 6baece62fc org-feed: Fix failing test
testing/lisp/test-org-feed.el (test-org-feed/fill-template): Fix test
when called from an environment with another locale.
2016-01-13 17:08:58 +01:00
Nicolas Goaziou 2520fd654a Test `org-map-entries'
* lisp/org.el (org-make-tags-matcher): Small refactoring.
* testing/lisp/test-org.el (test-org/map-entries): New test.
2016-01-13 17:03:46 +01:00
Michael Brand 531985d21c Add ERTs for feed templates
* testing/lisp/test-org-capture.el (test-org-capture/fill-template):
  Strengthen some expectations, add new tests.

* testing/lisp/test-org-feed.el: New file derived from
  testing/lisp/test-org-capture.el.
2016-01-13 08:19:23 +01:00
Kyle Meyer 6345de2d05 Merge branch 'maint' 2016-01-09 17:43:27 -05:00
Kyle Meyer 6bc48c5f41 Update copyright years 2016-01-09 17:12:03 -05:00
Nicolas Goaziou 93c52908b6 Merge branch 'maint' 2016-01-06 14:46:36 +01:00
Nicolas Goaziou 22cf1bf7ed Throw an error when trying to set invalid properties
* lisp/org.el (org--valid-property-p): New function.
(org-entry-put):
(org-set-property): Use new function.

Suggested-by: Julien Cubizolles <j.cubizolles@free.fr>
<http://permalink.gmane.org/gmane.emacs.orgmode/104044>
2016-01-06 14:45:52 +01:00
Nicolas Goaziou 5e63baf92e Merge branch 'maint' 2016-01-02 17:06:53 +01:00
Nicolas Goaziou 59f00529d4 Update copyright years 2016-01-02 17:06:30 +01:00
Nicolas Goaziou e2ac979d9e ob-tangle: Fix commented links
* lisp/ob-tangle.el (org-babel-spec-to-string):
(org-babel-tangle-collect-blocks): Fix numbering and relative path of
commented links.

* testing/lisp/test-ob-tangle.el (ob-tangle/comment-links-numbering):
  New test.

Reported-by: Tobias Müller <mllertobias@gmx.de>
<http://permalink.gmane.org/gmane.emacs.orgmode/103861>
2016-01-02 17:05:00 +01:00
Nicolas Goaziou 3694450320 Fix copyright years 2016-01-02 13:36:44 +01:00
Nicolas Goaziou ad83f31318 org-pcomplete: Fix keyword and block completion
* lisp/org-pcomplete.el (pcomplete/org-mode/file-option): Apply removal
  of `org-element-block-name-alist'.
2016-01-02 13:35:58 +01:00
Nicolas Goaziou 7dc6748452 Fix export blocks
* lisp/org-element.el (org-element-export-block-parser): Type is always
  stored in capitals.

* testing/lisp/test-ox.el (test-org-export/export-block): Add test.

Reported-by: Suvayu Ali <fatkasuvayu+linux@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/103921>
2016-01-02 11:53:24 +01:00
Nicolas Goaziou 7a4803d3ac Fix failing test
* testing/lisp/test-org-datetree.el (test-org-datetree/find-iso-week-create):
  Fix failing test.
2015-12-29 22:45:14 +01:00
Rüdiger Sonderfeld 316bc89c02 org-datetree.el: Add support for ISO week trees
* lisp/org-datetree.el (org-datetree-find-iso-date-create): New function.
(org-datetree--find-create): Support fixed text for insert.
(org-datetree-insert-line): Support fixed text for insert.
* testing/lisp/test-org-datetree.el (test-org-datetree/find-iso-date-create):
New test.

ISO week trees order dates by week and not by month.
2015-12-29 21:57:54 +01:00
Rüdiger Sonderfeld 9c382e6cf6 org-datetree.el: Code cleanup
* lisp/org-datetree.el (org-datetree--find-create): New function.
(org-datetree-find-year-create, org-datetree-find-month-create,
org-datetree-find-day-create): Removed functions
(org-datetree-find-date-create): Use `org-datetree--find-create' instead
of removed functions.  Use calendar extract functions.
(org-datetree-insert-line): Do more formatting in `format-time-string'
since we call it anyway
* testing/lisp/test-org-datetree.el (test-org-datetree/find-date-create):
  Test if new entries are put at the right place.
2015-12-29 21:57:50 +01:00
Alexey Lebedeff aca68e64bc Fix property name completion
* lisp/org-pcomplete.el (pcomplete/org-mode/prop): Add
  `ignore-malformed' argument in call to `org-buffer-property-keys'

* lisp/org.el (org-buffer-property-keys): Add support for new argument
  `ignore-malformed'.

* testing/lisp/test-org-pcomplete.el: Add new file for testing
  `pcomplete' integration.

* testing/lisp/test-org.el (test-org/buffer-property-keys): Test
  behaviour of `org-buffer-property-keys' with new `ignore-malformed'
  argument.

When property name completion is being performed, it means that we are
inside malformed property drawer that will become valid only after
successful completion. In this case in makes no sense to perform
interactive drawer repair.
2015-12-29 21:53:56 +01:00
Nicolas Goaziou 8eb318f2d0 org-footnote: Update library wrt new footnote syntax
* lisp/org-footnote.el (org-footnote-re):
(org-footnote-definition-re): Do not match [1]-like constructs.

(org-footnote): Fix typo.

(org-footnote-auto-label): Do not offer to create [1]-like constructs
anymore.

(org-footnote-new): Remove reference to obsolete value in
`org-footnote-auto-label'.

(org-footnote-at-reference-p):
(org-footnote-get-next-reference):
(org-footnote-next-reference-or-definition):
(org-footnote-goto-definition):
(org-footnote-goto-previous-reference): Use new regexp.

(org-footnote-normalize-label): Remove "fn:" prefix instead of adding
it.

(org-footnote-get-definition):
(org-footnote-all-labels):
(org-footnote-unique-label): Small refactoring.

(org-footnote-create-definition):
(org-footnote-delete-definitions):

(org-footnote--clear-footnote-section):
(org-footnote--collect-references):
(org-footnote--collect-definitions):
(org-footnote--set-label):
(org-footnote-sort): New functions.

(org-footnote-auto-adjust-maybe):
(org-footnote-action): Use new functions.  Small refactoring.

(org-footnote-renumber-fn:N): Refactor code.  Handle nested footnotes.

(org-footnote-normalize): Turn footnotes into [fn:N] construct instead
of [N].
* testing/lisp/test-org-footnote.el (test-org-footnote/delete):

(test-org-footnote/goto-definition):
(test-org-footnote/normalize): Update test

(test-org-footnote/sort):
(test-org-footnote/renumber-fn:N): New tests.

(test-org-footnote/normalize-outside-org): Remove test.
2015-12-22 16:55:17 +01:00
Nicolas Goaziou deafe56554 org-element: Ignore plain footnotes
* lisp/org-element.el (org-element--set-regexps):
(org-element-footnote-definition-interpreter):
(org-element-footnote-reference-parser):
(org-element-footnote-reference-interpreter): Do not consider [1]-like
constructs as footnotes anymore.

* lisp/ox.el (org-export-expand-include-keyword):
(org-export--prepare-file-contents): Apply changes to footnotes.

* doc/org.texi (Footnotes): Remove references to plain footnotes.

* testing/lisp/test-org-element.el (test-org-element/footnote-reference-parser):
(test-org-element/footnote-reference-interpreter):
* testing/lisp/test-ox.el (test-org-export/expand-include):
(test-org-export/expand-macro):
(test-org-export/get-footnote-number):
(test-org-export/collect-footnote-definitions):
(test-org-export/footnotes):
(test-org-export/fuzzy-link): Update tests.

Since it is possible to refer unambiguously to a label without the "fn:"
prefix, the latter becomes part of the syntax and no longer part of the
label.  In particular [fn:1] and [fn:label] are labelled, respectively,
"1" and "label".
2015-12-22 16:55:17 +01:00
Sacha Chua 25eb14bc2c org-protocol: Allow key=val&key2=val2-style URLs
* lisp/org-protocol.el: Update documentation.
  (org-protocol-store-link, org-protocol-capture,
  org-protocol-open-source): Accept new-style links.
  (org-protocol-check-filename-for-protocol): Update documentation.
  (org-protocol-parse-parameters, org-protocol-assign-parameters):
  New functions.

  This allows the use of org-protocol on KDE 5 and makes org-protocol
  links more URI-like.  New-style links are of the form:
  org-protocol://store-link?title=TITLE&url=URL

* testing/lisp/test-org-protocol.el: New file.
2015-12-22 13:41:45 +01:00
Nicolas Goaziou 54318add34 Change export block syntax
* lisp/org-element.el (org-element-export-block-parser):
(org-element--current-element): Use new syntax for export blocks.
(org-element-block-name-alist): Remove.

* lisp/ox.el (org-export-register-backend):
(org-export-define-derived-backend): Remove :export-block keyword from
back-end's definition.
(org-export-expand-include-keyword): Use new syntax for include
keywords.

* lisp/ox-ascii.el (ascii):
* lisp/ox-beamer.el (beamer):
* lisp/ox-html.el (html):
* lisp/ox-latex.el (latex):
(org-latex-prefer-user-labels):
* lisp/ox-man.el (man):
* lisp/ox-md.el (md):
* lisp/ox-odt.el (odt):
* lisp/ox-texinfo.el (texinfo): Propagate changes to "ox.el".

* lisp/ob-core.el (org-babel-insert-result):
* lisp/ob-haskell.el (org-babel-haskell-export-to-lhs): Use new syntax.

* lisp/org.el (org-structure-template-alist): Use new syntax.
(org-protecting-blocks): Add "export" to protected blocks.  Remove
  back-ends blocks, which are now special blocks.
(org-fontify-meta-lines-and-blocks-1): Fontify correctly new blocks.

* lisp/org-footnote.el (org-footnote-forbidden-blocks):
* lisp/org-list.el (org-list-forbidden-blocks): Add "export" to
  forbidden blocks.  Remove back-ends blocks, which are now special
  blocks.

* contrib/lisp/ox-extra.el: Update comments.

* testing/lisp/test-org-element.el (test-org-element/export-block-parser):
(test-org-element/export-block-interpreter):
* testing/lisp/test-ob.el (test-ob/org-babel-remove-result--results-html):
(test-ob/org-babel-remove-result--results-latex):
* testing/lisp/test-ox.el (test-org-export/expand-include): Update tests.

Export blocks are explicitly marked as such at the syntax level to
disambiguate their parsing from special blocks.  The new syntax is

  #+BEGIN_EXPORT backend
  ...
  #+END_EXPORT

instead of

  #+BEGIN_backend
  ...
  #+END_backend

As a consequence, =INCLUDE= keywords syntax is modified, e.g.,

  #+INCLUDE: "file.org" HTML

becomes

  #+INCLUDE: "file.org" export html
2015-12-20 21:56:27 +01:00
Nicolas Goaziou babcfaa4eb Merge branch 'maint' 2015-12-18 22:32:26 +01:00
Nicolas Goaziou 713fe873b7 org-table: Fix "$<" constructs in formulas
* lisp/org-table.el (org-table-recalculate): Expand "$<" without
  returning an error.  Small refactoring.

* testing/lisp/test-org-table.el (test-org-table/first-rc): New test.

Reported-by: Stefan Nobis <stefan-ml@snobis.de>
<http://permalink.gmane.org/gmane.emacs.orgmode/103693>
2015-12-18 22:30:41 +01:00
Nicolas Goaziou ce4143e79d Merge branch 'maint' 2015-12-12 00:41:43 +01:00
Nicolas Goaziou 7d1a6777d0 ox: Fix uninterpreted subscript
* lisp/ox.el (org-export--remove-uninterpreted-data-1): Fix
  un-interpreted subscript containing another object.

* testing/lisp/test-ox.el (test-org-export/uninterpreted): Add test.

Reported-by: Yasushi SHOJI <yashi@atmark-techno.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/103553>
2015-12-12 00:38:39 +01:00
Nicolas Goaziou 64aee4692a org-list: Fix sending empty lists
* lisp/org-list.el (org-list--to-generic-item): Fix sending empty lists.

* testing/lisp/test-org-list.el (test-org-list/to-generic): Add test.

Reported-by: Eric Abrahamsen <eric@ericabrahamsen.net>
<http://permalink.gmane.org/gmane.emacs.orgmode/103462>
2015-12-08 18:45:21 +01:00
Nicolas Goaziou 9534b159e8 Merge branch 'maint' 2015-12-04 21:37:18 +01:00
Nicolas Goaziou 06c6ba4ac3 org-table: Fix named fields with TAB-indentation
* lisp/org-table.el (org-table-eval-formula): Properly parse named
  fields when indentation of current line ends with a TAB character.

* testing/lisp/test-org-table.el (test-org-table/tab-indent): New test.

Reported-by: Piotr Gajewski <pg7@outlook.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/103290>
2015-12-04 21:34:40 +01:00
Marco Wahl 54f93be1d0 test-org-inlinetask: Testing inlinetasks
* testing/lisp/test-org-inlinetask.el: New file.  Testing
  `org-inlinetask-goto-end'.
2015-12-04 19:59:52 +01:00
Nicolas Goaziou 11291ffcd0 org-list: Radio lists use Org Export library
* lisp/org-list.el (org-list-to-lisp): New function.
(org-list-parse-list): Mark function obsolete.

(org-list-send-list):
(org-list-to-generic):
(org-list-make-subtree): Use new function.

(org-list-item-trim-br): Remove function.

(org-list-to-generic): Use Org Export library.
(org-list--depth):
(org-list--trailing-newlines):
(org-list--generic-eval):
(org-list--to-generic-plain-list):
(org-list--to-generic-item): New functions.

(org-list-to-latex):
(org-list-to-html):
(org-list-to-texinfo): Apply changes.  Allow parameters.
(org-list-to-subtree): Apply changes.

* lisp/org.el (org-toggle-heading):
* lisp/ob-core.el (org-babel-insert-result): Apply changes.

* doc/org.texi (Radio lists): Update documentation.

* testing/lisp/test-org-list.el (test-org-list/to-generic): New test.
2015-12-03 09:54:49 +01:00
Nicolas Goaziou bd3a2cbf2f org-capture: Prevent recursive evaluation of %(...) placeholders
* lisp/org-capture.el (org-capture-templates): Improve docstring.
(org-capture-fill-template): Prevent recursive evaluation of %(...)
placeholders.  Fix escaping of % character in templates.
* testing/lisp/test-org-capture.el: New file.

Reported-by: Thomas Preindl <thomas.preindl@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/103018>
2015-11-29 16:58:14 +01:00
Nicolas Goaziou bd79085be0 Merge branch 'maint' 2015-11-26 22:57:21 +01:00
Nicolas Goaziou d85ddfba0d org-table: Fix c651e150cc
* lisp/org-table.el (org-table-get-stored-formulas): Correctly detect
  named fields in formulas' LHS.
* testing/lisp/test-org-table.el (test-org-table/named-field):
(test-org-table/named-column): New tests.

Reported-by: "Stefan-W. Hahn" <stefan.hahn@s-hahn.de>
<http://permalink.gmane.org/gmane.emacs.orgmode/103119>
2015-11-26 22:56:06 +01:00
Nicolas Goaziou bd921f0858 Merge branch 'maint' 2015-11-12 11:29:55 +01:00
Nicolas Goaziou 53a4209003 ox: Fix comments removal
* lisp/ox.el (org-export--delete-comments): Preserve document's
  structure when removing comment lines or comment blocks.

* testing/lisp/test-ox.el (test-org-export/comments): New test.

Reported-by: Samuel Wales <samologist@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/102860>
2015-11-12 11:28:13 +01:00
Nicolas Goaziou 64a602e822 Merge branch 'maint' 2015-11-11 00:41:06 +01:00
Nicolas Goaziou 57029084b5 org-table: Fix bug with "$>" reference
* lisp/org-table.el (org-table-analyze): Fix incorrect replacement for
  "$>" reference when the table ends on a hline.
* testing/lisp/test-org-table.el (test-org-table/end-on-hline): New
  test.
2015-11-11 00:37:57 +01:00
Nicolas Goaziou b5b08a7f52 ox: Look for export and noexport tags in FILETAGS
* lisp/ox.el (org-export--selected-trees):
(org-export--skip-p): Check also FILETAGS.
* lisp/ox.el (org-export-get-tags): Also report export and noexport
  tags.

Reported-by: Michael Welle <mwe012008@gmx.net>
<http://permalink.gmane.org/gmane.emacs.orgmode/102754>
2015-11-10 23:38:04 +01:00
Nicolas Goaziou 5204e000e5 ob-lilypond: Fix failing tests
* testing/lisp/test-ob-lilypond.el (ob-lilypond/ly-attempt-to-open-pdf):
(ob-lilypond/ly-attempt-to-play-midi): Fix failing tests due to quote
mismatch in Emacs 25.
2015-11-08 17:31:34 +01:00
Aaron Ecay e4cd3dd22b Remove some home-grown copies of cl-lib functions.
* lisp/org.el (org-count, org-remove-if, org-remove-if-not):
(org-reduce, org-every, org-some): Obsolete, use cl-lib versions
everywhere.
(org-sublist): Reimplement in terms of `cl-subseq'; make obsolete.
2015-11-06 12:50:40 +00:00
Aaron Ecay 4c9b24b4d5 Remove test for `org-babel-get-header' function.
The function was removed in 0d000f5.
2015-11-05 17:04:15 +00:00
Aaron Ecay 40356ae376 babel: convert org-babel-check-confirm-evaluate to defun, add test
* lisp/ob-core.el (org-babel-check-confirm-evaluate): Convert from macro
to function.
(org-babel-check-evaluate):
(org-babel-confirm-evaluate): Adapt to above change.  Convert from
defsubst to defun.
* testing/lisp/test-ob.el (ob/check-eval) New test.
(org-test-babel-confirm-evaluate): New function supporting it.
2015-11-05 15:54:19 +00:00
Nicolas Goaziou 02c7850147 ob: Ignore data in COMMENTed headings
* lisp/ob-core.el (org-babel-read-element): New function.
* lisp/ob-ref.el (org-babel-ref-resolve): Use new function.  Refactor
  code.
(org-babel-ref-at-ref-p): Remove function.

* testing/lisp/test-ob.el (test-ob/ignore-reference-in-commented-headings):
  New test.
* testing/lisp/test-ob.el (test-ob/resolve-code-blocks-before-data-blocks):
  Remove test

The second test is removed because names are expected to be unique.
There is no order to expect when more than one uses the same name.

Reported-by: myq <myqlarson@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/102464>
2015-11-05 15:44:22 +01:00
Nicolas Goaziou 8048973bae ox: Rename `org-export-collect-tree-properties'
* lisp/ox.el (org-export-collect-tree-properties): Remove function.
(org-export--collect-tree-properties): New function.
  Renamed from `org-export-collect-tree-properties'
(org-export-as): Apply renaming.
* testing/lisp/test-ox.el (org-test-with-parsed-data): Apply renaming.
2015-11-05 10:56:59 +01:00
Nicolas Goaziou b414b85a7c ox: Factorize export properties
* lisp/ox.el (org-export-get-environment): Do not handle :back-end
  and :translate-alist.
(org-export--collect-tree-properties): Do not handle :exported-data.
(org-export--get-export-attributes): New function.
(org-export-as): Use new function.

* testing/lisp/test-ox.el (org-test-with-parsed-data): Use new function.
2015-11-05 10:56:42 +01:00
Nicolas Goaziou a87c34cb8d Refuse to follow link right after the link
* lisp/org.el (org-open-at-point):
(org-return): Refuse to follow link right after the link.

* testing/lisp/test-org.el (test-org/return): Add tests.
(test-org/coderef):
(test-org/custom-id):
(test-org/fuzzy-links): Update tests.

Reported-by: "Stefan-W. Hahn" <stefan.hahn@s-hahn.de>
<http://permalink.gmane.org/gmane.emacs.orgmode/102054>
2015-10-31 23:32:47 +01:00
Nicolas Goaziou 11a451ff98 Fix `org-in-regexp'
* lisp/org.el (org-in-regexp): Fix VISUALLY optional argument.  Also
  prevent useless searches past the point.  Improve docstring.

* testing/lisp/test-org.el (test-org/in-regexp): New test.
2015-10-31 23:19:51 +01:00
Kyle Meyer 59468ab2d8 Merge branch 'maint' 2015-10-31 12:49:59 -04:00
Kyle Meyer 59d706219b org-format-outline-path: Ignore nil path elements
* lisp/org.el (org-format-outline-path): Ignore nil path elements.
* testing/lisp/test-org.el (test-org/format-outline-path): Add test.

The PATH argument shouldn't contain a nil item.  However, this didn't
fail before 1c74002, and helm-get-org-candidates-in-file relies on this
behavior, so prevent it from failing now.

Reported-by: Simon Thum <simon.thum@gmx.de>
<http://permalink.gmane.org/gmane.emacs.orgmode/102411>
2015-10-31 12:47:17 -04:00
Aaron Ecay a42b4609c2 Merge branch 'maint' into remove-get-header 2015-10-29 19:21:24 +00:00
Aaron Ecay 54d3032cdc babel: fix header arg duplication
* lisp/ob-core.el (org-babel-process-params): Make idempotent.
* testing/lisp/test-ob.el (ob/process-params-no-duplicates): New test.
2015-10-29 19:10:08 +00:00
Kyle Meyer b9676a2575 Merge branch 'maint' 2015-10-28 01:47:43 -04:00
Kyle Meyer 1c740023f7 Rewrite org-format-outline-path
* lisp/org.el (org-format-outline-path): Avoid out-of-range error when
  the length of PREFIX is greater than the value given for WIDTH.
  Prevent result from extending beyond WIDTH.  Simplify code.
* testing/lisp/test-org.el (test-org/format-outline-path): Add tests.

Reported-by: Simon Thum <simon.thum@gmx.de>
<http://permalink.gmane.org/gmane.emacs.orgmode/102241>
2015-10-28 01:26:16 -04:00
Marco Wahl 5f56a73c77 testing/README: Add hint to existence of 'make test' 2015-10-26 22:30:31 +01:00
Nicolas Goaziou dae03e8790 Fix failing tests
* testing/lisp/test-org.el (test-org/closest-date): Remove tests that no
  longer apply to current code.
2015-10-25 16:50:41 +01:00
Nicolas Goaziou 9f18368311 Add tests for broken links handling
* testing/lisp/test-ox.el (test-org-export/handle-options): Add tests.
2015-10-18 23:02:15 +02:00
Nicolas Goaziou af4e118870 Merge branch 'maint' 2015-10-18 09:49:15 +02:00
Nicolas Goaziou 4e864643bd Fix `org-return-follows-link' on links with emphasis
* lisp/org.el (org-return): Properly follow links when description is
  emphasized.  Also tolerate links and timestamps in otherwise forbidden
  areas (e.g., comments, node properties...), much like
  `org-open-at-point'.

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

Reported-by: Samuel Wales <samologist@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/101977>
2015-10-18 09:48:54 +02:00
Nicolas Goaziou 59761024b1 ox: Add an option to ignore broken links
* lisp/ox.el (org-export-with-broken-links): New variable.
(org-export-options-alist): Add new OPTIONS item.
(org-link-broken): New error type.
(org-export-resolve-coderef):
(org-export-resolve-fuzzy-link):
(org-export-resolve-id-link): Raise appropriate error symbol when a link
cannot be resolved.
(org-export-data): Handle new error type.

* doc/org.texi (Export settings): Document new feature.

* testing/lisp/test-ox.el (test-org-export/resolve-id-link):
(test-org-export/resolve-fuzzy-link):
(test-org-export/resolve-coderef): Update tests.
2015-10-17 14:42:07 +02:00
Nicolas Goaziou 707fbc3778 Merge branch 'maint' 2015-10-16 23:20:57 +02:00
Nicolas Goaziou 9de1ee1b6f org-element: Fix parsing of planning in inline tasks
* lisp/org-element.el (org-element--next-mode): Line following an
  inlinetask can be a planning.
* testing/lisp/test-org-element.el (test-org-element/inlinetask-parser):
  Update test.

Reported-by: Gregor Zattler <telegraph@gmx.net>
<http://permalink.gmane.org/gmane.emacs.orgmode/101958>
2015-10-16 23:19:06 +02:00
Nicolas Goaziou a427098b57 Change `org-agenda-repeating-timestamp-show-all' targets
* lisp/org.el (org-closest-date): Rewrite function with less arguments.
  Improve readability.
(org-time-string-to-absolute): Apply changes to `org-closest-date'.
Improve docstring.

* testing/lisp/test-org.el (test-org/closest-date): New test.

This change implies specific repeaters (i.e., ".+" and "++") are no
longer treated the same as regular one (i.e. "+") wrt
`org-agenda-repeating-timestamp-show-all'.  Indeed, only the latter
represents multiple dates.  The former represent another date only when
TODO state changes, which could then skip some occurrences.

This fixes issue raised at
<http://permalink.gmane.org/gmane.emacs.orgmode/101884> and
<http://article.gmane.org/gmane.emacs.orgmode/26154>.
2015-10-16 18:18:49 +02:00
Nicolas Goaziou 50a18201c7 org-src: Preserve tab characters unrelated to indentation
* lisp/org-src.el (org-edit-src-code): Always preserve tabs not related
  to indentation.

* testing/lisp/test-org-src.el (test-org-src/preserve-tabs): New test.
2015-10-08 18:57:30 +02:00
Nicolas Goaziou 6f2579b4fc Merge branch 'maint' 2015-09-26 00:14:36 +02:00
Nicolas Goaziou fd8a18151a Fix file uri
* lisp/ox.el (org-export-file-uri): Properly expand file uri.

* lisp/org-element.el (org-element-link-parser): Start path with "//"
  when referring to a remote file.

* testing/lisp/test-ox.el (test-org-export/file-uri): Add test.

Reported-by: AW <alexander.willand@t-online.de>
<http://permalink.gmane.org/gmane.emacs.orgmode/101471>
2015-09-26 00:11:42 +02:00
Nicolas Goaziou d4aa7692bd Merge branch 'maint' 2015-09-24 10:19:38 +02:00