Commit Graph

574 Commits

Author SHA1 Message Date
Nicolas Goaziou 9e51049b22 Fix filling with `adaptive-fill-regexp'
* lisp/org.el (org-adaptive-fill-function): Look for a fill prefix at
  the beginning of the paragraph and subsquently on its second line
  instead of the current line.
* testing/lisp/test-org.el: Add test
2013-08-22 21:54:52 +02:00
Nicolas Goaziou 36161345d1 Reintroduce support for `adaptive-fill-regexp' in paragraphs and comments
* lisp/org.el (org-adaptive-fill-function, org-fill-paragraph): Add
  support for `adaptive-fill-regexp' in paragraphs and comments.
* testing/lisp/test-org.el: Add tests.
2013-07-28 10:16:03 +02:00
Nicolas Goaziou b4a8ec9321 org-element: Fix infloop when parsing a list at the end of buffer
* lisp/org-element.el (org-element-plain-list-parser): Fix infloop
  when parsing a list at the end of buffer, if buffer doesn't end at
  a line beginning.
* testing/lisp/test-org-element.el: Add test.
2013-07-21 15:51:14 +02:00
Nicolas Goaziou 136081a0d4 Use empty commented lines as separators when filling comments
* lisp/org.el (org-fill-paragraph): Use empty commented lines as
  separators when filling comments.  This mimics default behaviour
  from "newcomment.el", which is not used in Org.
* testing/lisp/test-org.el: Add tests.
2013-07-10 14:13:39 +02:00
Nicolas Goaziou c78fa35252 Fix error when filling consecutive comments
* lisp/org.el (org-fill-paragraph): Do not mix consecutive comments
  when filling any of them.
* testing/lisp/test-org.el: Add test.

Thanks to Samuel Wales for reporting it.
2013-07-09 13:52:00 +02:00
Nicolas Goaziou 0aa0fdd971 org-element: Fix interpretation of empty items
* lisp/org-element.el (org-element-item-interpreter): This patch fixes
  "(wrong-type-argument arrayp nil)" error when trying to interpret
  empty items.
* testing/lisp/test-org-element.el: Add test.
2013-07-06 00:39:28 +02:00
Nicolas Goaziou e5630add27 org-element: Fix "*" itemized plain lists interpretation
* lisp/org-element.el (org-element-item-interpreter): Correctly
  interpret back plain lists with "*" items.  This fixes "This is not
  a list" error returned in this case.
* testing/lisp/test-org-element.el: Add test.
2013-07-05 21:12:47 +02:00
Nicolas Goaziou 838e849bf7 org-element: Fix org-meta-return error at the end of buffer
* lisp/org-element.el (org-element--current-element): Fix
  org-meta-return error at the end of buffer.
* testing/lisp/test-org-element.el: Add test.

Thanks to Nicolas Richard for reporting this.
2013-06-25 17:37:48 +02:00
Nicolas Goaziou 60899b1a2f ox: Fix fuzzy link resolution before first headline
* lisp/ox.el (org-export-resolve-fuzzy-link): Fix link resolution when
  link lives before the first headline.
* testing/lisp/test-ox.el: Add test.
2013-06-18 22:29:49 +02:00
Nicolas Goaziou dffdc499ea org-element: Fix special block parsing
* lisp/org-element.el (org-element-special-block-parser): Fix typo in
  regexp matching block type.  Also quote the type so it can contain
  special characters.
* testing/lisp/test-org-element.el: Add test.
2013-06-17 17:15:55 +02:00
Nicolas Goaziou 87ab99f563 org-element/ox: Fix src-block indentation when it should be preserved
* lisp/org-element.el (org-element--remove-indentation): New function.
(org-element-example-block-parser, org-element-src-block-parser): Use
new function.
(org-element-src-block-interpreter): Update function according to
change.
* lisp/ox.el (org-export-unravel-code): Do not remove any indentation
  since it now happens at the parser level.
* testing/lisp/test-org-element.el: Add tests.
* testing/lisp/test-ox.el: Refactor tests.
2013-05-25 14:35:24 +02:00
Nicolas Goaziou 62296ceb88 ox: Improve speed wrt table export
* lisp/ox.el (org-export-resolve-fuzzy-link): Change property name
  holding cache.
(org-export-table-has-header-p, org-export-table-row-group,
org-export-table-cell-width, org-export-table-cell-alignment): Cache
results.
(org-export-table-cell-address): Refactor.
(org-export-get-parent): Inline function.
* testing/lisp/test-ox.el: Update tests.
2013-05-18 18:20:46 +02:00
Nicolas Goaziou b70e77343a Fix options bug introduced in 16f12e
* lisp/ox.el (org-export-options-alist): Change default value
  for :title property.
(org-export--default-title): New dynamically scoped variable.
(org-export-store-default-title): New function.
(org-export--get-buffer-attributes): Remove title handling.
(org-export--get-global-options): Revert "ox: Fix default
title" (16f12e0aef).  Refactor code.
* testing/lisp/test-ox.el: Update a test.
2013-05-15 21:19:28 +02:00
Bastien Guerry 838e421bf5 Fix tests wrt commit 0c31a4fc 2013-05-15 16:31:44 +02:00
Nicolas Goaziou 48e51fe5d9 ox: Ignore whitespace differences when resolving a radio link
* lisp/ox.el (org-export-resolve-radio-link): Ignore whitespace
  differences when resolving a radio link.
* testing/lisp/test-ox.el: Add test.
2013-05-12 20:42:30 +02:00
Nicolas Goaziou e7cd6f1875 ox: Fix radio target resolution
* lisp/ox.el (org-export-resolve-radio-link): Fix radio target
  resolution.
* testing/lisp/test-ox.el: Add test.
2013-05-12 17:54:56 +02:00
Nicolas Goaziou 7d37898371 org-element: Be stricter when matching arguments in LaTeX environments
* lisp/org-element.el (org-element--current-element): Be stricter when
  matching arguments in LaTeX environments.  In particular, do not
  allow anything else than options and arguments in the opening line.
* testing/lisp/test-org-element.el: Add tests.
2013-05-12 17:15:06 +02:00
Nicolas Goaziou 16f12e0aef ox: Fix default title
* lisp/ox.el (org-export--get-global-options): Properly set default
  title, i.e. when to TITLE keyword is provided.
* testing/lisp/test-ox.el: Add tests.
2013-05-08 16:00:18 +02:00
Nicolas Goaziou be794a2a30 org-element: Fix visible-only parsing
* lisp/org-element.el (org-element--parse-elements): Also parse
  visible headlines within an otherwise compacted headline.
* testing/lisp/test-org-element.el: Add test.
2013-05-08 10:10:29 +02:00
Nicolas Goaziou 3e1d83bf6b ox: Fix caching for fuzzy link resolution
* lisp/ox.el (org-export-resolve-fuzzy-link): Fix caching process.
* testing/lisp/test-ox.el: Add test.
2013-05-04 09:03:00 +02:00
Nicolas Goaziou 41bd891d48 org-element: Recognize LaTeX environments with options
* lisp/org-element.el (org-element--current-element): Allow the
  opening string of a LaTeX environment to contain additional
  arguments.
* testing/lisp/test-org-element.el: Add tests.
2013-04-28 09:38:01 +02:00
Michael Brand 92f3729857 Allow also "#+NAME: table" for remote references
* lisp/org-table.el (org-table-get-remote-range): Extend regexp to
match "#+NAME: table" additionally to "#+TBLNAME: table".
* testing/lisp/test-org-table.el: Add test.
* testing/org-test.el (org-test-table-target-expect): Allow several
tables to support testing remote references in the last table.
2013-04-26 23:17:48 +02:00
Nicolas Goaziou 75c8be1d8b Fix error when filling a table from an affiliated keyword
* lisp/org.el (org-fill-paragraph): Move to table beginning before
  aligning the table when M-q is called from an affiliated keyword.
* testing/lisp/test-org.el: Add test.
2013-04-26 14:27:38 +02:00
Nicolas Goaziou 5efd7311e8 org-element: Fix interpretation of empty fixed-width elements
* lisp/org-element.el (org-element-fixed-width-interpreter): Fix
  interpretation of fixed-width elements with a nil or empty string
  value.
* testing/lisp/test-org-element.el: Add tests.
2013-04-26 10:38:05 +02:00
Nicolas Goaziou d408d721c3 ox: Fix `org-export-with-footnotes' behaviour
* lisp/ox.el (org-export--skip-p, org-export--interpret-p): When
  `org-export-with-footnotes' is nil, ignore completely footnotes
  references and definitions instead of exporting them verbatim.
* testing/lisp/test-ox.el: Add tests.
2013-04-21 23:44:18 +02:00
Nicolas Goaziou 60aa1682ce ox: Change scope for `org-export-with-timestamps'
* lisp/ox.el (org-export-with-timestamps): Only applies to isolated
  timestamps, i.e. timestamps in a paragraph containing only
  timestamps and empty strings.
