Commit Graph

429 Commits

Author SHA1 Message Date
Nicolas Goaziou 94605246e5 Merge branch 'maint' 2012-11-09 02:47:23 +01:00
Toby S. Cubitt 2aeb28d2af Bug fix in org-beginning-of-line visual line motion
* lisp/org.el (org-beginning-of-line): check `visual-line-mode'
instead of `line-visual-mode' to determine whether to move by visual
lines.

* lisp/org.el (org-kill-line): use of org-bound-and-true-p macro.

* testing/lisp/test-org.el: Add test
2012-11-09 02:46:21 +01:00
Nicolas Goaziou 5acffad561 Merge branch 'maint' 2012-11-05 00:58:34 +01:00
Nicolas Goaziou f48a8b7bf8 Fix end of line function called on an hidden block
* lisp/org.el (org-end-of-line): On a hidden block make sure to
  delegate motion to `end-of-line' instead of `move-end-of-line' in
  order to stay on the current line.
* testing/lisp/test-org.el: Update test.
2012-11-05 00:57:56 +01:00
Nicolas Goaziou 5d4243bccc org-export: Run a hook just before expanding include keywords and macros
* contrib/lisp/org-export.el (org-export-before-processing-hook): New
  variable.
(org-export-as): Run a hook just before expanding include keywords and
macros, and evaluating Babel blocks.
* testing/lisp/test-org-export.el: Add test.
2012-11-02 14:06:50 +01:00
Nicolas Goaziou 22ac03bee5 org-export: Add a function to retrieve category of an element or object
* contrib/lisp/org-export.el (org-export-get-category): New function.
* testing/lisp/test-org-export.el: Add tests.
2012-11-02 13:44:46 +01:00
Nicolas Goaziou 32c3456020 org-export: Fix previous/next element finding in secondary strings
* contrib/lisp/org-export.el (org-export-get-previous-element,
  org-export-get-next-element): Correctly retrieve previous and next
  object, if any, in secondary strings.
* testing/lisp/test-org-export.el: Add tests.
2012-10-31 13:21:16 +01:00
Nicolas Goaziou 1a7610ed98 org-export: Add FILETAGS when retreiving tags with inheritance
* contrib/lisp/org-export.el (org-export-special-keywords): New
  "FILETAGS" keyword.
(org-export--get-inbuffer-options): Handle "FILETAGS" keywords.
(org-export-get-tags): Add FILETAGS when retreiving tags with
inheritance.
* testing/lisp/test-org-export.el: Add test.
2012-10-30 16:03:59 +01:00
Nicolas Goaziou 6290da183c Signal an error when a circular macro expansion happens
* lisp/org.el (org-macro-replace-all): Signal an error when a circular
  macro expansion happens.
(org-macro-initialize-templates): Fix docstring.
* testing/lisp/test-org.el: Add test.
2012-10-30 09:24:55 +01:00
Nicolas Goaziou 8fb5987e56 org-export: Fix smart quotes with isolated quotes
* contrib/lisp/org-export.el (org-export-activate-smart-quotes): Fix
  smart quotes in some corner-cases.  Refactor code.
* testing/lisp/test-org-export.el: Add test.
2012-10-29 20:36:03 +01:00
Nicolas Goaziou 2e8591783f org-element: Fix org-element-context on parsed keywords
* lisp/org-element.el (org-element-context): Fix org-element-context
  on parsed keywords.
* testing/lisp/test-org-element.el: Update test.
2012-10-29 14:01:49 +01:00
Nicolas Goaziou a2120a9d73 org-export: Expand correctly {{{title}}} and such
* contrib/lisp/org-export.el (org-export-as): Expand correctly
  {{{title}}} and such when they already contain a regular macro.
  This is done by expanding macros in two steps: at first regular
  macros,  then document specific macros.
(org-export-expand-macro): Remove function.
* testing/lisp/test-org-export.el: Add test.
2012-10-29 14:01:20 +01:00
Nicolas Goaziou a8c026cb26 org-export: Explicit error when using invalid syntax for INCLUDE keywords
* contrib/lisp/org-export.el (org-export-expand-include-keyword):
  Error out when file isn't specified within double quotes.
* testing/lisp/test-org-export.el: Add test.
2012-10-29 11:31:19 +01:00
Nicolas Goaziou 99110c60a6 org-element: Find objects in document and parsed affiliated keywords
* lisp/org-element.el (org-element-context): Find objects in document
  and parsable affiliated keywords.
