Commit Graph

976 Commits

Author SHA1 Message Date
Nicolas Goaziou 8094d01a68 org-table: Simplify `org-table-sort-lines'
* lisp/org-table.el (org-table-sort-lines): Rely on `sort-subr'.
  Refactor code.
(org-table--do-sort): Remove function.

* testing/lisp/test-org-table.el (test-org-table/sort-lines): Fix test.
2015-08-02 18:01:15 +02:00
Nicolas Goaziou 6e1d7bc8fe Fix `org-beginning-of-line'
* lisp/org.el (org-beginning-of-line): Prevent an error when buffer
  contains only a single star.

* testing/lisp/test-org.el (test-org/beginning-of-line): Add tests.
2015-07-22 09:39:07 +02:00
Nicolas Goaziou d6e6016ba6 test-org-clock: Fix failing test (again)
* testing/lisp/test-org-clock.el (test-org-clock/clocktable): Update
  test.
(test-org-clock/clocktable1, test-org-clock/clocktable2,
test-org-clock/clocktable-until-now): Merge tests into the previous one.
2015-07-18 18:58:12 +02:00
Nicolas Goaziou f6b5178156 test-org-clock: Fix failing test
* testing/lisp/test-org-clock.el (test-org-clock/clocktable): Fix
  clocktable creation.

(test-org-clock/clocktable1):
(test-org-clock/clocktable2):
(test-org-clock/clocktable-until-now): Update tests.
2015-07-18 00:39:43 +02:00
Nicolas Goaziou 120dcd1d13 org-table: Fix table alignment
* lisp/org-table.el (org-table-align): Refactor function fix wrong
  alignment bug.
* lisp/org-compat.el (org-format-transports-properties-p): Remove
  variable.
* testing/lisp/test-org.el (test-org/fill-paragraph): Fix test

Reported-by: William Denton <wtd@pobox.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/98901>
2015-07-09 17:53:33 +02:00
Nicolas Goaziou c76fef6b9d org-clock: Add `untilnow' time block
* lisp/org-clock.el (org-clock-special-range): Handle `untilnow'
  range.
(org-clock--oldest-date): New variable.
(org-clock-display-default-range): Add `untilnow' as valid range.  Use
new variable.
(org-clock-display): Offer `untilnow' as a possible range.

* doc/org.texi (The clock table): Document `untilnow'

* testing/lisp/test-org-clock.el (test-org-clock-clocktable-contents-at-point): Fix test
when called interactively.
(test-org-clock/clocktable):
(test-org-clock/clocktable1): Update tests.
(test-org-clock/clocktable-until-now): New test.

* etc/ORG-NEWS (title): Document new feature.

Suggested-by: Sébastien Vauban
2015-07-04 14:31:34 +02:00
Nicolas Goaziou 188bae903f Fix property inheritance with extended values
* lisp/org.el (org-property--local-values): New function.
(org-entry-get): Use new function.  Ignore global values when there is
no inheritance.
(org-entry-get-with-inheritance): Fix extended values, which do not
stop anymore inheritance search.

* testing/lisp/test-org.el (test-org/entry-get): Add tests.
2015-07-03 15:34:47 +02:00
Nicolas Goaziou 1221715a74 org-element: Fix parsing recursive babel calls
* lisp/org-element.el (org-element-babel-call-parser): Fix parsing
  recursive babel calls.

* testing/lisp/test-org-element.el (test-org-element/babel-call-parser): Add test.
2015-07-03 00:33:45 +02:00
Nicolas Goaziou 106ca75307 org-element: Fix table and table.el mix
* lisp/org-element.el (org-element-table-parser): Properly parse an
  Org table followed by a line starting with a "+".

* testing/lisp/test-org-element.el (test-org-element/context): Fix
  test.
2015-06-28 21:09:16 +02:00
Kyle Meyer 5f3d8037a5 org-add-planning-info: Improve deletion handling
* lisp/org.el (org-add-planning-info): Reset point before each
  planning entry search.  Clean up extra spaces.

