Commit Graph

950 Commits

Author SHA1 Message Date
Nicolas Goaziou fa5f8c8f90 Allow optional argument to {{{property}}} for remote entries
* lisp/org-macro.el (org-macro-initialize-templates): "property"
  template accepts an optional argument, as a search option to grab
  properties from other headlines.

* doc/org.texi (Macro replacement): Document new feature.  Improve
  documentation.
(An example): Update documentation.

* testing/lisp/test-org-macro.el (test-org/macro-replace-all): Add
  tests.
2015-05-10 11:48:13 +02:00
Nicolas Goaziou 7ffb479fb6 test-org-element: Add tests for latex fragments parsing
* testing/lisp/test-org-element.el (test-org-element/latex-fragment-parser):
  Add tests.
2015-05-09 10:01:35 +02:00
Nicolas Goaziou 4980a9dbb8 Fix indentation in empty items
* lisp/org.el (org--get-expected-indentation): Fix indentation on
  in empty items.
* testing/lisp/test-org.el (test-org/indent-line): Add test.

Reported-by: Leo Ufimtsev <lufimtse@redhat.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/97454>
2015-05-08 10:08:11 +02:00
Nicolas Goaziou 360c4633e2 org-footnote: Rename `org-footnote-goto-local-insertion-point'
* lisp/org-footnote.el (org-footnote--goto-local-insertion-point):
  Renamed from `org-footnote-goto-local-insertion-point'.
(org-footnote-normalize): Use function above.  Small refactoring.

* testing/lisp/test-org-footnote.el (test-org-footnote/normalize-in-org):
  Small refactoring.
2015-05-06 23:47:13 +02:00
Nicolas Goaziou 0b7721322a Fix `org-next-block'
* lisp/org.el (org-next-block): Use Element API.

* testing/lisp/test-org.el (test-org/next-block):
(test-org/previous-block): New tests.
2015-05-01 14:03:26 +02:00
Konubinix 6f0cf14383 Fix `org-refresh-category-properties'
* lisp/org.el (org-refresh-category-properties): Prevent the `put-text-property'
  to change the point in order to take into account the CATEGORY
  property in subtrees also.

* testing/lisp/test-org.el (test-org/entry-properties): Add test.
2015-04-28 09:40:03 +02:00
Nicolas Goaziou eb77fed33f org-element: Fix parapraph parsing
* lisp/org-element.el (org-element--set-regexps): Refine
  `org-element-paragraph-separate'.
(org-element-paragraph-parser): Fix paragraph parsing when followed by
a dual keyword or an ill-formed latex environment.

* testing/lisp/test-org-element.el (test-org-element/paragraph-parser):
  Add tests.

Reported-by: Jacob Gerlach <jacobgerlach@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/97256>
2015-04-27 22:27:48 +02:00
Nicolas Goaziou 510fc3761b org-footnote: Fix 5954f6aa25
* lisp/org-footnote.el (org-footnote-goto-definition): Better check
  for narrowed scope.
* testing/lisp/test-org-footnote.el (test-org-footnote/goto-definition):
  Add test.
2015-04-25 11:09:05 +02:00
Nicolas Goaziou 5954f6aa25 org-footnote: Do not move point if definition is unreachable
* lisp/org-footnote.el (org-footnote-goto-definition): Throw an error
  when definition is outside narrowed part of buffer.  Do not move
  point either.

* testing/lisp/test-org-footnote.el (test-org-footnote/goto-definition):
  New test.

Reported-by: Rasmus <rasmus@gmx.us>
<http://permalink.gmane.org/gmane.emacs.orgmode/97158>
2015-04-25 10:36:35 +02:00
Nicolas Goaziou 84e2e1e752 org-element: Keep ARCHIVE tag in headline tags
* lisp/org-element.el (org-element-headline-parser): Do not remove
  ARCHIVE tag.
(org-element-headline-interpreter): Apply change.

* testing/lisp/test-org-element.el (test-org-element/headline-archive-tag):
Update tests.

