Commit Graph

193 Commits

Author SHA1 Message Date
Nicolas Goaziou 07c8895705 org-element: Fix void-function org-clocking-buffer error
* lisp/org-element.el (org-element-headline-parser,
  org-element-inlinetask-parser): Fix void-function
  org-clocking-buffer error.
2012-10-29 16:26:34 +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 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 89ec3f1abf org-element: Add `:post-affiliated' property to elements when applicable
* lisp/org-element.el (org-element-center-block-parser,
  org-element-drawer-parser, org-element-dynamic-block-parser,
  org-element-footnote-definition-parser,
  org-element-plain-list-parser, org-element-property-drawer-parser,
  org-element-quote-block-parser, org-element-special-block-parser,
  org-element-babel-call-parser, org-element-comment-parser,
  org-element-comment-block-parser, org-element-diary-sexp-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-src-block-parser,
  org-element-table-parser, org-element-verse-block-parser): Add
  `:post-affiliated' property to elements.
(org-element-inlinetask-parser): Remove affilated keywords.
* lisp/org.el (org-adaptive-fill-function): Use new property.

This property is cheap to compute during parsing and allows to
determine if point is on an affiliated keyword or not by checking if
it is between :begin and :post-affiliated positions.
2012-10-29 11:02:06 +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 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 1d58b0b2cd org-element: Small refactoring
* lisp/org-element.el (org-element-horizontal-rule-parser,
  org-element-keyword-parser, org-element--current-element): Small
  refactoring.
2012-10-27 14:37:18 +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
Bastien Guerry 47486f4b90 Merge branch 'maint' 2012-10-23 18:39:32 +02:00
Bastien Guerry 95ca977411 Fix typos fixed in Emacs (part 1)
Thanks to Paul Eggert for the fixes:
http://lists.gnu.org/archive/html/emacs-diffs/2012-10/msg00069.html
2012-10-23 18:39:20 +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 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
Bastien Guerry 4f0b3bfe0c Merge branch 'maint' 2012-10-02 13:07:09 +02:00
Bastien Guerry e4c31cf98b Use generated-autoload-file: "org-loaddefs.el" as a local variable. 2012-10-02 08:50:46 +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 934208ece1 org-element: Allow links in captions
* lisp/org-element.el (org-element-object-restrictions): Allow links
  in caption. Also allow inline-src-blocks and inline-babel-calls.
* contrib/lisp/org-e-ascii.el (org-e-ascii--unique-links): Handle
  links in captions.
(org-e-ascii--describe-links): Small refactoring.
(org-e-ascii-template--document-title): Handle links in document
properties.
2012-09-30 23:57:45 +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 e74523905b org-element: Distinguish parsed affiliated keywords from document properties
* lisp/org-element.el (org-element-parsed-keywords): Remove document
  properties from the value.
(org-element-dual-keywords): Fix docstring.
(org-element-document-properties): New variable
* contrib/lisp/org-export.el (org-export--get-subtree-options,
  org-export--get-inbuffer-options, org-export--get-global-options):
  Use new variable instead of parsed keywords.
2012-09-30 23:57:45 +02:00
Nicolas Goaziou 9f7fd9d2bb Merge branch 'maint' 2012-09-30 13:38:07 +02:00
Nicolas Goaziou 52df4aba9b org-element: Fix 1ad58a8230
* lisp/org-element.el (org-element-paragraph-parser): Fix regexp
  starting a block.
2012-09-30 13:36:44 +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
Bastien Guerry 33ab30ca2a Merge branch 'maint' 2012-09-29 09:39:22 +02:00
Nicolas Goaziou 9c92312d92 org-element: Fix parsing for headlines with only a COMMENT or QUOTE keyword
* lisp/org-element.el (org-element-headline-parser): Fix parsing for
  headlines with a single COMMENT or QUOTE keyword.