* testing/lisp/test-org.el (test-org/add-planning-info): Add tests.

- Reposition save-excursion call to reset point every dolist
  iteration.  Otherwise, the order of the entries to be removed
  matters, and a call like

      (org-add-planning-info nil nil 'scheduled 'deadline)

  on

      DEADLINE: <2015-06-26 Fri> SCHEDULED: <2015-06-26 Fri>

  will fail to remove the deadline entry.

- Delete leading white space even when at the beginning of the line so
  that, when org-adapt-indentation is nil, a space is not inserted
  when removing the leading planning info entry.

  This prevents headings with repeating entries like

      SCHEDULED: <2015-06-26 Fri +1w>

  from being closed and recycled with an extra space in front of
  SCHEDULED.

- Add leading white space to the planning info entry regexp to prevent
  leftover white space when removing entries other than the first
  entry.
2015-06-28 09:03:46 +02:00
Nicolas Goaziou b07bd32081 ox: Handle subtree properties referring to multiple options
* lisp/ox.el (org-export--get-subtree-options): When multiple options
  refer to the same keyword, and, as a consequence, to the same export
  property, make sure all of them get updated.
* testing/lisp/test-ox.el (test-org-export/get-subtree-options): Add
  test.

Reported-by: Myles English <mylesenglish@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/98583>
2015-06-23 22:09:43 +02:00
Nicolas Goaziou 47265b31ca ox: Add external footnotes definitions in parse tree
* lisp/ox.el (org-export-get-environment):
(org-export-collect-tree-properties):
Remove :footnote-definition-alist property.
(org-export-get-footnote-definition): Apply removal of property.

(org-export--merge-external-footnote-definitions): New function.
(org-export-as): Use new function.

* testing/lisp/test-ox.el (test-org-export/footnotes): Update tests.

This change allows to have all footnote definitions within the parse
tree, so they can be reached with, e.g., a parse tree filter.
2015-06-23 15:28:01 +02:00
Kyle Meyer 329683861c org-clone-subtree-with-time-shift: Accept 0 clones
* lisp/org.el (org-clone-subtree-with-time-shift): Allow argument
  specifying number of clones to be 0.

* testing/lisp/test-org.el (test-org/clone-with-time-shift): Add
  tests.

This makes it possible to clone a subtree with a repeating timestamp
so that the repeater is removed from the original subtree and a single
shifted, repeating clone is created.  If the original subtree does not
have a repeating timestamp, no clones will be made.
2015-06-22 21:49:52 +02:00
Nicolas Goaziou 739853d128 Tiny speed-up for `org-entry-properties'
* lisp/org.el (org-entry-properties): Tiny speed-up.
* testing/lisp/test-org.el (test-org/entry-properties): Add test.
2015-06-22 10:01:51 +02:00
Nicolas Goaziou d1f9aa3a02 ox: Simplify fuzzy link matching
* lisp/ox.el (org-export-resolve-fuzzy-link): When a fuzzy link
  matches more than one headline, prefer the first one in the parse
  tree.

* testing/lisp/test-ox.el (test-org-export/fuzzy-link): Remove a test.

This behaviour is consistent with `org-open-at-point'.  Also, it
allows to cache destinations.
2015-06-16 23:24:42 +02:00
Nicolas Goaziou 2c27e85f11 Sanitize link encoding
* lisp/org.el (org-store-link): Improve docstring.
(org-make-link-string): Escape internal links only when absolutely
necessary.
(org-link-escape-chars): Add percent character.
(org-link-escape-chars-browser): Make space character more visible.
(org-link-escape): Refactor code.
(org-display-inline-images): Properly unescape path before creating
the link.
(org-extract-attributes): Remove function.

* lisp/ox.el (org-export-resolve-fuzzy-link): Decode path before
  resolving link.

* testing/lisp/test-ox.el (test-org-export/resolve-fuzzy-link): Add
  test.