<http://permalink.gmane.org/gmane.emacs.orgmode/97141>
2015-04-24 14:28:17 +02:00
Nicolas Goaziou c88256c776 ox: Fix OPTIONS line parsing
* lisp/ox.el (org-export--parse-option-keyword): Fix parsing of items.
* testing/lisp/test-ox.el (test-org-export/parse-option-keyword): Add
  test.
2015-04-22 14:05:37 +02:00
Nicolas Goaziou e040ad58a1 Rename `org-export--registered-backends'
* lisp/ox.el (org-export-registered-backends): Renamed from
  `org-export--registered-backends'.
(org-export-get-backend):
(org-export-register-backend):
(org-export-insert-default-template):
(org-export--dispatch-ui):

* lisp/org.el (org-export-registered-backends):
(org-export-backends):
(org-get-export-keywords):

* lisp/org-pcomplete.el (pcomplete/org-mode/file-option/options):

* testing/lisp/test-ox.el (test-org-export/define-backend):
(test-org-export/define-derived-backend):
(test-org-export/derived-backend-p):
(test-org-export/get-all-transcoders):
(test-org-export/get-all-options):
(test-org-export/get-all-filters):
(test-org-export/with-backend): Apply renaming.

Since the variable is copiously used outside of "ox.el", there's no
reason to mark it as internal.
2015-04-22 10:27:24 +02:00
Nicolas Goaziou bf024eed8d org-element: Improve babel calls parsing
* lisp/org-element.el (org-element-babel-call-parser):
(org-element-inline-babel-call-parser): Parse call name, inside
header, arguments and end header.  Update docstring.

* testing/lisp/test-org-element.el (test-org-element/babel-call-parser):
(test-org-element/inline-babel-call-parser):
(test-org-element/babel-call-interpreter):
(test-org-element/inline-babel-call-interpreter): Add tests.
2015-04-21 11:54:22 +02:00
Nicolas Goaziou f85a961c23 ox: Implement `org-export-file-uri'
* lisp/ox.el (org-export-file-uri): New function.
* testing/lisp/test-ox.el (test-org-export/file-uri): New test.
2015-04-20 12:36:47 +02:00
Nicolas Goaziou 0ab15904ec org-element: Fix "file" link :path
* lisp/org-element.el (org-element-link-parser): Fix :path value.
* testing/lisp/test-org-element.el (test-org-element/link-parser):
  Update tests.

:path now really contains the filename, not some truncated URI.
2015-04-20 12:35:41 +02:00
Nicolas Goaziou 186bae42a4 ox: Remove `org-export-get-headline-id'
* lisp/ox.el (org-export-get-headline-id):
(org-export--collect-unnumbered-headline-id): Remove function.
(org-export-collect-tree-properties): Apply removal.

* testing/lisp/test-ox.el (test-org-export/org-export-get-headline-id):
  Remove test.
(test-org-export/numbered-headline-p): Update test.

`org-export-get-reference' supersedes it.
2015-04-13 15:21:22 +02:00
Nicolas Goaziou 7584200bb8 org-footnote: Allow new footnotes in headlines
* lisp/org-footnote.el (org-footnote--allow-reference-p): Allow new
footnotes in headlines.

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

Reported-by: Thomas S. Dye <tsd@tsdye.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/96843>
2015-04-12 00:25:33 +02:00
Nicolas Goaziou 105ec604c2 ox: Allow multi-line objects in `parse' options
* lisp/ox.el (org-export--get-inbuffer-options): Allow multi-line objects.
* testing/lisp/test-ox.el (test-org-export/get-inbuffer-options): Add
  tests.  Update some others.

It is possible to write, e.g.,

  #+TITLE: *bold
  #+TITLE: sentence*
2015-04-09 14:11:25 +02:00
Nicolas Goaziou 1ba8413b0a org-element: Fix cache bug
* lisp/org-element.el (org-element--cache-for-removal): Be more
  careful when altering a properties drawer.

