Commit Graph

1025 Commits

Author SHA1 Message Date
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 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 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 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
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 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
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 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 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
Kyle Meyer 6bc48c5f41 Update copyright years 2016-01-09 17:12:03 -05: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 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 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 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 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
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 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 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
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 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 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
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 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 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
Richard Hansen 11bba63dc3 fix SETUPFILE pathname expansion with subdirectories
* lisp/org-macro.el (org-macro--collect-macros): cd to the directory
containing the SETUPFILE before recursing so that relative pathnames
in the SETUPFILE are expanded properly.

* lisp/org.el (org--setup-collect-keywords): cd to the directory
containing the SETUPFILE before recursing so that relative pathnames
in the SETUPFILE are expanded properly.

* lisp/ox.el (org-export--get-inbuffer-options,
org-export--list-bound-variables): cd to the directory containing the
SETUPFILE before recursing so that relative pathnames in the SETUPFILE
are expanded properly.

If /path/to/foo.org contains:

    #+SETUPFILE: settings/beamer.org

and /path/to/settings/beamer.org contains:

    #+SETUPFILE: common.org

then we want to read /path/to/settings/common.org, not
/path/to/common.org.

TINYCHANGE
2015-09-24 10:16:04 +02:00
Nicolas Goaziou 6d2ab40719 org-table: Fix radio tables containing macros
* lisp/org-table.el (orgtbl-to-generic): Export macros as-is, even if
  they are undefined.
* testing/lisp/test-org-table.el (test-org-table/to-generic): Add test.

Radio tables are now using a minimal set-up for export.  In particular,
no macro is expanded, and no Babel code is executed.  If any of these is
needed, use `org-export-string-as' or `org-export-region-as' instead.

Reported-by: Mark Edgington <edgimar@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/100621>
2015-09-19 13:25:12 +02:00
Nicolas Goaziou 62dc515ae5 ob-tangle: Fix commenting links at column 0
* lisp/ob-tangle.el (org-babel-spec-to-string): Ignore invisible
  characters when commenting in destination file.

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

Reported-by: Rainer M Krug <Rainer@krugs.de>
<http://permalink.gmane.org/gmane.emacs.orgmode/101002>
2015-09-10 11:12:20 +02:00
Nicolas Goaziou f051d663ab ox: Ignore statistics cookies with stat:nil
* lisp/ox.el (org-export--prune-tree): Fix bug preventing pruning within
  secondary strings.

* testing/lisp/test-ox.el (test-org-export/handle-options): Update test.

Reported-by: Thomas S. Dye <tsd@tsdye.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/100999>
2015-09-10 09:32:58 +02:00
Nicolas Goaziou c708fc0bb8 ox: Fix OPTION keyword parsing
* lisp/ox.el (org-export--parse-option-keyword): Handle multiple
  properties referring to the same option item.

* testing/lisp/test-ox.el (test-org-export/parse-option-keyword): Add
  test.
2015-09-09 22:50:08 +02:00
Nicolas Goaziou a7394224aa ox: Fix footnotes in included files
* lisp/ox.el (org-export--prepare-file-contents): Do not error when
  including multiple footnotes with the same label.

* testing/lisp/test-ox.el (test-org-export/expand-include): Update test.

Reported-by: Leonard Randall <leonard.a.randall@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/100906>
2015-09-06 21:54:57 +02:00
Nicolas Goaziou b0f6c3c251 Fix indentation when altering planning info
* lisp/org.el (org-add-planning-info): Do not remove too much
  indentation when removing a planning line.
* testing/lisp/test-org.el: Add tests.

Reported-by: George McNinch <gmcninch@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/100819>
2015-09-03 23:03:28 +02:00
Nicolas Goaziou d66d6f55e0 ox: Fix smart inner quotes
* lisp/ox.el (org-export--smart-quote-status): Fix inner smart quotes.
* testing/lisp/test-ox.el (test-org-export/activate-smart-quotes): Add
  tests.

Reported-by: "T.F. Torrey" <tftorrey@tftorrey.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/100779>
2015-09-02 21:02:41 +02:00
Nicolas Goaziou 48f009bc9f ox: Fix uninterpreted data in captions
* lisp/ox.el (org-export--remove-uninterpreted-data-1): Handle
  uninterpreted data in captions.

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

Reported-by: Johannes Rainer <johannes.rainer@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/100476>
2015-08-25 14:44:20 +02:00
Nicolas Goaziou 6626dfb30b ob: Fix RESULTS indentation
* lisp/ob-core.el (org-babel-parse-src-block-match): Compute indentation
  taking into consideration tab width.
(org-babel-where-is-src-block-result): Do not assume indentation
consists of white space characters only.

* testing/lisp/test-ob.el (test-ob/preserve-results-indentation): Add
  test.

Reported-by: Jarmo Hurri <jarmo.hurri@iki.fi>
<http://permalink.gmane.org/gmane.emacs.orgmode/100403>
2015-08-23 23:41:56 +02:00
Nicolas Goaziou 949fc352cb org-datetree: Fix DATE_TREE search
* lisp/org-datetree.el (org-datetree-find-date-create): Ignore case and
  discard false positives (e.g., a fake property in an example block).