(org-export--skip-p): Skip timestamps according to new behaviour.
* testing/lisp/test-ox.el: Update tests.
2013-04-18 16:58:56 +02:00
Michael Brand 45afcf137c Improve doc of empty fields
* doc/org.texi (Formula syntax for Calc): Improve the documentation of
empty fields in formulas for spreadsheet.
* testing/lisp/test-org-table.el: Rename wrongly named functions.
* testing/lisp/test-org-table.el: Use the more obvious "==" instead of
"=" for Calc conditions.
* testing/lisp/test-org-table.el (test-org-table/empty-field): Improve
the examples for vmean with empty fields.
2013-04-14 12:07:48 +02:00
Nicolas Goaziou 659edb40a5 ox: Allow to use empty strings in attributes
* lisp/ox.el (org-export-read-attribute): Allow to use empty strings
  in attributes.
* testing/lisp/test-ox.el: Add tests.

With this patch,

  #+attr_backend: :a "" becomes (:a "")
  #+attr_backend: :a """" becomes (:a "\"\"")
  ...
2013-04-10 18:50:52 +02:00
Michael Brand 5625a6ed79 org-table.el: Fix range len bugs for empty ranges
(org-table-make-reference): A range with only empty fields should lead
to length 0.
* testing/lisp/test-org-table.el: Adapt expected for several
ert-deftest.