* testing/lisp/test-org-element.el (test-org-element/cache): Add test.
2015-04-06 00:37:49 +02:00
Nicolas Goaziou e69c4e7a1b `org-open-at-point' follows links in keywords
* lisp/org.el (org-open-at-point): Follow links in keywords.

* testing/lisp/test-org.el (test-org/open-at-point-in-keyword): New test.
2015-04-05 14:17:58 +02:00
Nicolas Goaziou fa70778a20 org-element: Remove `org-element-document-properties'
* lisp/org-element.el (org-element-document-properties): Remove
  variable.
(org-element-context): Ignore ex-"document keywords".

* testing/lisp/test-org-element.el (test-org-element/context): Remove
  no longer applicable tests.

Parsed keywords are no longer hard-coded and can be set per export
back-end.

As a consequence, `org-element-context' no longer returns objects in
"TITLE", "DATE" or "AUTHOR" keywords.  This makes sense as these
objects would only make sense during export, and only if the chosen
back-end actually uses them.
2015-04-05 13:48:28 +02:00
Nicolas Goaziou fa64b59b05 org-macro: Allow macros in parsed keywords and associated properties
* lisp/org-macro.el (org-macro-replace-all): Add optional argument.
  Now accept macros in parsed keywords and associated properties.

* lisp/ox.el (org-export-as): Apply signature change.

* testing/lisp/test-ox.el (test-org-export/expand-macro): Add test.
2015-04-05 13:48:28 +02:00
Nicolas Goaziou ae9db17482 ox: Implement `parse' behavior for options
* lisp/ox.el (org-export-options-alist): Implement `parse' behavior
  and use it for parsed keywords.  Update docstring.
(org-export-document-properties): Remove variable.

(org-export--get-subtree-options):
(org-export--get-inbuffer-options):
(org-export--get-global-options):
(org-export--prune-tree):
(org-export--remove-uninterpreted-data): Handle `parse' behavior.

(org-export-as): Do not assume :date is always a secondary string
and :email is never one.

* testing/lisp/test-ox.el (test-org-export/get-inbuffer-options):
  Update tests.
2015-04-05 12:21:25 +02:00
Nicolas Goaziou 707d52cff7 Fix diary sexp indentation
* lisp/org.el (org--get-expected-indentation): Diary sexps are to be
  indented at column 0.
* testing/lisp/test-org.el (test-org/indent-line): Add test.
2015-04-02 10:31:58 +02:00
Nicolas Goaziou 17752c379e Remove no longer appropriate test
* testing/lisp/test-org.el (test-org/find-property): Remove a test.

For efficiency reasons, since
7a717f8f04, `org-find-property' cannot
match accumulated properties.  It still could be done with another
optional argument, at the cost of a slower algorithm, but is not
needed so far.
2015-03-31 16:32:54 +02:00
Thierry Banel 2081cd3f62 Remove default #includes in Babel C, C++
* ob-C.el (org-babel-C-expand-C): remove automatic inclusion
of <string.h>, <stdio.h>, <stdlib.h>

* ob-C-test.org: adjust C++ tests to manually include
required header files.

<http://permalink.gmane.org/gmane.emacs.orgmode/96528>
2015-03-31 12:05:49 +02:00
Rasmus 99b48cf0c4 test-ox.el: Account for #+DESCRIPTION is not in ox
* test-ox.el (test-org-export/get-inbuffer-options): Change to reflect
  that #+DESCRIPTION is non-standard keyword.
2015-03-29 15:01:20 +02:00
Nicolas Goaziou 98ec17e204 Fix `org-backward-sentence' and `org-forward-sentence'
* lisp/org.el (org-backward-sentence):
(org-forward-sentence): Properly move at the boundaries of an element.

* testing/lisp/test-org.el (test-org/forward-sentence):
(test-org/backward-sentence): New tests.

Reported-by: Rasmus <rasmus@gmx.us>
<http://permalink.gmane.org/gmane.emacs.orgmode/96377>
2015-03-29 14:14:32 +02:00
Nicolas Goaziou a8f8ea8b69 ox: New smart quote algorithm
* lisp/ox.el (org-export-smart-quotes-alist): Fix indentation.
(org-export-smart-quotes-regexps): Remove variable.
(org-export--smart-quote-status): New function.
(org-export-activate-smart-quotes): Use new function.

