Commit Graph

1000 Commits

Author SHA1 Message Date
Nicolas Goaziou fd8a18151a Fix file uri
* lisp/ox.el (org-export-file-uri): Properly expand file uri.

* lisp/org-element.el (org-element-link-parser): Start path with "//"
  when referring to a remote file.

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

Reported-by: AW <alexander.willand@t-online.de>
<http://permalink.gmane.org/gmane.emacs.orgmode/101471>
2015-09-26 00:11:42 +02:00
Richard Hansen 11bba63dc3 fix SETUPFILE pathname expansion with subdirectories
* lisp/org-macro.el (org-macro--collect-macros): cd to the directory
containing the SETUPFILE before recursing so that relative pathnames
in the SETUPFILE are expanded properly.

* lisp/org.el (org--setup-collect-keywords): cd to the directory
containing the SETUPFILE before recursing so that relative pathnames
in the SETUPFILE are expanded properly.

* lisp/ox.el (org-export--get-inbuffer-options,
org-export--list-bound-variables): cd to the directory containing the
SETUPFILE before recursing so that relative pathnames in the SETUPFILE
are expanded properly.

If /path/to/foo.org contains:

    #+SETUPFILE: settings/beamer.org

and /path/to/settings/beamer.org contains:

    #+SETUPFILE: common.org

then we want to read /path/to/settings/common.org, not
/path/to/common.org.

TINYCHANGE
2015-09-24 10:16:04 +02:00
Nicolas Goaziou 6d2ab40719 org-table: Fix radio tables containing macros
* lisp/org-table.el (orgtbl-to-generic): Export macros as-is, even if
  they are undefined.
* testing/lisp/test-org-table.el (test-org-table/to-generic): Add test.

Radio tables are now using a minimal set-up for export.  In particular,
no macro is expanded, and no Babel code is executed.  If any of these is
needed, use `org-export-string-as' or `org-export-region-as' instead.

Reported-by: Mark Edgington <edgimar@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/100621>
2015-09-19 13:25:12 +02:00
Nicolas Goaziou 62dc515ae5 ob-tangle: Fix commenting links at column 0
* lisp/ob-tangle.el (org-babel-spec-to-string): Ignore invisible
  characters when commenting in destination file.

* testing/lisp/test-ob-tangle.el (ob-tangle/comment-links-at-left-margin):
New test.

Reported-by: Rainer M Krug <Rainer@krugs.de>
<http://permalink.gmane.org/gmane.emacs.orgmode/101002>
2015-09-10 11:12:20 +02:00
Nicolas Goaziou f051d663ab ox: Ignore statistics cookies with stat:nil
* lisp/ox.el (org-export--prune-tree): Fix bug preventing pruning within
  secondary strings.

* testing/lisp/test-ox.el (test-org-export/handle-options): Update test.

Reported-by: Thomas S. Dye <tsd@tsdye.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/100999>
2015-09-10 09:32:58 +02:00
Nicolas Goaziou c708fc0bb8 ox: Fix OPTION keyword parsing
* lisp/ox.el (org-export--parse-option-keyword): Handle multiple
  properties referring to the same option item.

* testing/lisp/test-ox.el (test-org-export/parse-option-keyword): Add
  test.
2015-09-09 22:50:08 +02:00
Nicolas Goaziou a7394224aa ox: Fix footnotes in included files
* lisp/ox.el (org-export--prepare-file-contents): Do not error when
  including multiple footnotes with the same label.

* testing/lisp/test-ox.el (test-org-export/expand-include): Update test.

Reported-by: Leonard Randall <leonard.a.randall@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/100906>
2015-09-06 21:54:57 +02:00
Nicolas Goaziou b0f6c3c251 Fix indentation when altering planning info
* lisp/org.el (org-add-planning-info): Do not remove too much
  indentation when removing a planning line.
* testing/lisp/test-org.el: Add tests.

Reported-by: George McNinch <gmcninch@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/100819>
2015-09-03 23:03:28 +02:00
Nicolas Goaziou d66d6f55e0 ox: Fix smart inner quotes
* lisp/ox.el (org-export--smart-quote-status): Fix inner smart quotes.
* testing/lisp/test-ox.el (test-org-export/activate-smart-quotes): Add
  tests.

Reported-by: "T.F. Torrey" <tftorrey@tftorrey.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/100779>
2015-09-02 21:02:41 +02:00
Nicolas Goaziou 48f009bc9f ox: Fix uninterpreted data in captions
* lisp/ox.el (org-export--remove-uninterpreted-data-1): Handle
  uninterpreted data in captions.

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

Reported-by: Johannes Rainer <johannes.rainer@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/100476>
2015-08-25 14:44:20 +02:00
Nicolas Goaziou 6626dfb30b ob: Fix RESULTS indentation
* lisp/ob-core.el (org-babel-parse-src-block-match): Compute indentation
  taking into consideration tab width.
(org-babel-where-is-src-block-result): Do not assume indentation
consists of white space characters only.

* testing/lisp/test-ob.el (test-ob/preserve-results-indentation): Add
  test.