The range len bugs may lead to wrong calculations for range references
with empty fields when the range len is relevant.  Affects typically
Calc vmean on simple range and without format specifier EN.  Also
Lisp with e. g. `length' on simple range or with L.

It is worth a small compatibility change: For a range with only empty
fields it is now possible and necessary to choose different behaviors
of vmean by adding the format specifiers E and/or N.

This is a follow-up of commit
764315b3fc.
2013-04-09 19:05:20 +02:00
Nicolas Goaziou 5f48315568 ox: Add function returning row number in a table
* lisp/ox.el (org-export-table-row-number): New function.
(org-export-table-cell-address): Use new function.
* testing/lisp/test-ox.el: Add test.
2013-04-09 16:52:41 +02:00
Achim Gratz 220b083091 test-ob-fortran: fix typo
* testing/lisp/test-ob-fortran.el (ob-fortran/preprocessor-var): Fix
  typo, write `preprocessor´ instead of `preprosessor´.
2013-04-07 11:49:37 +02:00
Achim Gratz 02137f0d6f test-ob-fortran: re-enable formerly failing test
* testing/lisp/test-ob-fortran.el (ob-fortran/character-var):
  Uncomment test that formerly failed.

This test seems to be working correctly on Linux and Cygwin.
Re-enable to see if it may not work on other systems and then check
why.
2013-04-07 11:47:48 +02:00
Achim Gratz 3aa78cf4bd test-ob-perl: improve test coverage
testing/lisp/test-ob-perl.el (test-ob-perl/table-passthrough-colnames-nil),
  (test-ob-perl/table-passthrough-colnames-no):
  Make some table entries numbers for better test coverage.
2013-04-07 11:28:57 +02:00
Ippei FURUHASHI 67a55acb39 org-table.el: Fix a bug of leaving the inserted TBLFM line
* org-table.el (org-calc-current-TBLFM): Ensure to remove the
currently inserted TBLFM line, when calling `org-table-recalculate'
returns an error and the processing stops.

* testing/lisp/test-org-table.el: Add test.

When you hit =C-c C-c= at the line of "#+TBLFM: $2=$1*2::$2=$1**2" in

    | 1 |   |
    | 2 |   |
    #+TBLFM: $2=$1*1
    #+TBLFM: $2=$1*2::$2=$1**2

you got:

    | 1 |   |
    | 2 |   |
    #+TBLFM: $2=$1*2::$2=$1**2
    #+TBLFM: $2=$1*1
    #+TBLFM: $2=$1*2::$2=$1**2

with the error message of:

    user-error: Double definition `$2=' in TBLFM line, please fix by hand

In this case, you expected:

    | 1 |   |
    | 2 |   |
    #+TBLFM: $2=$1*1
    #+TBLFM: $2=$1*2::$2=$1**2
2013-04-06 15:15:44 +02:00
Bastien Guerry c0589aa63a Merge branch 'master' of orgmode.org:org-mode 2013-04-05 08:38:07 +02:00
Ippei FURUHASHI 6693456dd7 org-table.el (org-calc-current-TBLFM): Add function
* org-table.el (org-calc-current-TBLFM): New function to
re-calculate the table by applying the #+TBLFM in the line
where the point is.

* org.el (org-ctrl-c-ctrl-c): Call `org-calc-current-TBLFM' when
point is in the #+TBLFM line.

* testing/lisp/test-org-table.el: Add test.
2013-04-05 08:37:51 +02:00
Ippei FURUHASHI c8c17460f1 org-table.el (org-TBLFM-begin): Add function
* org-table.el (org-TBLFM-begin): New defun.
(org-TBLFM-begin-regexp): New variable.

* testing/lisp/test-org-table.el: Add test.
2013-04-05 08:37:51 +02:00
Ippei FURUHASHI a268e33ef0 org.el (org-at-TBLFM-p): Add functon
* org.el (org-at-TBLFM-p): New defun.
(org-TBLFM-regexp): New defconst.