* testing/lisp/test-ox.el (test-org-export/activate-smart-quotes):
  Update tests.
2015-03-28 15:41:46 +01:00
Nicolas Goaziou 69dd4301ab ox: Remove comments and comment blocks prior to export
* lisp/ox.el (org-export--delete-comments): Renamed from
  `org-export--delete-commented-subtrees'.  Also remove comments and
  comment blocks.
(org-export-as): Apply renaming.

* testing/lisp/test-ox.el (org-test-with-parsed-data): Apply renaming.

From the export point of view COMMENTed subtrees and regular comments
are expected to be treated in the same way.
2015-03-28 10:27:04 +01:00
Nicolas Goaziou fa0cc0ab70 Revert "Fix c9a52787c14c3a7429bcd3c8975350525e0baa04"
This reverts commit 359572d37e.

COMMENT headlines are expected to be ignored completely during export.
2015-03-28 09:54:37 +01:00
Nicolas Goaziou 22f732c255 Fuzzy links to headlines ignore COMMENT keywords
* lisp/org.el (org-link-search): Ignore COMMENT keyword.
* testing/lisp/test-org.el (test-org/fuzzy-links): Add test.

Reported-by: Martin Carlé <mc@aiguphonie.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/96413>
2015-03-26 21:05:27 +01:00
Nicolas Goaziou 359572d37e Fix c9a52787c1
* lisp/org-macro.el (org-macro--collect-macros): Ignore macro
  definitions in commented subtrees.
* lisp/ox.el (org-export--get-inbuffer-options): Ignore options in
  commented subtrees.
(org-export--delete-commented-subtrees): Remove function.
(org-export-as): Apply removal.

Removing the whole subtree is not subtle as Babel might want to use
data there.

Reported-by: Robert Klein <RoKlein@roklein.de>
<http://permalink.gmane.org/gmane.emacs.orgmode/96347>
2015-03-24 09:35:39 +01:00
Nicolas Goaziou c9a52787c1 ox: Ignore export settings in commented subtrees
* lisp/ox.el (org-export--delete-commented-subtrees): New function.
(org-export-as): Use new function.

* testing/lisp/test-ox.el (org-test-with-parsed-data,
  test-org-export/get-inbuffer-options): Use new function.
(test-org-export/expand-macro): Add tests.

Reported-by: Andreas Leha <andreas.leha@med.uni-goettingen.de>
<http://permalink.gmane.org/gmane.emacs.orgmode/96267>
2015-03-24 00:32:15 +01:00
Nicolas Goaziou f7b27896e9 ox: Rename some internal functions
* lisp/ox.el (org-export--prune-tree): Renamed from
  `org-export-prune-tree'.  Move it close to its caller.
(org-export--remove-uninterpreted-data): Renamed from
`org-export-remove-uninterpreted-data'.  Move it close to its caller.
(org-export--remove-uninterpreted-data-1): Move internal function
close to its caller.
(org-export-as): Apply renaming.

* testing/lisp/test-ox.el (org-test-with-parsed-data): Apply renaming.
2015-03-24 00:09:46 +01:00
Nicolas Goaziou 5a550938ce org-list: Modify M-RET on a description tag
* lisp/org-list.el (org-list-insert-item): On a description tag,
  insert item before current one.  However, past the colons, insert it
  after.
* testing/lisp/test-org-list.el (test-org-list/insert-item): Add
  tests.

Reported-by: Leo Ufimtsev <lufimtse@redhat.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/96330>
2015-03-23 23:35:57 +01:00
Nicolas Goaziou e0b19dedb9 ox: Throw an error on unresolved id links
* lisp/ox.el (org-export-get-environment): Properly find file
  associated to id link.
(org-export-resolve-id-link): Throw an error on unresolved id links.

Use `org-id-find' instead of `org-id-find-id-file' as the latter may
returns the file attached to current buffer on search failure.

Reported-by: Jacob Gerlach <jacobgerlach@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/96020>
2015-03-17 23:31:49 +01:00
Jacob Gerlach dc08e98885 ox.el: Issue error for unresolved fuzzy link
* lisp/ox.el (org-export-resolve-fuzzy-link): Throw an error instead
  of returning nil when link can't be resolved.