* testing/lisp/test-org-element.el: Add tests.
2012-10-29 11:09:41 +01:00
Nicolas Goaziou 98d5666bac org-element: Allow duals keywords with only secondary value
* lisp/org-element.el (org-element--collect-affiliated-keywords):
  Allow duals keywords with only secondary value.
* testing/lisp/test-org-element.el: Add test.

This patch allows to parse correctly the following:

    #+CAPTION[short caption]:
    #+CAPTION: Very long caption
    Some paragraph.
2012-10-28 22:45:34 +01:00
Nicolas Goaziou c1e3aaece3 org-element: Improve timestamps parsing
* lisp/org-element.el (org-element-timestamp-parser): Modify timestamp
  objects properties.
(org-element-headline-parser, org-element-inlinetask-parser): Remove
`:timestamp' and `:clock' property.  Add `:clockedp' property.  Also,
set `:closed', `:deadline' and `:scheduled' values to timestamp
objects, not strings.  Small refactoring.
(org-element-clock-parser): Rename `:time' property into `:duration'.
Also, set `:value' value as a timestamp object, not a string.
(org-element-planning-parser): Set `:closed', `:deadline' and
`:scheduled' values to timestamp objects, not strings.
(org-element-clock-interpreter, org-element-planning-interpreter)
(org-element-timestamp-interpreter): Update interpreters.
(org-element--current-element): Tiny refactoring.
* testing/lisp/test-org-element.el: Add tests.
2012-10-28 16:29:55 +01:00
Nicolas Goaziou 2f2a80fe06 ob: Fix block evaluation in a narrowed buffer
* lisp/ob.el (org-babel-where-is-src-block-result): Insert new results
  keyword in current narrowed part of buffer, if necessary. Small
  refactoring.
(org-babel-insert-result): Do not widen buffer when new results have
to be inserted.  Therefore, results inserted after the last block of
a narrowed buffer still belong to the narrowed part of the buffer.
* testing/lisp/test-ob.el: Add tests.
* testing/lisp/test-ob-exp.el: Move test to test-ob.el
2012-10-28 16:21:30 +01:00
Nicolas Goaziou ccc98ebc2d org-export: Fix expansion of babel calls in included files
* contrib/lisp/org-export.el (org-export-as):
  `org-current-export-file' should refer to current, temporary, buffer
  containing included contents, not to original buffer with include
  keywords.
(org-export-with-current-buffer-copy): Buffer copy must contain the
whole buffer, possibly narrowed to a proper part, not only the
narrowed part.
* testing/lisp/test-org-export.el: Tweak tests.
2012-10-28 16:21:30 +01:00
Nicolas Goaziou d81982ae9d org-element: Parse diary-sexp elements
* lisp/org-element.el (org-element-paragraph-separate): Diary-sexp
  elements can separate paragraphs.
(org-element-all-elements): Install new `diary-sexp' type.
(org-element--current-element): Recognize new `diary-sexp' elements.
(org-element-diary-sexp-parser, org-element-diary-sexp-interpreter):
New functions.
* testing/lisp/test-org-element.el: Add tests.
2012-10-27 14:43:30 +02:00
Nicolas Goaziou b2047a2565 org-export: Implement a generic smart quote module
* contrib/lisp/org-export.el (org-export-options-alist): Add an option
  item to toggle smart quotes during export.
(org-export-with-smart-quotes, org-export-smart-quotes-alist,
org-export-smart-quotes-regexps): New variables.
(org-export-activate-smart-quotes): New function.
(org-export-data): Remove residual text properties.
* testing/lisp/test-org-export.el: Add tests.
2012-10-27 11:42:31 +02:00
Nicolas Goaziou 95c305490e org-element: Add :parent text property to strings in parse tree
* lisp/org-element.el (org-element-property): Access to text
  properties when argument is a string.
(org-element-put-property): Correctly set property when target is
a string.
(org-element-adopt-elements): Also put :parent properties on strings.
* testing/lisp/test-org-element.el: Add test.
2012-10-27 11:42:30 +02:00
Nicolas Goaziou bef53d7f67 Merge branch 'maint' 2012-10-20 11:59:07 +02:00
Nicolas Goaziou 93040f4671 Fix auto filling in a paragraph directly following a comment
* lisp/org.el (org-auto-fill-function): Make sure `adaptive-fill-mode'
  mode is nil when pre-computed `fill-prefix' is the empty string.
  Otherwise filling functions from fill.el think it has to be computed
  again and overwrite it.