* testing/lisp/test-org-table.el: Add test.
2013-04-05 08:37:51 +02:00
Nicolas Goaziou 479c21336f Remove special behaviour for TARGET keyword
* lisp/org.el (org-store-link, org-link-search, org-options-keywords):
  Remove reference to TARGET keyword.
* lisp/ox.el (org-export-resolve-fuzzy-link, org-export-get-ordinal):
  Do not use TARGET as a destination for links anymore.
* testing/lisp/test-ox.el: Update tests.
* testing/lisp/test-org.el: Update tests.

Its specifications were not useful enough to keep maintaining this
feature.
2013-04-04 20:38:27 +02:00
Eric Schulte 86ce0790a1 change this failing test so that it no longer fails
I see no good way to get the code block name, not sure how we used to do
this, but it is definitely not supported by the current code.
2013-04-03 11:30:14 -06:00
Aaron Ecay 252238a60d Fix testing/lisp/test-ob-emacs-lisp.el
* testing/lisp/test-ob-emacs-lisp.el: Move stray test inside ert-deftest
2013-04-03 09:17:17 -06:00
Nicolas Goaziou 0bd6ccd6f9 ox: Add generic function to retrieve the date of a document
* lisp/ox.el (org-export-date-timestamp-format): New variable.
(org-export-get-date): New function.
* testing/lisp/test-ox.el: Add tests.
2013-04-02 23:55:28 +02:00
Nicolas Goaziou a82b06ae4b org-macro: Properly handle macros in setup files
* lisp/org-macro.el (org-macro--collect-macros): Fix a bug where
  reading a macro in a setup file would remove other macros read so
  far from template.  Change function signature.
(org-macro-initialize-templates): Apply signature change from function
above.
* testing/lisp/test-org-macro.el: Add test.
2013-04-01 15:47:39 +02:00
Nicolas Goaziou 55db57dc0a ox: Properly transfer bound variables through export process
* lisp/ox.el (org-export--list-bound-variables): Renamed from
  `org-export--install-letbind-maybe'.  Though, only return list of
  bound variables instead of installing them as buffer-local
  variables.
(org-export-get-environment): Use new function.  Take care of the
installation of bound variables.
(org-export--generate-copy-script): Make sure non-Org variables are
also installed in buffer copy.
* testing/lisp/test-ox.el: Add test.
2013-04-01 15:20:52 +02:00
Nicolas Goaziou 7736c2d7fb ox: Handle BIND keywords in SETUPFILE files
* lisp/ox.el (org-export-get-environment): Update comment.
(org-export--install-letbind-maybe): Go into SETUPFILE files and
handle BIND keywords there.
* testing/examples/setupfile.org: Update test file.
* testing/lisp/test-ox.el: Add tests.
2013-03-29 21:51:57 +01:00
Nicolas Goaziou a6d9fd82ea ox: White spaces after export snippets are never ignored
* lisp/ox.el (org-export-data): White spaces after export snippets are
  never ignored.
* testing/lisp/test-ox.el: Add test.

Back-end developers should pay attention to the fact that white spaces
before and after an ignored export snippet now are accumulated in the
output.
2013-03-25 20:29:31 +01:00
Bastien Guerry 78959943e2 Merge branch 'master-group-tags2' 2013-03-25 06:59:23 +01:00
Nicolas Goaziou 42e1a6351d org-element: Allow to escape escaping character before a comma
* lisp/org-element.el (org-element-macro-parser): Allow to escape
  escaping character before a comma.  Also do not trim spaces at
  argument boundaries.
* doc/org.texi (Macro replacement): Update documentation about
  possible locations and escaping mechanism.
* testing/lisp/test-org-element.el: Add tests.

With this patch, macro's arguments are read as the following:

  "a,b"     -> '("a" "b")
  "a\,b"    -> '("a,b")
  "a\\,b"   -> '("a\" "b")
  "a\\\,b"  -> '("a\,b")
  "a\\\\,b" -> '(a"\\" "b")

Note that with the patch, you only need to escape backslashes before
a comma:

  "a\\b\,c" -> '("a\\b,c")
2013-03-23 20:42:34 +01:00
Bastien Guerry 2922c1365d testing/lisp/: Use non-obsolete variable names (see previous commit)
* test-org-list.el (test-org-list/cycle-bullet)
(test-org-list/move-item-down, test-org-list/move-item-up)
(test-org-list/insert-item): Use non-obsolete variable names.

* test-org-element.el (test-org-element/at-point): Use
`org-list-empty-line-terminates-plain-lists'.
2013-03-23 17:45:26 +01:00
Bastien Guerry ae85aa0d32 test-ox.el (test-org-export/define-derived-backend, test-org-export/derived-backend-p): Uncomment
* test-ox.el (test-org-export/define-derived-backend)
(test-org-export/derived-backend-p): Uncomment.
2013-03-19 19:39:35 +01:00