* testing/lisp/test-ox.el (test-org-export/resolve-fuzzy-link): Change
  last test from should-not to should-error

In addition to throwing an error, don't store the failed match in the
link cache.

TINYCHANGE
2015-03-17 22:46:05 +01:00
Nicolas Goaziou a886b23476 ox: Throw an error on unresolved coderef
* lisp/ox.el (org-export-resolve-coderef): Throw an error on
  unresolved coderef.

* testing/lisp/test-ox.el (test-org-export/resolve-coderef): Update
  test.
2015-03-17 22:42:45 +01:00
Nicolas Goaziou 16cea3d7b7 ox: Remove `comment' special value for `org-export-with-creator'
* lisp/ox.el (org-export-with-creator): Change default value.

* lisp/ox-ascii.el (org-ascii-template):
* lisp/ox-beamer.el (org-beamer-template):
* lisp/ox-latex.el (org-latex-template):
* lisp/ox-odt.el (org-odt-template):
* lisp/ox-org.el (org-org-template):
* lisp/ox-texinfo.el (org-texinfo-template): Treat
  `org-export-with-creator' as a boolean.

* testing/lisp/test-ox.el (test-org-export/parse-option-keyword):
  Update test.

* doc/org.texi (Export settings): Update allowed values in
  `org-export-with-creator'.

* etc/ORG-NEWS: Signal change.

Special `comment' value isn't meaningful for all back-ends and is not
implemented in every back-end where it makes sense anyway.

It is possible to add a comment including creator at the end of the
document using a body filter instead.
2015-03-17 15:51:22 +01:00
Gustav Wikström 8562bd09ec org: Nesting grouptags
* lisp/org.el (org-tags-expand): Nesting grouptags.

  Allowing subtags to be defined as groups themselves.

  : #+TAGS: [ Group : SubOne(1) SubTwo ]
  : #+TAGS: [ SubOne : SubOne1 SubOne2 ]
  : #+TAGS: [ SubTwo : SubTwo1 SubTwo2 ]

  Should be seen as a tree of tags:
  - Group
    - SubOne
      - SubOne1
      - SubOne2
    - SubTwo
      - SubTwo1
      - SubTwo2

  Searching for "Group" should return all tags defined above.
2015-03-16 22:27:38 +01:00
Gustav Wikström ee45258cfe org: Grouptags not unique and can contain regexp
* lisp/org.el (org-tags-expand): Grouptags can have regular expressions as
  "sub-tags".

  The regular expressions in the group must be marked up within { }.
  Example use:

  : #+TAGS: [ Project : {P@.+} ]

  Searching for the tag Project will now list all tags also including
  regular expression matches for P@.+.  Good for example if tags for a
  certain project is tagged with a common project-identifier,
  i.e. P@2014_OrgTags.

* lisp/org.el (org-tag-alist) : New symbols for grouptags when the
  tags in the group don't have to be distinct on a heading.

  Grouptags had to previously be defined with { }.  This syntax is
  already used for exclusive tags and Grouptags need their own,
  non-exclusive syntax.  This behaviour is achieved with [ ].  Note: {
  } can still be used also for Grouptags but then only one of the
  given tags can be used on the headline at the same time.  Example:

  [ group : sub1 sub2 ]

  Grouptags also are not filtered when setting up tags.  This means
  they can exist multiple times in org-tag-alist list.  It will be
  usable if nesting of grouptags is ever to become reality.

  There is a slightly annoying side-effect when setting tags in that a
  tag which is both a part of a grouptag and a grouptag of it's own
  will get multiple key-choices in the selection-UI.

* lisp/org.el (org--setup-process-tags): Adaption for the added syntax
  for non-distinct grouptags.

* lisp/org.el (org-fast-tag-selection): Add support for the added,
  non-unique, grouptag-syntax.  Minor (if ...) to (when ...) refactor.
2015-03-16 22:27:26 +01:00
Nicolas Goaziou 84d6ff4ec1 Fix `org-entry-delete' with accumulated properties
* lisp/org.el (org-entry-delete): Remove all occurrences of
  accumulated properties, too.  Return a non-nil value when some
  property was removed.