2012-10-20 11:58:16 +02:00
Nicolas Goaziou 94232ab5c6 Merge branch 'maint' 2012-10-16 21:12:21 +02:00
Nicolas Goaziou 8f96754932 Do not call `end-of-visual-line' when moving to the end of line
* lisp/org.el (org-end-of-line): Do not call `end-of-visual-line' when
  moving to the end of line.  Also improve behaviour on elements that
  can be hidden.
* testing/lisp/test-org.el: Add tests.
2012-10-16 21:11:06 +02:00
Nicolas Goaziou 0920e60c01 ob-exp: Fix removal of block results when exporting
* lisp/ob-exp.el (org-export-blocks-preprocess): Results of an
  evaluated code block can be inserted within the blank lines after
  the block.  Hence, if the block has to be removed, delete everything
  down to the first non-blank line after the end of block closing
  string, instead of removing everything down to the very end of the
  block.
* testing/lisp/test-ob-exp.el: Add test.
2012-10-15 22:29:30 +02:00
Nicolas Goaziou 23aa910259 Merge branch 'maint' 2012-10-14 21:51:59 +02:00
Nicolas Goaziou b7c5cf5d44 org-element: Fix parsing of objects of the same type in a single paragraph
* lisp/org-element.el (org-element--get-next-object-candidates): Fix
  parsing of objects of the same type in a single paragraph.
* testing/lisp/test-org-element.el: Add tests.
2012-10-14 21:49:41 +02:00
Nicolas Goaziou c65abd8577 org-element: Fix parsing of syntax at beginning of item
* lisp/org-element.el (org-element-sub/superscript-successor): Fix
  parsing of sub/superscript at beginning of item.
(org-element-latex-or-entity-successor): Fix parsing of latex
  fragments at beginning of item.
* testing/lisp/test-org-element.el: Add test.
2012-10-14 21:38:42 +02:00
Nicolas Goaziou c1c0c70c89 org-export: Add tag inheritance to `org-export-get-tags'
* contrib/lisp/org-export.el (org-export-get-tags): Add optional tag
  inheritance.
* testing/lisp/test-org-export.el: Add test.
2012-10-14 13:19:12 +02:00
Nicolas Goaziou 56470de26d Merge branch 'maint'
Conflicts:
	testing/lisp/test-org.el
2012-10-12 18:22:04 +02:00
Nicolas Goaziou 5212d4fa6b Fix analyzing european dates with time but without year
* lisp/org.el (org-read-date-analyze): Fix analyzing for dates like
  "29.03 16:40".
* testing/lisp/test-org.el: Add test.
2012-10-12 18:17:25 +02:00
Nicolas Goaziou 346c978939 Remove useless data in test file
* testing/examples/macro-templates.org: Remove time-stamp.
2012-10-10 22:46:50 +02:00
Nicolas Goaziou 89d6a26f8d org-export: Expand include keywords before macros
* contrib/lisp/org-export.el (org-export-as): Expand include keywords
  before macros.  This allows to specify macro templates in the
  included file.
* testing/examples/macro-templates.org: New file for testing purposes.
* testing/lisp/test-org-export.el: Add test.
2012-10-10 13:52:54 +02:00
Nicolas Goaziou bbdd81ad37 Be stricter when updating radio targets
* lisp/org.el (org-all-targets): Make sure the regexp really matched
  a radio target.
* testing/lisp/test-org.el: Add test.
2012-10-10 13:41:14 +02:00
Nicolas Goaziou 58b42debb1 org-export: Include title, author, date and email macros
* contrib/lisp/org-export.el (org-export-expand-macro): New function.
(org-export-as): Use new function.
* lisp/org.el (org-macro-expand, org-macro-replace-all): Change
  signature.  The function now accepts an alist of templates so it
  doesn't have to rely only on `org-macro-templates'.
(org-macro-initialize-templates): {{{date}}} is not anymore an alias
for {{{time}}}.  During export, it will provide the value stored in
DATE keyword instead.
* testing/lisp/test-org-export.el: Add tests.
* testing/lisp/test-org.el: Update tests.
2012-10-06 10:29:37 +02:00
Nicolas Goaziou 2c78ca4a56 Merge branch 'maint'
Conflicts:
	lisp/org-element.el