2015-06-16 23:24:38 +02:00
Nicolas Goaziou 182ff104b7 org-element: Fix cache bug for orphaned elements
* lisp/org-element.el (org-element--cache-sync-requests): Remove a now
  useless element from requests
(org-element--cache-submit-request): Apply change to sync request.
(org-element--cache-process-request): Apply change to sync requests.
Fix removal of orphaned elements, i.e., elements not affected by
a change, but with an ancestor that was.

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

Reported-by: Suvayu Ali <fatkasuvayu+linux@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/98260>
2015-06-14 14:52:04 +02:00
Nicolas Goaziou a4cc9d82d8 org-list: Fix checkbox update with inlinetasks
* lisp/org-list.el (org-update-checkbox-count): Change algorithm.  Use
  Element parser.

* testing/lisp/test-org-list.el (test-org-list/update-checkbox-count):
  New test.

Reported-by: Eric S Fraga <e.fraga@ucl.ac.uk>
<http://permalink.gmane.org/gmane.emacs.orgmode/97594>
2015-06-09 17:06:17 +02:00
Brice Waegeneire 93cc5fb517 org-timer.el: hh:mm:ss format for setting a timer
* lisp/org-timer.el (org-timer-set-timer): Add support for hh:mm:ss
format.
(org-timer-default-timer): Type changed from number to string.
* testing/lisp/test-org-timer.el (test-org-timer/set-timer): Add
hh:mm:ss format in the test.
2015-06-02 23:18:13 +02:00
Bjarte Johansen f6c75f2e41 Org Babel now supports sed scripts
* doc/org.texi: Signal new babel language.

* lisp/ob-sed.el:
* testing/examples/ob-sed-test.org:
* testing/lisp/test-ob-sed.el: New files.
2015-05-30 14:59:01 +02:00
Nicolas Goaziou d6377d7e11 test-ob: Simplify a test
* testing/lisp/test-ob.el (test-org-babel/inline-src-blocks): Make
  test self-contained.  Do not use `macrolet' either.
2015-05-26 21:24:20 +02:00
Bjarte Johansen b6934e3471 ob-core: Fix indented cached result returning nil
Fix a problem where a source block would return nil oif the result was
cached and it was indented.

* lisp/ob-core.el (org-babel-execute-src-block): Move point to the the
 first character of the result instead of the beginning of the line.

* testing/lisp/test-ob.el
 (test-org-babel/indented-cached-org-bracket-link): Added test to
 to see if the indented cached result returns what it should return.
2015-05-26 10:19:42 +02:00
Rasmus 248266e560 org.el: New function org-delete-indentation
* org.el (org-delete-indentation): New function.
  (org-mode-map): Bind org-delete-indentation to M-^.
* test-org.el (test-org-delete-indentation): Test org-delete-indentation.
* ORG-NEWS: Add entry on org-delete-indentation.
2015-05-21 00:28:41 +02:00
Rasmus af6fdf3071 org.el: RET breaks headline text
* org.el (org-return): RET breaks headline text.
* test-org.el (test-org/return): Test org-return on headline text.
* ORG-NEWS: Add entry on new org-return behavior.
2015-05-21 00:21:34 +02:00
Rasmus 00dc3b1b72 ox-html: Less generic names for table aligns.
* ox-html.el (org-html-style-default):
  (org-html-table-cell, org-html-table): Prefix left, right, center classes.
* test-org-table.el (test-org-table/to-html): Change classes.

Reported-by: Matt Price <moptop99@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/97431>
2015-05-15 13:17:10 +02:00
Nicolas Goaziou c0dec9a8bc org-table: Fix durations extracted from node properties
* lisp/org-table.el (org-table-formula-substitute-names): Convert
  durations when needed.  Refactor code.

* testing/lisp/test-org-table.el (test-org-table/duration): New test.

Reported-by: Daniele Pizzolli <dan@toel.it>
<http://permalink.gmane.org/gmane.emacs.orgmode/97252>
2015-05-11 01:20:37 +02:00
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