* testing/lisp/test-org.el (test-org/entry-delete): Add test.
2015-03-15 16:53:42 +01:00
Nicolas Goaziou 269b680900 Fix CUSTOM_ID search
* lisp/org.el (org-link-search): Avoid false positives when searching
  CUSTOM_ID property.

* testing/lisp/test-org.el (test-org/custom-id): Add test.
2015-03-15 15:49:05 +01:00
Nicolas Goaziou 7072dba04d Implement `org-find-property'
* lisp/org.el (org-find-property): New function.
* testing/lisp/test-org.el (test-org/find-property): New test.
2015-03-15 15:49:05 +01:00
Nicolas Goaziou 1de825df31 Fix CATEGORY property
* doc/org.texi (Special properties): Remove "CATEGORY"

* lisp/org.el (org-special-properties): Remove "CATEGORY".
(org-property-get-allowed-values): Ignore "CATEGORY".
(org-entry-get): Make sure to get CATEGORY value using
`org-entry-properties'.

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

"CATEGORY" is not a special property as it can also be set using
a properties drawer.
2015-03-11 17:12:49 +01:00
Nicolas Goaziou bf4a645cac org-element: Fix indentation removal with line breaks
* lisp/org-element.el (org-element-line-break-parser): Tiny
  refactoring.
(org-element-normalize-contents): Take into consideration line breaks
when removing common indentation.  Small refactoring.

* testing/lisp/test-org-element.el (test-org-element/normalize-contents):
  Add tests.
2015-03-07 01:58:28 +01:00
Nicolas Goaziou c76f254e8b ox: Fix custom link handling in anonymous back-end
* lisp/ox.el (org-export-custom-protocol-maybe): Change signature.
* contrib/lisp/ox-groff.el (org-groff-link):
* lisp/ox-ascii.el (org-ascii-link):
* lisp/ox-beamer.el (org-beamer-link):
* lisp/ox-html.el (org-html-link):
* lisp/ox-latex.el (org-latex-link):
* lisp/ox-man.el (org-man-link):
* lisp/ox-md.el (org-md-link):
* lisp/ox-odt.el (org-odt-link):
* lisp/ox-org.el (org-org-link):
* lisp/ox-texinfo.el (org-texinfo-link): Apply signature change.

* testing/lisp/test-ox.el (test-org-export/custom-protocol-maybe):
  Update test.

Provide explicitly back-end used instead of guessing it from INFO
channel as an anonymous back-end could be used, masquerading the real
one.

Reported-by: Christian Moe <mail@christianmoe.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/95402>
2015-02-24 15:54:01 +01:00
Nicolas Goaziou ad7b7efcdc ob-core: Fix inserting improper lists
* lisp/ob-core.el (org-babel-insert-result): Fix output when result is
  an improper list, which cannot be turned into a table.

* testing/lisp/test-ob.el (test-ob/org-babel-insert-result--improper-lists):
  New test.

Reported-by: Daniele Pizzolli <dan@toel.it>
<http://permalink.gmane.org/gmane.emacs.orgmode/95348>
2015-02-23 18:44:52 +01:00
Nicolas Goaziou 4eb4f47141 Simplify `org-show-context' configuration
* lisp/org.el (org-show-context-detail): New variable.
(org-context-choice, org-show-following-heading, org-show-siblings,
org-show-entry-below, org-show-hierarchy-above): Remove variables.
(org-show-set-visibility): New function.
(org-convert-to-oddeven-levels, org-get-location, org-show-context,
org-reveal): Use new function.
(org-link-search): Update docstring.

* lisp/org-agenda.el (org-agenda-cycle-show): Use new function.
(org-agenda-show): Replace missing variable.

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

* doc/org.texi (Sparse trees):
* doc/orgguide.texi (Sparse trees): Document changes.

* etc/ORG-NEWS: Signal changes.

Configuration of `org-show-context' is done with a single variable
offering six different views, instead of four variables for a total
of 16 configurations.
2015-02-22 14:57:09 +01:00