2012-10-06 01:21:27 +02:00
Nicolas Goaziou ad99ea9147 org-element: Fix parsing with trailing spaces at eob
* lisp/org-element.el (org-element-center-block-parser,
  org-element-drawer-parser, , org-element-footnote-definition-parser,
  org-element-inlinetask-parser, org-element-plain-list-parser,
  org-element-quote-block-parser, org-element-special-block-parser,
  org-element-babel-call-parser, org-element-clock-parser,
  org-element-comment-parser, org-element-comment-block-parser,
  org-element-example-block-parser, org-element-export-block-parser,
  org-element-fixed-width-parser, org-element-horizontal-rule-parser,
  org-element-keyword-parser, org-element-latex-environment-parser,
  org-element-paragraph-parser, org-element-planning-parser,
  org-element-property-drawer-parser, org-element-src-block-parser,
  org-element-table-parser,
  org-element-verse-block-parserorg-element-dynamic-block-parser):
  Make sure element never ends at the end of a blank non-empty line.
* testing/lisp/test-org-element.el: Add test.
2012-10-06 01:02:03 +02:00
Nicolas Goaziou 78d2bd7edc Merge branch 'maint' 2012-10-05 15:08:58 +02:00
Nicolas Goaziou daf8cf030c org-element: Fix `org-element-context' when in recursive objects
* lisp/org-element.el (org-element-context,
  org-element--get-next-object-candidates): Fix `org-element-context'.
  In particular, the restrictions for an object may be different from
  those of its container (i.e. table rows and table cells).
* testing/lisp/test-org-element.el: Add tests.
2012-10-05 15:02:55 +02:00
Nicolas Goaziou 2a95a47c5f Merge branch 'maint' 2012-10-01 21:37:48 +02:00
Nicolas Goaziou 3bd22fb045 org-element: Store value of example-blocks and src-blocks unescaped
* lisp/org-element.el (org-element-example-block-parser,
  org-element-src-block-parser): Store value of example-blocks and
  src-blocks unescaped.
(org-element-example-block-interpreter,
org-element-src-block-interpreter): Escape value again when storing
it.
* contrib/lisp/org-export.el (org-export-unravel-code): Don't clean
  commas from code since org-element already took care of it.
* testing/lisp/test-org-export.el: Update test.
* testing/lisp/test-org-element.el: Add tests.
2012-10-01 21:35:50 +02:00
Nicolas Goaziou fac86b03fe Normalize comma-escaping of src-blocks and example-blocks
* lisp/org-src.el (org-escape-code-in-string,
  org-unescape-code-in-string, org-escape-code-in-region,
  org-unescape-code-in-region): New functions.
(org-edit-src-code, org-edit-src-exit): Use new functions.
* lisp/org.el (org-strip-protective-commas): Removed function.
* lisp/org-exp.el (org-export-select-backend-specific-text): Use new
  function.
* lisp/ob.el (org-babel-parse-src-block-match,
  org-babel-parse-inline-src-block-match, org-babel-insert-result):
  Always escape produced blocks, independently on the language of the
  block, if any.  Use new functions.
* doc/org.texi: Update documentation.
* testing/lisp/test-ob.el: Update test.
2012-10-01 21:24:00 +02:00
Bastien Guerry 180fd62245 Merge branch 'maint' 2012-10-01 19:00:18 +02:00
Bastien Guerry 857a3921af testing/lisp/test-ob-lilypond.el: Use "w32" or "windows-nt" instead of "win32" 2012-10-01 19:00:14 +02:00
Nicolas Goaziou 3245619445 org-element: Allow to map over affiliated keywords
* lisp/org-element.el (org-element-map): Change signature.
* testing/lisp/test-org-element.el: Add test.
2012-09-30 23:57:45 +02:00
Nicolas Goaziou d6fb245590 Merge branch 'maint' 2012-09-30 13:13:21 +02:00
Nicolas Goaziou 1ad58a8230 org-element: Use stricter regexps for boundaries of elements
* lisp/org-element.el (org-element-center-block-parser):
(org-element-drawer-parser, org-element-dynamic-block-parser,
org-element-example-block-parser, org-element-export-block-parser,
org-element-latex-environment-parser, org-element-paragraph-parser,
org-element-property-drawer-parser, org-element-src-block-parser,
org-element-verse-block-parser): Use stricter regexps for boundaries
of elements.
* testing/lisp/test-org.el: Fix a test.
2012-09-30 13:09:54 +02:00
Bastien Guerry 4962980938 Merge branch 'maint' 2012-09-29 11:10:18 +02:00
Nicolas Goaziou d88344d291 org-element: Properly remove COMMENT and QUOTE keywords from title in parser
* lisp/org-element.el: Properly remove COMMENT and QUOTE keywords from
  title in parser.
* testing/lisp/test-org-element.el: Add tests.
2012-09-29 10:15:59 +02:00