* testing/lisp/test-org-element.el: Add tests.
2012-09-29 08:54:46 +02:00
Bastien Guerry bf072bd647 Merge branch 'maint' 2012-09-24 19:15:59 +02:00
Bastien Guerry 9aff6ffe8a Add COPYING and fix other related issues.
Mention COPYING in READMEs.
Fix the header of ob-fortran.el (see this fix in Emacs trunk:
http://lists.gnu.org/archive/html/emacs-diffs/2012-09/msg00365.html)
Specify that org-colview-xemacs.el is *not* part of Emacs.
Specify that org-element.el is part of Emacs (prepare the sync.)
Add COPYING in the release (mk/server.mk).
2012-09-24 19:15:42 +02:00
Nicolas Goaziou b60445cfd4 org-element: Define a new element: node-property
* lisp/org-element.el (org-element-all-elements): Add `node-property'
  as a new element type.
(org-element-greater-elements): Add property-drawer element to greater
  elements since they now contain node-property elements.
(org-element-drawer-parser): Small refactoring.
(org-element-property-drawer-parser): Move into Greater Elements file
section.
(org-element-node-property-parser,
org-element-node-property-interpreter): New functions.
(org-element--current-element, org-element-at-point,
org-element--parse-elements): Handle new element type.
* testing/lisp/test-org-element.el: Add tests.
2012-09-23 19:10:27 +02:00
Nicolas Goaziou 393acf0df8 org-element: Fix for affiliated keywords parsing
* lisp/org-element.el (org-element--collect-affiliated-keywords): Fix
  return value.
* testing/lisp/test-org-element.el: Add test.
2012-09-23 09:49:32 +02:00
Nicolas Goaziou baed7dc7db org-element: Optimize affiliated keywords parsing
* lisp/org-element.el (org-element-center-block-parser,
  org-element-drawer-parser, org-element-dynamic-block-parser,
  org-element-footnote-definition-parser,
  org-element-plain-list-parser, org-element-quote-block-parser,
  org-element-special-block-parser, org-element-babel-call-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-property-drawer-parser,
  org-element-src-block-parser, org-element-table-parser,
  org-element-verse-block-parser): Change signature. Now use an
  additional argument: affiliated.
(org-element--current-element): Skip affiliated keywords and pass them
  as an argument to parsers.  It prevents to walk through these
  keywords twice: the first time to get to the first line of the
  element, and a second time to collect the affiliated keywords.
* contrib/lisp/org-export.el (org-export-get-caption): Update function
  since multiple affiliated keywords are now reversed.
* testing/lisp/test-org-element.el: Update tests.
2012-09-20 20:08:16 +02:00
Nicolas Goaziou 7c40e0c6ba Merge branch 'maint' 2012-09-20 19:14:43 +02:00
Nicolas Goaziou fd5cc62ca5 org-element: Fix inline-src-block parsing at the beginning of an item
* lisp/org-element.el (org-element-inline-src-block-successor): Fix
  inline-src-block parsing at the beginning of an item.
* testing/lisp/test-org-element.el: Add test.
2012-09-20 19:13:40 +02:00
Nicolas Goaziou fe140488aa org-element: Allow multiple caption keywords
* lisp/org-element.el (org-element-multiple-keywords): Allow multiple
  caption keywords.
* contrib/lisp/org-export.el (org-export-get-caption): New function.
* testing/lisp/test-org-element.el: Add tests.
* testing/lisp/test-org-export.el: Add tests.
2012-09-13 17:33:46 +02:00
Nicolas Goaziou 0b13ec8c1b Merge branch 'maint' 2012-09-13 13:17:17 +02:00
Nicolas Goaziou 4a7c99134c org-element: Fix caption parsing
* lisp/org-element.el (org-element--collect-affiliated-keywords): Fix
  caption parsing.
* testing/lisp/test-org-element.el: Add tests.
2012-09-13 13:15:39 +02:00
Bastien Guerry aac2e8b93f Merge branch 'maint' 2012-09-12 15:50:25 +02:00
Nicolas Goaziou f969e24a43 org-element: Fix parsing for items/footnote definitions starting with special syntax
* lisp/org-element.el (org-element--current-element): At the very
  beginning of a footnote definition or an item, next element is
  always a paragraph.
* testing/lisp/test-org-element.el: Add tests.

This patch fixes parsing for following cases:

 - - text

or

[fn:1] # Some text
2012-09-12 15:45:10 +02:00
Nicolas Goaziou 8e44533339 Merge branch 'maint' 2012-09-09 14:14:54 +02:00
Nicolas Goaziou f29131c3d2 org-element: Handle nil titles in headlines
* lisp/org-element.el (org-element-headline-parser): Handle nil
  titles.
(org-element-inlinetask-parser): Add :raw-value property.  Also handle
nil titles.
2012-09-09 14:13:24 +02:00
Nicolas Goaziou 90aae1e2e8 Merge branch 'maint' 2012-09-01 22:57:19 +02:00
Nicolas Goaziou 8d09d1aaa9 org-element: Fix section parsing
* lisp/org-element.el (org-element-section-parser): Make sure section
  cannot contain an headline.
(org-element--current-element): Fix bug requiring to parse a quote
section even when point is at an headline.
* testing/lisp/test-org-element.el: Add test.
2012-09-01 22:55:31 +02:00
Nicolas Goaziou 3a6a5c458f org-element: Remove `macro' from recursive object types
* lisp/org-element.el (org-element-recursive-objects,
  org-element-object-restrictions): Remove `macro' from recursive
  object types.
2012-09-01 13:04:59 +02:00
Bastien Guerry e72acc0e1f Merge branch 'maint' 2012-08-30 10:25:58 +02:00
Mats Lidell 8e88bc0e0b org-element.el: Remove illegal t clause in case
* lisp/org-element.el (org-element-paragraph-separate): Remove
redundant and misplaced t clause in case.

TINYCHANGE
2012-08-30 10:25:44 +02:00
Nicolas Goaziou ab075316b0 Merge branch 'maint' 2012-08-25 23:46:18 +02:00
Nicolas Goaziou 11082518ee org-element: Tiny refactoring
* lisp/org-element.el (org-element-paragraph-parser): Tiny refactoring.
2012-08-25 23:45:14 +02:00
Nicolas Goaziou 967f20c9a9 Merge branch 'maint' 2012-08-25 23:31:10 +02:00
Nicolas Goaziou 3113c5fce9 org-element: Small code comment clean-up
* lisp/org-element.el (org-element-paragraph-parser): Remove trailing
  code comments.
2012-08-25 23:30:29 +02:00
Nicolas Goaziou 1f3d1f55fe Merge branch 'maint' 2012-08-25 15:28:40 +02:00
Nicolas Goaziou b4604d2833 org-element: Fix filling bug in a list with affiliated keyword
* lisp/org-element.el (org-element-paragraph-parser): Fix parsing of
   paragraph at the beginning of an item.
* testing/lisp/test-org-element.el: Add test.
2012-08-25 15:27:01 +02:00
Nicolas Goaziou d86f09a854 org-element: Extract search option and application in "file"-type links
* lisp/org-element.el (org-element-link-type-is-file): New variable.
(org-element-link-parser): Extract search option and application in
"file"-type links.
* contrib/lisp/org-e-html.el (org-e-html-link): Remove components
  extraction since this in now done in `org-element-link-parser'.
* contrib/lisp/org-e-odt.el: Remove components extraction since this
  in now done in `org-element-link-parser'.
* contrib/lisp/org-e-texinfo.el (org-e-texinfo-link): Remove
  components extraction since this in now done in
  `org-element-link-parser'.
* contrib/lisp/org-e-latex.el (org-e-latex-link): Remove components
  extraction since this in now done in `org-element-link-parser'.
* contrib/lisp/org-e-man.el (org-e-man-link): Remove components
  extraction since this in now done in `org-element-link-parser'.
* contrib/lisp/org-e-groff.el (org-e-groff-link): Remove components
  extraction since this in now done in `org-element-link-parser'.
* contrib/lisp/org-md.el (org-md-link): Remove components extraction
  since this in now done in `org-element-link-parser'.
* testing/lisp/test-org-element.el: Add tests.
2012-08-25 10:38:25 +02:00
Nicolas Goaziou 4bc4e8ec18 org-element: Paragraphs don't end at incomplete latex environments
* lisp/org-element.el (org-element-paragraph-separate): Since this
  variable is meant to be searched forward, \end{...} shouldn't
  trigger the end of a paragraph before checking if it is the end of
  a complete environment.
(org-element-latex-environment-parser): Slight change to the regexp
matching the beginning of a latex environment.
(org-element-paragraph-parser): Paragraphs don't end at incomplete
latex environments.
(org-element-latex-or-entity-successor): Remove paragraph environments
from latex fragment search.
2012-08-24 12:58:42 +02:00
Nicolas Goaziou 49905a5669 org-element: Fix comment typo
* lisp/org-element.el (org-element-map): Fix comment typo.
2012-08-20 11:21:16 +02:00
Nicolas Goaziou ec9e7ab9c1 org-element: Add a couple of autoload cookies 2012-08-20 10:16:21 +02:00
Nicolas Goaziou 7a1bd94df1 org-element: Fix some code comments 2012-08-18 13:34:27 +02:00
Nicolas Goaziou ad94a9433b Addendum to 50a434bb9f
* lisp/org-element.el (org-element-item-parser): Do not remove tag
  from body if list isn't descriptive.
* lisp/org-list.el (org-insert-item): Only ask about a term for
  descriptive lists.
(org-list-struct, org-list-insert-item): Do not recognize a tag in an
ordered list.
* testing/lisp/test-org-element.el: Add test.
2012-08-18 13:13:31 +02:00
Nicolas Goaziou 3f57803fb4 org-element: Generalize `org-element-adopt-element' into `org-element-adopt-elements'
* lisp/org-element.el (org-element-set-element): Rewrite function.
(org-element-adopt-elements): New function.
(org-element-adopt-element): Removed function.
(org-element--parse-elements, org-element--parse-objects): Use new function.
* testing/lisp/test-org-element.el: Update tests.
2012-08-18 10:13:35 +02:00
Nicolas Goaziou 8ab1d76529 org-element: Fix previous patch
* lisp/org-element.el (org-element-paragraph-parser): Fix previous patch.
* testing/lisp/test-org-element.el: Add tests.
2012-08-17 17:40:32 +02:00
Nicolas Goaziou b1ed817e38 org-element: Use strict comment syntax (no "#+" allowed)
* lisp/org.el (org-fill-paragraph): No need to use
  `org-element-paragraph-separate' in a verse block since blank lines
  only can end a "paragraph".
* lisp/org-element.el (org-element-paragraph-separate): Apply changes
  to comments.
(org-element-paragraph-parser): Correctly find end of paragraphs.
(org-element--current-element): Require colons for Babel calls.
(org-element-center-block-parser, org-element-dynamic-block-parser,
org-element-quote-block-parser, org-element-special-block-parser,
org-element-comment-block-parser, org-element-example-block-parser,
org-element-export-block-parser, org-element-src-block-parser,
org-element-verse-block-parser): Fall-back to paragraph parsing when
incomplete or ill-formed.
* testing/lisp/test-org-element.el: Update tests.
2012-08-17 16:58:26 +02:00
Nicolas Goaziou 16a2203f6f org-element: Small refactoring
* lisp/org-element.el (org-element-swap-A-B): Small refactoring.
2012-08-14 10:18:42 +02:00
Nicolas Goaziou 31aa36ca19 org-element: Fix typo in docstring
* lisp/org-element.el (org-element-text-markup-successor): Fix typo in
  docstring.
2012-08-12 00:51:50 +02:00
Nicolas Goaziou 8fc893a036 org-element: Fix small bug
* lisp/org-element.el (org-element-at-point): Return consistent value
  when function is called on a blank line within a plain list.
* testing/lisp/test-org-element.el: Add test.
2012-08-12 00:48:09 +02:00
Bastien Guerry 70dd1196d2 Massive code clean-up.
Delete trailing whitespaces.
Indent all sexps correctly.
Sentences end with double spaces.
2012-08-11 19:10:44 +02:00
Nicolas Goaziou d856b29b3b org-element: Fix comments in paragraph separator regexp
* lisp/org-element.el (org-element-paragraph-separate): Fix comments
  in paragraph separator regexp.  Optimize it.
2012-08-11 17:38:46 +02:00
Nicolas Goaziou b523a3edf5 Fix tests
* lisp/org-element.el: Update code commets.
* testing/lisp/test-org-element.el: Remove tests for renamed
  navigation and manipulation fuctions.
* testing/lisp/test-org.el: Add tests for renamed navigation and
  manipulation functions.
2012-08-08 13:58:14 +02:00
Bastien Guerry f485b0a889 Move org-element commands to org.el and rename them.
* org.el (org-forward-element): Rename from
`org-element-forward'.
(org-backward-element): Rename from `org-element-backward'.
(org-up-element): Rename from `org-element-up'.
(org-down-element): Rename from `org-element-down'.
(org-drag-element-backward): Rename from
`org-element-drag-backward'.
(org-drag-element-forward): Rename from
`org-element-drag-forward'.
(org-mark-element): Rename from `org-element-mark-element'.
(org-transpose-element): Rename from `org-element-transpose'.
(org-unindent-buffer): Rename from
`org-element-unindent-buffer'.
(org-mode-map): Update the names of a commands.
Remove useless declarations.

* org-element.el (org-element-forward, org-element-backward)
(org-element-up, org-element-down)
(org-element-drag-backward, org-element-drag-forward)
(org-element-mark-element, org-narrow-to-element)
(org-element-transpose, org-element-unindent-buffer): Move to
org.el.
2012-08-08 11:57:37 +02:00
Nicolas Goaziou 0a04169769 org-element: Fix `org-element-at-point' in some corner cases
* lisp/org-element.el (org-element-item-parser,
  org-element-plain-list-parser): Make sure that the element ends at
  the beginning of a line if possible.
(org-element-at-point): Return expected element when point is at an
element's end or at its contents' end.
* testing/lisp/test-org-element.el: Add test.
* testing/lisp/test-org.el: Add test.
2012-08-08 09:56:28 +02:00
Bastien Guerry 01bd28be69 org-element.el (org-narrow-to-element): Autoload.
* org-element.el (org-narrow-to-element): Autoload.
2012-08-06 20:11:33 +02:00
Bastien Guerry 7efbd4222d org.el: Enhance `C-c @' and use `M-h' for `org-element-mark-element'.
* org.el (org-mode-map): Use `M-h' for
`org-element-mark-element'.
(org-mark-subtree): Allow a numeric prefix argument to move up
into the hierarchy of headlines.

* org-element.el (org-element-up, org-element-down): Autoload.
2012-08-06 20:02:54 +02:00
Bastien Guerry 1276ab3ff1 Fix compiler warnings.
* org.el: Declare functions and don't require org-element.

* org-element.el (org-element-at-point, org-element-forward)
(org-element-backward, org-element-drag-backward)
(org-element-drag-forward, org-element-mark-element)
(org-element-transpose, org-element-unindent-buffer): Autoload.
Require 'org and remove all declarations.
2012-08-06 19:13:43 +02:00
Bastien Guerry 8e4f897c49 org-element.el: Declare variables. 2012-08-06 17:06:13 +02:00
Bastien Guerry 4ea4cc848c org-element.el: Declare more functions to fix compiler warnings. 2012-08-06 16:47:58 +02:00
Bastien Guerry 7791d40045 Add declarations to org-element.el 2012-08-05 20:14:21 +02:00
Nicolas Goaziou 9d045b21bb org-element: Consider first "+" as a comment when parsing an ill-defined keyword
* lisp/org-element.el (org-element-comment-parser): Consider first "+"
  as a comment when parsing an ill-defined keyword.
2012-08-04 10:19:27 +02:00
Nicolas Goaziou ecba5542e6 org-element: List interpretation doesn't depend on its structure
* lisp/org-element.el (org-element-item-interpreter): Simplify bullet
  creation.
(org-element-plain-list-interpreter): Fix wrong bullets, if needed.

This change allows to intrepret plain lists without providing list's
structure, which can be a bit hairy.  For example, the following
snippet now suffices to create a list programmatically:

  (org-element-interpret-data
   '(plain-list nil
                (item (:bullet "-") (paragraph nil "a"))
                (item (:bullet "-") (paragraph nil "b"))))
2012-08-02 21:56:39 +02:00
Nicolas Goaziou eb2eacf91d org-element: Fix parsing when a keyword follows the commented line
* lisp/org-element.el (org-element-comment-parser): Fix parsing when
  a keyword follows the commented line.
* testing/lisp/test-org-element.el: Add test.
2012-08-02 19:47:14 +02:00
Nicolas Goaziou a8e00ff0dc Inlined comment syntax is reduced to "#"
* lisp/org.el (org-mode): Define new comment syntax.
(org-fontify-meta-lines-and-blocks-1, org-strip-protective-commas,
org-fill-context-prefix, org-insert-comment,
org-comment-or-uncomment-region): Use new comment syntax.
* lisp/org-element.el (org-element-comment-parser,
  org-element-comment-interpreter, org-element--current-element): Use
  new comment syntax.
* testing/lisp/test-org-element.el: Update tests.
* testing/lisp/test-org.el: Update tests.
2012-08-01 10:47:47 +02:00
Bastien Guerry eb5631359a Update a few keybindings in org.el and fix a problem in org-element.el.
* org.el: Update a few keybindings.

Use [(control down)] and "\M-}" for `org-element-forward'.
Use [(control up)] and "\M-{ `org-element-backward'.
Use "\C-c\C-^" for `org-element-up'.
Use "\C-c\C-_" for `org-element-down'.
Use "\C-c\C-@" for `org-element-mark-element'.

* org-element.el (org-element-down): Throw an error when the
element has no content.
2012-07-31 16:11:45 +02:00
Nicolas Goaziou 7cf9e5afb5 org-element: Modify output from `org-element-at-point' and `org-element-context'
* lisp/org-element.el (org-element-at-point): Add :parent property to
  output.
(org-element-context): Add :parent property to output.  Also return
a single element or object instead of a list of parents.
(org-element-forward, org-element-up): Apply changes.
* testing/lisp/test-org-element.el: Add tests.
2012-07-30 00:40:21 +02:00
Nicolas Goaziou 4b9aaf60d1 org-element: Fix `org-element-at-point' function
* lisp/org-element.el (org-element-at-point): Fix function when buffer
  starts with an inlinetask.  Also fix it when called on the last
  element in a greater element or the buffer.
2012-07-29 00:08:18 +02:00
Nicolas Goaziou e7397fda3f org-element: Refactor code
* lisp/org-element.el (org-element-center-block-parser,
  org-element-dynamic-block-parser,
  org-element-footnote-definition-parser,
  org-element-headline-parser, org-element-inlinetask-parser,
  org-element-quote-block-parser, org-element-special-block-parser,
  org-element-plain-list-parser): Refactor code.
 (org-element-drawer-parser): Fall-back to paragraph parser when
  drawer is incomplete.
* testing/lisp/test-org-export.el: Update test.
2012-07-29 00:08:18 +02:00
Nicolas Goaziou 2227a17691 org-element: Fix paragraph parsing
* lisp/org-element.el (org-element-paragraph-separate): Refactor.
(org-element-paragraph-parser): Fix paragraph parsing.
* testing/lisp/test-org-element.el: Add test.
2012-07-28 14:35:35 +02:00
Nicolas Goaziou b04f9e3268 `org-fill-paragraph' is backed up by Org Element
* lisp/org.el (org-fill-paragraph): Rewrite function using
  `org-element-at-point'.
* lisp/org-element.el (org-element-fill-paragraph): Remove function.
* testing/lisp/test-org-element.el: Remove test.
* testing/lisp/test-org.el: Add test.
2012-07-28 11:47:58 +02:00
Achim Gratz 044b0ff7e8 Fix breakage from previous commit
* lisp/org-element.el: Do not (require 'org).

* lisp/org-agenda.el: Remove duplicate requires.
2012-07-28 07:21:20 +02:00
Achim Gratz c2735e7c19 Re-apply (correctly): Move org-element.el from contrib/lisp to lisp/.
* org.el (org-mode-map): Add keybindings to
`org-element-transpose' and `org-narrow-to-element'.
(org-metaup): Fall back on `org-element-drag-backward'.
(org-metadown): Fall back on `org-element-drag-forward'.
Also move chunks of declarations and require statements to
get rid of compiler warnings.

* org-exp-blocks.el (org): Don't require org.  Add declarations.

* org-clock.el (org): Don't require org.

* ob-exp.el (org-list-forbidden-blocks): Add declarations.
2012-07-28 07:06:25 +02:00
Renamed from contrib/lisp/org-element.el (Browse further)