Reported-by: Jarmo Hurri <jarmo.hurri@iki.fi>
<http://permalink.gmane.org/gmane.emacs.orgmode/100403>
2015-08-23 23:41:56 +02:00
Nicolas Goaziou 949fc352cb org-datetree: Fix DATE_TREE search
* lisp/org-datetree.el (org-datetree-find-date-create): Ignore case and
  discard false positives (e.g., a fake property in an example block).

* testing/lisp/test-org-datetree.el: New file.
2015-08-22 21:40:54 +02:00
Nicolas Goaziou 93b73bd303 Fix translated link
* lisp/org-element.el (org-element-link-parser): Call
  `org-link-translation-function' if required.
(org-element-link-interpreter): Build link from type and path instead of
simply pasting raw value.

* lisp/org.el (org-translate-link): Call parser to extract proper path
  and type.

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

Reported-by: Sergei Nosov <sergei.nosov@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/100227>
2015-08-19 15:22:22 +02:00
Nicolas Goaziou 1abc4887a2 Fix `org-entry-properties' with default priority
* lisp/org.el (org-entry-properties): When no priority is explicitly
  set, report `org-default-priority' instead.

* testing/lisp/test-org.el (test-org/entry-properties): Update test.
2015-08-19 11:12:43 +02:00
Nicolas Goaziou 65ded0c7ed org-footnote: Fix f8c4102cc6
* lisp/org-footnote.el (org-footnote-new): Fix
  f8c4102cc6.

* testing/lisp/test-org-footnote.el (test-org-footnote/new): Add test.
2015-08-14 16:17:18 +02:00
Nicolas Goaziou 8500501984 org-footnote: Fix location after moving to definition
* lisp/org-footnote.el (org-footnote-goto-definition): Move to location
  appropriate for further editing.
* testing/lisp/test-org-footnote.el (test-org-footnote/delete): Update
  test.
2015-08-14 16:15:09 +02:00
Nicolas Goaziou 4dc79cbe9d Fix splitting headlines with RET
* lisp/org.el (org-return): Make sure to keep headline from being
  invalidated by restricting positions where it can be split.

* testing/lisp/test-org.el (test-org/return): Add test.
2015-08-13 02:42:08 +02:00
Alexey Lebedeff 997a9a45d9 Make `org-return' follow links in headings again
* org.el (org-return): Check for links first when
  `org-return-follows-link' is non-nil, before inserting any newlines.

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

This patch restores order in which `org-return' perform actions (which
was changed in a7e62499f2).

TINYCHANGE
2015-08-13 02:25:17 +02:00
Nicolas Goaziou ac0661189e org-list: Fix statistics updating with cookie in sublist
* lisp/org-list.el (org-update-checkbox-count): Properly update
  statistics cookies in a sublist.

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

Reported-by: Gerald Wildgruber <Gerald.Wildgruber@unibas.ch>
<http://permalink.gmane.org/gmane.emacs.orgmode/99792>
2015-08-10 23:23:39 +02:00
Nicolas Goaziou c9ac8f6956 Fix false positives in TODO keywords
* lisp/org.el (org-entry-properties): Make sure case is meaningful when
  matching a TODO keyword.
* testing/lisp/test-org.el (test-org/entry-properties): Add test.

Reported-by: Samuel Wales <samologist@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/99756>
2015-08-09 23:56:57 +02:00
Nicolas Goaziou 570b1935e7 org-agenda: Do not block non-TODO entries
* lisp/org-agenda.el (org-agenda-dim-blocked-tasks): Do not check if an
  entry can be blocked when it doesn't have any TODO keyword.

* lisp/org.el (org-entry-blocked-p): Make sure entry is really an open
  task before even considering it as a blocked task.  Small refactoring.

* testing/lisp/test-org.el (test-org/entry-properties): Update tests.
(test-org/entry-blocked-p): New test.

Reported-by: Bingo UV <right.ho@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/99544>
2015-08-06 17:56:40 +02:00
Nicolas Goaziou f63d76872c Fix links with newline characters
* lisp/org-element.el (org-element-link-parser): Correctly parse links
  with newline characters.

* lisp/org.el (org-make-link-regexps): Allow newline characters within
  angle links.
(org-activate-angle-links): Support multiline angle links.

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

As a rule of thumb, any newline character and all surrounding
whitespaces are treated as a single space in a bracket link.  They are
removed in angle links.
2015-08-04 16:40:25 +02:00
Nicolas Goaziou a3b2b7473e Repair radio target search
* lisp/org.el (org-open-at-point): Find radio targets again.
(org-search-radio-target): New function.

* testing/lisp/test-org.el (test-org/open-at-point/radio-target): New
  test.
2015-08-03 02:59:13 +02:00
Nicolas Goaziou cfe5bc97f8 Fix link search
* lisp/org.el (org-open-link-marker): Remove variable.
(org-open-at-point): Apply removal.
(org-link-search): Sanitize function.  Fix issue with internal link
encoding.
(org-search-not-self): Remove function.

* lisp/ox.el (org-export--inclusion-absolute-lines): Ensure INCLUDE
  keywords with locations can find named elements and targets.

* testing/lisp/test-org.el (test-org/return):
(test-org/coderef):
(test-org/custom-id): Update tests.
(test-org/fuzzy-links): Add tests.

Reported-by: Ivanov Dmitry <usr345@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/99340>
2015-08-03 01:06:32 +02:00
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