* testing/lisp/test-org-datetree.el: New file.
2015-08-22 21:40:54 +02:00
Nicolas Goaziou 93b73bd303 Fix translated link
* lisp/org-element.el (org-element-link-parser): Call
  `org-link-translation-function' if required.
(org-element-link-interpreter): Build link from type and path instead of
simply pasting raw value.

* lisp/org.el (org-translate-link): Call parser to extract proper path
  and type.

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

Reported-by: Sergei Nosov <sergei.nosov@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/100227>
2015-08-19 15:22:22 +02:00
Nicolas Goaziou 1abc4887a2 Fix `org-entry-properties' with default priority
* lisp/org.el (org-entry-properties): When no priority is explicitly
  set, report `org-default-priority' instead.

* testing/lisp/test-org.el (test-org/entry-properties): Update test.
2015-08-19 11:12:43 +02:00
Nicolas Goaziou 65ded0c7ed org-footnote: Fix f8c4102cc6
* lisp/org-footnote.el (org-footnote-new): Fix
  f8c4102cc6.

* testing/lisp/test-org-footnote.el (test-org-footnote/new): Add test.
2015-08-14 16:17:18 +02:00
Nicolas Goaziou 8500501984 org-footnote: Fix location after moving to definition
* lisp/org-footnote.el (org-footnote-goto-definition): Move to location
  appropriate for further editing.
* testing/lisp/test-org-footnote.el (test-org-footnote/delete): Update
  test.
2015-08-14 16:15:09 +02:00
Nicolas Goaziou 4dc79cbe9d Fix splitting headlines with RET
* lisp/org.el (org-return): Make sure to keep headline from being
  invalidated by restricting positions where it can be split.

* testing/lisp/test-org.el (test-org/return): Add test.
2015-08-13 02:42:08 +02:00
Alexey Lebedeff 997a9a45d9 Make `org-return' follow links in headings again
* org.el (org-return): Check for links first when
  `org-return-follows-link' is non-nil, before inserting any newlines.

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

This patch restores order in which `org-return' perform actions (which
was changed in a7e62499f2).

TINYCHANGE
2015-08-13 02:25:17 +02:00
Nicolas Goaziou ac0661189e org-list: Fix statistics updating with cookie in sublist
* lisp/org-list.el (org-update-checkbox-count): Properly update
  statistics cookies in a sublist.

* testing/lisp/test-org-list.el (test-org-list/update-checkbox-count):
Add test.

Reported-by: Gerald Wildgruber <Gerald.Wildgruber@unibas.ch>
<http://permalink.gmane.org/gmane.emacs.orgmode/99792>
2015-08-10 23:23:39 +02:00
Nicolas Goaziou c9ac8f6956 Fix false positives in TODO keywords
* lisp/org.el (org-entry-properties): Make sure case is meaningful when
  matching a TODO keyword.
* testing/lisp/test-org.el (test-org/entry-properties): Add test.

Reported-by: Samuel Wales <samologist@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/99756>
2015-08-09 23:56:57 +02:00
Nicolas Goaziou 570b1935e7 org-agenda: Do not block non-TODO entries
* lisp/org-agenda.el (org-agenda-dim-blocked-tasks): Do not check if an
  entry can be blocked when it doesn't have any TODO keyword.

* lisp/org.el (org-entry-blocked-p): Make sure entry is really an open
  task before even considering it as a blocked task.  Small refactoring.

* testing/lisp/test-org.el (test-org/entry-properties): Update tests.
(test-org/entry-blocked-p): New test.

Reported-by: Bingo UV <right.ho@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/99544>
2015-08-06 17:56:40 +02:00
Nicolas Goaziou f63d76872c Fix links with newline characters
* lisp/org-element.el (org-element-link-parser): Correctly parse links
  with newline characters.

* lisp/org.el (org-make-link-regexps): Allow newline characters within
  angle links.
(org-activate-angle-links): Support multiline angle links.

* testing/lisp/test-org-element.el (test-org-element/link-parser):
  Update tests.

As a rule of thumb, any newline character and all surrounding
whitespaces are treated as a single space in a bracket link.  They are
removed in angle links.
2015-08-04 16:40:25 +02:00
Nicolas Goaziou a3b2b7473e Repair radio target search
* lisp/org.el (org-open-at-point): Find radio targets again.
(org-search-radio-target): New function.

* testing/lisp/test-org.el (test-org/open-at-point/radio-target): New
  test.
2015-08-03 02:59:13 +02:00
Nicolas Goaziou cfe5bc97f8 Fix link search
* lisp/org.el (org-open-link-marker): Remove variable.
(org-open-at-point): Apply removal.
(org-link-search): Sanitize function.  Fix issue with internal link
encoding.
(org-search-not-self): Remove function.

* lisp/ox.el (org-export--inclusion-absolute-lines): Ensure INCLUDE
  keywords with locations can find named elements and targets.

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

Reported-by: Ivanov Dmitry <usr345@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/99340>
2015-08-03 01:06:32 +02:00
Nicolas Goaziou 8094d01a68 org-table: Simplify `org-table-sort-lines'
* lisp/org-table.el (org-table-sort-lines): Rely on `sort-subr'.
  Refactor code.
(org-table--do-sort): Remove function.

* testing/lisp/test-org-table.el (test-org-table/sort-lines): Fix test.
2015-08-02 18:01:15 +02:00