Commit Graph

745 Commits

Author SHA1 Message Date
Nicolas Goaziou 7c82e6ac19 No alphanumeric characters around radio links
* lisp/org.el (org-make-target-link-regexp): Change regexp so
  alphanumeric characters cannot be found next to a radio link.
(org-activate-target-links): Apply changes to radio link regexp.

* lisp/org-element.el (org-element--object-lex,
  org-element-link-parser): Apply changes to radio link regexp.

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

Patch suggested by Daniel Clemente.
http://permalink.gmane.org/gmane.emacs.orgmode/84461
2014-04-11 21:30:15 +02:00
Nicolas Goaziou 37e3c112dd Merge branch 'maint' 2014-04-10 23:01:20 +02:00
Nicolas Goaziou 3589f64e42 Make Org links compatible with URI syntax
* lisp/org.el (org-make-link-regexps): Allow optional double slashes
  after type.  Small refactoring.

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

This patch allows to write both [[file:/file.org]] and [[file:///file.org]].
See bug#16751.
2014-04-10 22:57:05 +02:00
Nicolas Goaziou fea23d3da2 Fix COMMENT keyword when stacked with a regular keyword
* lisp/org.el (org-set-font-lock-defaults): Fix headline fontification
  when keywords are stacked.
(org-toggle-comment): Properly toggle COMMENT keyword when a regular
keyword is already present.
(org-todo, org-agenda-prepare-buffers): Correctly match a commented
heading.
* lisp/org-colview.el (org-columns-capture-view): Correctly match
  a commented heading.

* testing/lisp/test-org.el (test-org/toggle-comment): New test.
2014-04-10 22:51:16 +02:00
Nicolas Goaziou af41c071ed Merge branch 'maint' 2014-04-10 11:56:13 +02:00
Nicolas Goaziou 7fe1da1f8c org-test: Small code clean-up
* testing/org-test.el (org-test-with-temp-text): Clean-up code.
2014-04-10 11:53:27 +02:00
York Zhao d01d22b74f org-test: Fix <point> feature
* testing/org-test.el (org-test-with-temp-text): Fix point position.

According to the docstring, if the string "<point>" appears in TEXT
then the string "<point>" is removed and point is placed there. The
problem was that after string "<point>" was removed, the point
was *not* placed at the position of the removed text, rather, it was
placed one character before that position which is wrong. The reason
is that Emacs buffer position is a number started from 1, instead of
0, in other words, the value of `(point-min)' is 1 not 0. The problem
is addressed by adding 1 to the calculated position.

TINYCHANGE
2014-04-10 11:52:44 +02:00
Nicolas Goaziou dfcfca8219 Merge branch 'maint'
Conflicts:
	lisp/org-element.el
2014-04-08 18:59:06 +02:00
Nicolas Goaziou 728661309e org-element: Fix table parsing with missing final bar
* lisp/org-element.el (org-element-table-cell-parser,
  org-element-table-cell-successor): Recognize cell even when last
  vertical bar is missing.

* testing/lisp/test-org-element.el (test-org-element/table-cell-parser):
  Add test.

Thanks to Thorsten Jolitz for reporting it.
http://permalink.gmane.org/gmane.emacs.orgmode/84713
2014-04-08 18:56:51 +02:00
Nicolas Goaziou 23e62f7527 Radio targets cannot beging or end with whitespace
* lisp/org.el (org-radio-target-regexp): Radio targets cannot begin or
  end with whitespace.
(org-target-regexp): Update syntax according to previous rule.
(org-any-target-regexp): Fix fontification bug.

* testing/lisp/test-org-element.el (test-org-element/radio-target-parser):
  Add test.

Variables are turned into defconst to emphasize the fact that they are
not subject to change.

Thanks to Daniel Clemente for reporting it.
http://permalink.gmane.org/gmane.emacs.orgmode/84461
2014-04-02 14:54:37 +02:00
Nicolas Goaziou a7e12d2af5 ox: Fix multiple deactivated subscripts export
* lisp/ox.el (org-export--remove-uninterpreted-data-1): Fix multiple
  deactivated subscripts export.

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

Thanks to Xavier Garrido for reporting it.
http://permalink.gmane.org/gmane.emacs.orgmode/84403
2014-03-29 22:47:01 +01:00
Achim Gratz c6e0157095 org-test: fix macro definitions so that eager macro expansion doesn't fail
* testing/org-test.el (org-test-with-temp-text,
  org-test-with-temp-text-in-file): Correct quoting of macro
  expansion.

Macro arguments must not be used during macro expansion since they are
not available at that time; conversely, bindings established during
macro expansion generally can not be used at macro execution
time (unless un-quoted during expansion).
2014-03-25 19:11:01 +01:00
Nicolas Goaziou 1c1936fbb1 Allow radio links after an apostrophe and mid-word
* lisp/org.el (org-make-target-link-regexp): Allow radio links after
  an apostrophe and mid-word.  Small refactoring.

* testing/lisp/test-ox.el (test-org-export/resolve-radio-link): Add
  test.

See http://permalink.gmane.org/gmane.emacs.orgmode/84108.
2014-03-25 10:21:26 +01:00
Nicolas Goaziou 6d1d61f667 Rename `org-babel-under-commented-heading-p'
* lisp/org.el (org-in-commented-heading-p): New function.
* lisp/ob-tangle.el (org-babel-under-commented-heading-p): Remove
  function.
(org-babel-tangle-collect-blocks): Use new function.
* lisp/ob-exp.el (org-babel-exp-process-buffer): Use new function.

* testing/lisp/test-org.el (test-org/in-commented-heading-p): New
  test.
2014-03-24 13:29:42 -04:00
Nicolas Goaziou 230d09aeb0 Merge branch 'maint' 2014-03-24 14:20:23 +01:00
Nicolas Goaziou 8212776cfc Fix radio target parsing
* lisp/org-element.el (org-element-all-successors,
  org-element-object-restrictions): Prioritize `link' over other
  successors in order to find radio links starting with another syntax
  object (e.g., an entity).  Also allow text markup within radio
  targets.
(org-element-link-parser): Add contents to radio targets.

* lisp/org.el (org-make-target-link-regexp): Fix regexp so it can
  match targets starting with an Org object (e.g., an entity).
(org-ctrl-c-ctrl-c): Fix function when applied on an object contained
within a radio target.

* testing/lisp/test-org-element.el (test-org-element/radio-target-parser): Add test.
* testing/lisp/test-ox.el (test-org-export/resolve-radio-link): Add test.
2014-03-24 14:13:24 +01:00
Nicolas Goaziou d6d1f25429 Fix `org-open-at-point'
* lisp/org.el (org-open-at-point): Correctly open fuzzy links when
  path is hexified.
* testing/lisp/test-org.el (test-org/coderef): New test.
(test-org/fuzzy-links): Add test.
2014-03-21 14:51:34 +01:00
Nicolas Goaziou df10309489 ob-ref: Properly resolve references in ":post" arguments
* lisp/ob-core.el (org-babel-exp-reference-buffer): New variable, as
  a replacement for `org-current-export-file'.
(org-babel-check-confirm-evaluate): Use new variable.
* lisp/ob-exp.el (org-babel-exp-in-export-file): Use new variable.
(org-babel-exp-get-export-buffer): Remove function.
(org-babel-exp-process-buffer): Change signature.
* lisp/ob-ref.el (org-babel-ref-resolve): Use new variable during
  export in order to properly resolve references.
* lisp/ox.el (org-export-execute-babel-code): Use new variable.

* contrib/lisp/org-wikinodes.el (org-wikinodes-process-links-for-export):
  Remove a cond branch as it is always
  false (`org-current-export-file' couldn't be a string).

* testing/lisp/test-ob-lob.el (test-ob-lob/export-lob-lines): Update
  test.
* testing/lisp/test-ob.el (test-ob/eval-header-argument): Update test.
* testing/lisp/test-ob-exp.el (ob-export/reference-in-post-header):
  New test.

During export, Babel executes sequentially all blocks in the buffer
being exported.  This can lead to modifications preventing some
references from being resolved.  As a workaround, Babel stores
a pristine copy of the buffer in a variable so it can always find
needed references.

Before this patch, the variable storing this copy was
`org-current-export-file' and was dynamically bound in "ox.el".  It
was used to resolve noweb references (`org-babel-expand-noweb-references')
but not regular references (`org-babel-ref-resolve').

Now, the variable is `org-babel-exp-reference-buffer' and it is bound
from `org-babel-exp-process-buffer'.  It is used to resolve all
references.  In particular, this allows to use references in :post
header.

Thanks to Jarmo Hurri for reporting it.
2014-03-19 21:34:56 +01:00
Nicolas Goaziou 05f69e5bf8 ob-exp: During export ignore Babel code under commented headlines
* lisp/ob-exp.el (org-babel-exp-process-buffer): Skip code under
  a commented headline.
* testing/lisp/test-ob-exp.el (ob-export/export-under-commented-headline):
  New test.
2014-03-15 19:40:13 -06:00
Nicolas Goaziou 2f60dfc1b3 Merge branch 'maint' 2014-03-12 09:08:37 +01:00
Nicolas Goaziou cb22a0355f org-element: Fix parsing of bold objects at the beginning of a headline
* lisp/org-element.el (org-element-context): Fix parsing of bold
  objects at the beginning of a headline.
* testing/lisp/test-org-element.el (test-org-element/context): Add
  test.
2014-03-12 09:05:50 +01:00
Nicolas Goaziou d75fa9febc `org-open-at-point' right after an object still open it
* lisp/org.el (org-open-at-point): White spaces after an object are
  usually ignored by the function.  Though, when point is right after
  the object, still activate it.
* testing/lisp/test-org.el (test-org/custom-id): Fix test.
2014-03-02 10:32:51 +01:00
Nicolas Goaziou 8b2d3645ac Ignore `org-open-at-point' when point is on white spaces
* lisp/org.el (org-open-at-point): Do not do anything when point is on
  white spaces after an object.
* testing/lisp/test-org.el (test-org/custom-id): Modify test.
2014-02-27 18:38:39 +01:00
Nicolas Goaziou 3960ed07e6 Merge branch 'maint'
Conflicts:
	lisp/org-element.el
2014-02-25 20:54:48 +01:00
Nicolas Goaziou 7f8c1226e8 org-element: Fix timestamps parsing in planning lines
* lisp/org-element.el (org-element-context): Fix timestamps parsing.
* testing/lisp/test-org-element.el (test-org-element/context): Add
  test.
2014-02-25 20:51:32 +01:00
Nicolas Goaziou fc9ce86cfc Rewrite `org-open-at-point' using Elements
* lisp/org.el (org-open-at-point): Rewrite function using Element
  parser.
(org-link-types): Add "help" type.
* testing/lisp/test-org-open-at-point.el: Remove file.  Two tests are
  not supported anymore (namely bracket-link-before and
  plain-link-before) and the other tests are wrong (mixing id and
  custom-id links).
* testing/examples/open-at-point.org: Remove file.
* testing/lisp/test-org.el (test-org/custom-id): Add test.

Unlike to the previous implementation, this one will only open links
under point or just before point, not links on the same line but
before point.
2014-02-23 14:26:18 +01:00
Nicolas Goaziou 13691bde32 org-element: Fix `org-element-context' at eob
* lisp/org-element.el (org-element-context): If function is called at
  the end of buffer, return any object that ends there.
* testing/lisp/test-org-element.el (test-org-element/context): Add
  test.
2014-02-23 13:49:41 +01:00
Michael Brand 89c1668945 Add ERT with org-lookup-all for GROUP BY and ranking
* testing/lisp/test-org-table.el (test-org-table/org-lookup-all): Add
new test.
2014-02-22 21:18:28 +01:00
Nicolas Goaziou eed0500913 org-element: Implement lazy cache synchronization
* lisp/org-element.el (org-element-cache-sync-idle-time): Change
  default value.
(org-element-cache-sync-duration, org-element-cache-sync-break,
org-element--cache-sync-requests, org-element--cache-sync-timer,
org-element--cache-sync-keys, org-element--cache-default-key,
org-element--cache-change-warning): New variables.
(org-element-cache-merge-changes-threshold,
org-element--cache-status): Removed variables.
(org-element--cache-key, org-element--cache-generate-key,
org-element--cache-key-less-p, org-element--cache-find,
org-element--cache-set-timer, org-element--cache-process-request,
org-element--cache-submit-request, org-element--parse-to,
org-element--cache-interrupt-p, org-element--cache-put,
org-element--cache-active-p): New functions.
(org-element--cache-compare): Adapt to new keys in AVL tree.
(org-element--cache-pending-changes-p,
org-element--cache-cancel-changes, org-element--cache-mapc,
org-element-cache-get, org-element-cache-put): Removed functions.
(org-element--cache-before-change): Use new variables.
(org-element--cache-after-change): Renamed from
`org-element--cache-record-change'.
(org-element-cache-get): Change signature.
(org-element-cache-put): Rewrite function.  Use new tools.
(org-element-cache-reset): Adapt to new variables.
(org-element--cache-sync): Rewrite function.

* lisp/ox.el (org-export--generate-copy-script): Do not copy through
  new cache-related variables.
(org-export-ignored-local-variables): New variable.

* testing/lisp/test-org-element.el (test-org-element/cache): New test.

Now only the part of the cache that needs to be accessed is updated
synchronously.  Otherwise, it happens on idle time.
2014-02-20 22:18:17 +01:00
Michael Brand fb3ecad851 Simplify ERT for TBLFM with sub-total
* testing/lisp/test-org-table.el (test-org-table/sub-total): Simplify
condition in "if".
2014-02-20 08:51:19 +01:00
Michael Brand 54e3009d73 Fix escaping of more links in HTML export
* lisp/org.el (org-link-escape-chars): Extend docstring.
(org-link-escape-chars-browser): Mention in docstring that it will
become a candidate for removal.
(org-link-escape-browser): Mention in docstring that it will become a
candidate for removal.
(org-open-at-point): Move `url-encode-url' and comments into
`org-link-escape-browser'.

* lisp/ox-html.el (org-html-link): Make use of
`org-link-escape-browser' like `org-open-at-point'.

* testing/lisp/test-org.el (test-org/org-link-escape-chars-browser):
Mention in docstring that it will become a candidate for removal.
2014-02-19 20:49:21 +01:00
Nicolas Goaziou 03514a6a78 Merge branch 'maint' 2014-02-17 23:01:40 +01:00
Nicolas Goaziou c5d88fb606 org-element: Fix inlinetask parsing
* lisp/org-element.el (org-element-inlinetask-parser): Fix parsing
  when regular and degenerate inlinetasks are mixed in the section.
* testing/lisp/test-org-element.el (test-org-element/inlinetask-parser):
  Add tests.

Thanks to Anders Johansson for reporting it.
2014-02-17 22:59:25 +01:00
Michael Brand ea4eb4f10f Add ERT for TBLFM with sub-total
* testing/lisp/test-org-table.el (test-org-table/sub-total): Add a use
case of grouped rows with sub-total.
2014-02-16 10:04:46 +01:00
Nicolas Goaziou def5cd8ca5 Merge branch 'maint' 2014-02-07 20:08:29 +01:00
Nicolas Goaziou 7f287d1b62 org-element: Fix indentation normalization
* lisp/org-element.el (org-element-normalize-contents): Do not ignore
  empty lines when an object follows.
* testing/lisp/test-org-element.el (test-org-element/normalize-contents):
  Add test.
2014-02-07 20:06:00 +01:00
Nicolas Goaziou b8665a0190 New function to toggle fixe-width areas
* lisp/org.el (org-toggle-fixed-width): New function.
* testing/lisp/test-org.el (test-org/toggle-fixed-with): New test.

This replaces the old implementation removed in commit
6a00c96541.
2014-02-06 18:55:14 +01:00
Nicolas Richard 5f0ca0ee92 Renaming of ob-sh to ob-shell: various fixes
* lisp/org.el (org-babel-load-languages):
* testing/org-test.el:
* testing/README: change 'sh' to 'shell'

* testing/lisp/test-ob-sh.el: re-rename test file (fixes 80754a8)
2014-02-02 00:08:56 -07:00
Nicolas Goaziou 8f91f657e1 Merge branch 'maint' 2014-02-01 21:54:03 +01:00
Nicolas Goaziou ac2f516edf ob-exp: Do not ignore `org-src-preserve-indentation'
* lisp/ob-exp.el (org-babel-exp-process-buffer): Also check
  `org-src-preserve-indentation' to know when to preserve indentation.
* testing/lisp/test-ob-exp.el (ob-export/export-and-indentation): New
  test.

Thanks to John Hendy for reporting it.
2014-02-01 21:52:43 +01:00
Nicolas Goaziou 98eed5baf9 Merge branch 'maint' 2014-01-29 09:05:44 +01:00
Nicolas Goaziou 63a2a403a9 ob-exp: Fix switches handling upon exporting
* lisp/ob-exp.el (org-babel-exp-code-template): Include switches in
  template.
(org-babel-exp-code): Provide %switches placeholder.
* testing/lisp/test-ob-exp.el (ob-export/export-src-block-with-switches):
  New test.
(ob-export/export-src-block-with-flags): Fix indentation.

This fixes dde6af3a62.  The confusion
came from the fact that "flags" placeholder had two meanings:
the :flags value and the block's switches (e.g., "-n").  This patch
separates these two meanings.
2014-01-29 09:01:43 +01:00
Nicolas Goaziou 6a00c96541 Remove left over references to QUOTE blocks
* lisp/org.el (org-quote-string): Remove variable.
(org-enable-fixed-width-editor, org-context): Update docstring.
(org-toggle-fixed-width-section): Remove function and binding.
(org-set-font-lock-defaults): Remove reference to `org-quote-string'.

* lisp/org-element.el (org-element-headline-parser,
  org-element-headline-interpreter): Remove references to
  `org-quote-string'.

* testing/lisp/test-org-element.el (test-org-element/headline-quote-keyword):
  Remove test.
(test-org-element/headline-interpreter): Remove a test.
2014-01-28 21:36:54 +01:00
Nicolas Goaziou 8a265e2915 org-element: Remove quote sections
* lisp/org-element.el (org-element-quote-section-parser,
  org-element-quote-section-interpreter): Remove functions.
  (org-element--current-element, org-element--parse-elements): Do not
  handle quote sections at all.
* testing/lisp/test-org-element.el (test-org-element/quote-section-parser):
  Remove test.
2014-01-27 21:14:20 +01:00
Nicolas Goaziou 363fd7e8f3 Merge branch 'maint' 2014-01-20 17:26:12 +01:00
Nicolas Goaziou b79462ba98 ob-exp: Fix a failing test
* testing/lisp/test-ob-exp.el (ob-export/export-with-results-before-block):
  Fix a test
2014-01-20 17:25:34 +01:00
Nicolas Goaziou e5617b88cb Merge branch 'maint' 2014-01-20 17:16:32 +01:00
Nicolas Goaziou dde6af3a62 ob-exp: Fix export of src blocks with flags
* lisp/ob-exp.el (org-babel-exp-code): Fix export of src blocks with
  flags.
* testing/lisp/test-ob-exp.el (ob-export/export-src-block-with-flags):
  New test.

Thanks to Giuseppe Lipari for reporting it.
2014-01-20 14:20:06 +01:00
Eric Schulte cd3bc12a29 named and caching call lines working
* lisp/ob-core.el (org-babel-current-result-hash): Additional info
  argument so that named call line results may be found.
  (org-babel-set-current-result-hash): Additional info argument so
  that named call line results may be found.
* lisp/ob-lob.el (org-babel-lob-execute): Passing info to hash finding
  functions so that named results may be found.
2014-01-18 13:40:57 -07:00
Eric Schulte 93d272b449 failing test of named caching call line 2014-01-18 13:40:57 -07:00