Commit Graph

1668 Commits

Author SHA1 Message Date
Nicolas Goaziou 6cfc7cb958 Merge branch 'maint' 2017-09-07 15:21:35 +02:00
Nicolas Goaziou 91a76063d8 org-duration: Fix `org-duration-to-minutes' with the empty string
* lisp/org-duration.el (org-duration-to-minutes): Accept the empty
  string.

* testing/lisp/test-org-duration.el (test-org-duration/to-minutes):
  Add test.

For backward compatibility with `org-duration-string-to-minutes'
accept the empty string as a duration.
2017-09-07 15:20:26 +02:00
Nicolas Goaziou 70d2b3c96f org-table: Obey <c> cookie when aligning a table
* lisp/org-table.el (org-table--align-field): New function.
(org-table-align): Use new function.  Refactor code.
(org-table-justify-field-maybe): Use new function.
(org-table-get-remote-range): Remove duplicate bindings.

* doc/org.texi (Column width and alignment): Remove footnote.

* testing/lisp/test-org-table.el (test-org-table/align): New test.
2017-09-06 15:21:20 +02:00
Nicolas Goaziou 882f3f3fc0 org-table: Change behavior of `org-table-toggle-column-width'
* lisp/org-table.el (org-table-toggle-column-width): Change behavior
  of `org-table-toggle-column-width'.
(org-table-shrink): Allow optional arguments.

* testing/lisp/test-org-table.el (test-org-table/toggle-column-width):
  Update tests.
2017-09-06 15:18:37 +02:00
Nicolas Goaziou 23a2fde6fe Remove visual effect of width cookies in tables
* lisp/org-colview.el (org-dblock-write:columnview): Remove :width
  parameter.

* lisp/org-table.el (org-narrow-column-arrow): Remove variable.
(org-table-cleanup-narrow-column-properties): Remove function.
(org-table-align): Ignore width cookies when aligning table.
(org-table-justify-field-maybe):
(org-table-finish-edit-field):
(org-table-follow-fields-with-editor):
(orgtbl-setup): Remove reference to `org-cwidth' property.

* lisp/org.el (org-mode):
(org-hide-wide-columns): Remove function.
(org-set-font-lock-defaults): Apply previous removal.
(org-shorten-string): Ignore `org-cwidth' property.

* testing/lisp/test-org-colview.el (test-org-colview/dblock): Remove
  a test.

Export back-ends may still use width cookie to alter table's output.
2017-09-06 15:18:37 +02:00
Nicolas Goaziou 6d6a30d4cd org-table: Implement shrunk columns
* lisp/org-table.el (org-table-shrunk-column-indicator): New variable.
(org-table-with-shrunk-columns): New macro.
(org-table--shrunk-field):
(org-table--list-shrunk-columns):
(org-table--shrink-field):
(org-table--read-column-selection):
(org-table--expand-all-columns):
(org-table-toggle-column-width): New functions.

(org-table-align):
(org-table-get-field):
(org-table-insert-column):
(org-table-delete-column):
(org-table-move-column):
(org-table-move-row):
(org-table-insert-row):
(org-table-insert-hline):
(org-table-kill-row):
(org-table-sort-lines): Use new functions.

(org-table-overlay-coordinates):
(org-table-toggle-coordinate-overlays): Tiny refactoring.

* testing/lisp/test-org-table.el (test-org-table/toggle-column-width):
(test-org-table/shrunk-columns): New tests.
2017-09-06 15:18:37 +02:00
Jay Kamat 331ba68495 org-archive.el: Update statistic cookies when archiving
* lisp/org-archive.el (org-archive-subtree): Update todo statistics
  when calling `org-archive-subtree'.
(org-archive-to-archive-sibling): Update cookie statistics when
calling `org-archive-to-archive-sibling'.

* testing/lisp/test-org-archive.el: New file.

This can be disabled by setting `org-provide-todo-statistics' to nil.
2017-09-06 14:31:01 +02:00
Eduardo Bellani 6edec1bef5 Fix table variable with commas in ob-sqlite
* lisp/ob-sqlite.el (org-babel-sqlite-expand-vars): Stop interfering
  with the 'orgtbl-to-csv' default formatting.

* testing/lisp/test-ob-sqlite.el: New file.

The problem here was that ob-sqlite was providing a format to the
`orgtbl-to-csv' that actually overwrote the default format in that
function, and in the case where there were commas in the content of
the table, broke the table as argument mechanism.

TINYCHANGE
2017-09-06 13:18:30 +02:00
Nicolas Goaziou 8a0c89244d Merge branch 'maint' 2017-08-31 23:15:56 +02:00
Nicolas Goaziou 1654a5a98a Fix `:jump-to-captured' when refiling a capture target
* lisp/org-capture.el (org-capture-refile): Call
  `org-capture-goto-last-stored' at the appropriate time.

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

Reported-by: "Raymond Zeitler" <zeitra@yahoo.com>
<http://lists.gnu.org/archive/html/emacs-orgmode/2017-08/msg00704.html>
2017-08-31 23:14:04 +02:00
Nicolas Goaziou 64bfa2d931 Remove `inline-only' option for `org-export-use-babel'
* lisp/ob-exp.el (org-export-use-babel): Remove `inline-only' option.
(org-babel-exp-process-buffer): Ignore `inline-only' value.

* doc/org.texi (Exporting code blocks): Remove documentation.

* testing/lisp/test-ob-exp.el (ob-export/babel-evaluate): Remove tests.
2017-08-26 10:32:26 +02:00
Nicolas Goaziou e0682619dd Merge branch 'maint' 2017-08-26 00:12:46 +02:00
Nicolas Goaziou a6840598ed Fix `org-copy-visible'
* lisp/org.el (org-copy-visible): Rewrite function.  Do not use
  dubious `org-find-visible' and `org-find-invisible'.

* testing/lisp/test-org.el (test-org/copy-visible): New test.

Reported-by: Gary Cheng <garycheng12@gmail.com>
<http://lists.gnu.org/archive/html/emacs-orgmode/2017-08/msg00568.html>
2017-08-26 00:09:51 +02:00
Nicolas Goaziou a68d117459 Merge branch 'maint' 2017-08-25 15:25:02 +02:00
Nicolas Goaziou c1b9d38c89 org-lint: Fix wrong warning with inline footnotes
* lisp/org-lint.el (org-lint-undefined-footnote-reference): Do not
  warn when definition is inline.

* testing/lisp/test-org-lint.el (test-org-lint/undefined-footnote-reference):
  Add tests.

Reported-by: Eric S Fraga <esflists@gmail.com>
<http://lists.gnu.org/archive/html/emacs-orgmode/2017-08/msg00577.html>
2017-08-25 15:24:07 +02:00
Nicolas Goaziou bae41a277e org-table: Fix sorting with times > 100 hours
* lisp/org-table.el (org-table-sort-lines): Fix regexp.  Also test
  durations.

* testing/lisp/test-org-table.el (test-org-table/sort-lines): Update
  tests.  Add a new one.
2017-08-25 00:06:27 +02:00
Nicolas Goaziou 526b3d4b98 Merge branch 'maint' 2017-08-21 21:27:06 +02:00
Nicolas Goaziou 6980b02b6f Revert "org-macro: Expand macros only within narrowed part of buffer"
This reverts commit 82db669de6.
2017-08-21 21:21:30 +02:00
Nicolas Goaziou 5cde947766 test-org-agenda: Small refactoring
* testing/lisp/test-org-agenda.el (org-test-agenda--agenda-buffers):
(org-test-agenda--kill-all-agendas): Use appropriate prefix.

(test-org-agenda/empty):
(test-org-agenda/one-line):
(test-org-agenda/scheduled-non-todo):
(test-org-agenda/sticky-agenda-name):
(test-org-agenda/sticky-agenda-name-after-reload): Find a human
readable name.
2017-08-19 19:42:20 +02:00
Nicolas Goaziou bc8360c702 Fix failing test
* testing/lisp/test-ob-lob.el (test-ob-lob/call-with-header-arguments):
  Fix failing test.
2017-08-19 19:12:08 +02:00
Nicolas Goaziou 8590c79b3a Fix some failing tests
* testing/lisp/test-ob-exp.el (test-ob-exp/org-babel-exp-src-blocks/w-no-headers):
(test-ob-exp/org-babel-exp-src-blocks/w-no-file): Fix test.

These tests fail when "htmlize" is not available on the machine.
2017-08-19 18:56:31 +02:00
Nicolas Goaziou 15e992c6da Merge branch 'maint' 2017-08-13 16:21:21 +02:00
Nicolas Goaziou 24a76fbe57 ob-core: Fix improper results indentation
* lisp/ob-core.el (org-babel-insert-result): Fix improper results
  indentation.
* testing/lisp/test-ob.el (test-ob/preserve-results-indentation): Add
  test.

Reported-by: Chunyang Xu <mail@xuchunyang.me>
<http://lists.gnu.org/archive/html/emacs-orgmode/2017-08/msg00308.html>
2017-08-13 16:20:20 +02:00
Galen Menzel 8fa6c015a4 Fix false test failure
* testing/lisp/test-org.el (test-org/refile-get-targets): Fix false
failures when test temp-file path contains a symlink.

TINYCHANGE
2017-08-10 22:43:39 +02:00
Nicolas Goaziou 9945e029f5 Merge branch 'maint' 2017-08-10 22:40:34 +02:00
Galen Menzel bff63cbeb3 Fix false test failure
* testing/lisp/test-org.el (test-org/deadline-close-p): Fix false
failures due to time-zone differences.
2017-08-10 22:39:30 +02:00
Nicolas Goaziou 829ffa977c Merge branch 'maint' 2017-08-10 12:42:51 +02:00
Nicolas Goaziou febab2fedb Add test for `org-open-at-point'
* testing/lisp/test-org.el (test-org/open-at-point/tag): New test.
2017-08-10 12:41:54 +02:00
Christian Garbs 4d2c8354ee ob-vala.el: Add Vala support to Babel
* lisp/ob-vala.el: Add support for the Vala language to Babel.

* testing/lisp/test-ob-vala.el: Add tests for ob-vala.el.

* doc/org.texi (Working with source code): Add Vala to the list of
  supported languages.
2017-08-07 11:40:25 +02:00
Nicolas Goaziou a7e11643a9 Merge branch 'maint' 2017-08-06 10:31:06 +02:00
Nicolas Goaziou 9974ed39b2 org-src: Fix remote footnote edition
* lisp/org-src.el (org-edit-footnote-reference): Clone local variables
  in remote editing buffer.

* testing/lisp/test-org-src.el (test-org-src/footnote-references): Add
  test.
2017-08-06 10:30:48 +02:00
Nicolas Goaziou b0776e39b5 org-table: Small refactoring
* lisp/org-table.el (org-table-previous-field): Small refactoring.

* testing/lisp/test-org-table.el (test-org-table/previous-field): New
  test.
2017-08-02 10:35:57 +02:00
Nicolas Goaziou 29d8d407e8 org-macs: Add tests for `org-split-string.
* testing/lisp/test-org-macs.el (test-org/split-string): New test.
2017-08-01 20:29:23 +02:00
Nicolas Goaziou 90f606d9c2 org-macs: Fix `org-string-width' with `display' property
* lisp/org-macs.el (org-string-display): New function.
(org-string-width): Use new function.

* testing/lisp/test-org-macs.el: New file.
2017-07-28 12:15:47 +02:00
Nicolas Goaziou e79b0bd9f3 Merge branch 'maint' 2017-07-28 10:15:35 +02:00
Nicolas Goaziou 808089ee04 `org-forward/backward-paragraph' do not error at buffer boundaries
* lisp/org.el (org-forward-paragraph):
(org-backward-paragraph): Do not error at buffer boundaries.

Reported-by: Omar Antolín Camarena <omar.antolin@gmail.com>
<http://lists.gnu.org/archive/html/emacs-orgmode/2017-07/msg00478.html>
2017-07-28 10:07:53 +02:00
Nicolas Goaziou 9adab7ff90 ob-scheme: Fix :prologue handling
* lisp/ob-scheme.el (org-babel-expand-body:scheme): Handle :prologue
  handling without any :var parameter.
* testing/lisp/test-ob-scheme.el: New file.
2017-07-24 13:55:20 +02:00
Nicolas Goaziou f6109d355e Merge branch 'maint' 2017-07-23 22:42:50 +02:00
Nicolas Goaziou 5e0db07988 ob-emacs-lisp: Fix pp results
* lisp/ob-emacs-lisp.el (org-babel-expand-body:emacs-lisp): Move "pp" handling...
(org-babel-execute:emacs-lisp): ... here.

* testing/lisp/test-ob-emacs-lisp.el (ob-emacs-lisp/commented-last-block-line):
  Small refactoring.

Reported-by: Chunyang Xu <mail@xuchunyang.me>
<http://lists.gnu.org/archive/html/emacs-orgmode/2017-07/msg00355.html>
2017-07-23 22:41:27 +02:00
Stig Brautaset 3e1aeac3b3 use cl-lib functions rather than cl ones in org-test
From ead36e862d150e3a83d363bdead850a2e3ec281d Mon Sep 17 00:00:00 2001
From: Stig Brautaset <stig@brautaset.org>
Date: Fri, 14 Jul 2017 20:43:11 +0100
Subject: [PATCH 1/3] org-test.el: use prefixed functions from cl-lib.el rather
 than cl.el
2017-07-23 11:06:37 +02:00
Marco Wahl 566e700007 test-org-agenda: Non-todo-kwd scheduled item must appear in agenda 2017-07-19 17:43:50 +02:00
Nicolas Goaziou 97a1a49895 Fix failing tests in non-daylight saving time zones
* lisp/org.el (org-time-string-to-time): Remove optional POS and
  BUFFER arguments.  Accept new optional ZONE argument.
(org-time-string-to-seconds): Accept optional ZONE argument.
(org-check-before-date):
(org-check-after-date):
(org-check-dates-range):
(org-goto-calendar):
* lisp/ob-gnuplot.el (org-time-string-to-time):
* lisp/org-agenda.el (org-agenda-get-blocks):
* lisp/org-clock.el (org-clock-timestamps-change):
* lisp/org-list.el (org-time-string-to-seconds): Use UTC for time
  difference and time comparison.

* testing/lisp/test-org-clock.el (org-test-clock-create-clock): Use
  UTC for time differences.
2017-07-07 18:23:10 +02:00
Marco Wahl 2b5ce91b35 org-timer: Fix timer setting from effort property
Testcase included.
2017-07-05 12:33:47 +02:00
Nicolas Goaziou 64cbcb1bff Merge branch 'maint' 2017-07-01 10:34:01 +02:00
Nicolas Goaziou 79f29b490e org-table: Add tests
* testing/lisp/test-org-table.el (test-org-table/move-row-down):
(test-org-table/move-row-up): New tests.
2017-07-01 10:30:45 +02:00
Mario Martelli 37bba84a5e org-protocol: Sources with date URL are supported
lisp/org-protocol.el (org-protocol-project-alist): Date-URL is added
as example.
(org-protocol-open-source): First match is processed in rewrite.

testing/lisp/test-org-protocol.el (test-org-protocol/org-protocol-open-source):
Configuration displaying a date-style URL is added.

TINYCHANGE
2017-06-28 17:44:27 +02:00
Nicolas Goaziou df0c345eac Merge branch 'maint' 2017-06-26 22:08:46 +02:00
Nicolas Goaziou bc1d6aadfd org-element: Fix $...$ parser error
* lisp/org-element.el (org-element-latex-fragment-parser): Also check
  border character right after opening "$" sign.
* testing/lisp/test-org-element.el (test-org-element/latex-fragment-parser):
Add tests.

Reported-by: thomas <thomas@friendlyvillagers.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/114285>
2017-06-26 22:07:05 +02:00
Nicolas Goaziou a0d1ad325d Merge branch 'maint' 2017-06-22 18:32:38 +02:00
Nicolas Goaziou 5d99560ddf Fix open-at-point in example blocks and diary-sexps
* lisp/org.el (org-open-at-point): Also open links in example blocks
  and diary-sexps.

* testing/lisp/test-org.el (test-org/open-at-point/keyword):
(test-org/open-at-point/property):
(test-org/open-at-point/comment): Add tests.

Reported-by: Dieter Faulbaum <Dieter.Faulbaum@helmholtz-berlin.de>
<http://lists.gnu.org/archive/html/emacs-orgmode/2017-06/msg00277.html>
2017-06-22 18:30:58 +02:00
Nicolas Goaziou e90b643b05 Merge branch 'maint' 2017-06-21 22:35:28 +02:00
Nicolas Goaziou 112c5ba479 org-clock: Remove daylight saving time offset in duration
* lisp/org-clock.el (org-clock-out):
(org-clock-sum):
(org-clocktable-steps):
(org-clock-update-time-maybe): Use UTC to compute time differences.

* testing/lisp/test-org-clock.el (test-org-clock/clocktable/scope):
  Update test.
2017-06-21 22:32:57 +02:00
Nicolas Goaziou dbed60d6bd Merge branch 'maint' 2017-06-20 21:21:35 +02:00
Nicolas Goaziou 7fe9ae6bd2 org-element: Fix babel call parser
* lisp/org-element.el (org-element-babel-call-parser): Handle complex
  arguments.
* testing/lisp/test-org-element.el (test-org-element/babel-call-parser):
Add test.

Reported-by: Eric S Fraga <e.fraga@ucl.ac.uk>
<http://lists.gnu.org/archive/html/emacs-orgmode/2017-06/msg00366.html>
2017-06-20 21:20:30 +02:00
Kaushal Modi d48cfdf68b Add hold 'action' to the "n" macro and ws-trim all "n" macro args
* lisp/org-macro.el (org-macro--counter-increment): Rename the
optional arg RESET to ACTION, as now that action can mean setting,
resetting or even holding the specified counter.  ACTION set to
"-" will hold the previous value of the counter.  White-space is
now trimmed from the NAME arg too.

* doc/org.texi (Macro replacement): Document the new hold action.

* testing/lisp/test-org-macro.el (test-org-macro/n): Add new tests for
the hold action.
2017-06-17 23:46:24 -04:00
Nicolas Goaziou 1c7cf61bd7 Merge branch 'maint' 2017-06-14 11:03:40 +02:00
Nicolas Goaziou b47920ed20 org-colview: Fix failing test
* lisp/org.el (org-parse-time-string): Allow to specify zone as an
  optional argument.
* lisp/org-colview.el (org-columns--age-to-seconds): Apply change
  above.
* testing/lisp/test-org-colview.el (test-org-colview/columns-summary):
  Update tests.
2017-06-14 11:00:01 +02:00
Nicolas Goaziou d8eaa8396d Fix failing test
* testing/lisp/test-org.el (test-org/file-contents): New test.  Merge
  from `test-org/org-file-contents-file' and
  `test-org/org-file-contents-url'.
2017-06-14 10:10:21 +02:00
Carsten Dominik feed16e1ed Merge branch 'master' of orgmode.org:org-mode 2017-06-14 05:46:17 +02:00
Carsten Dominik daff9c93f2 Implement new `U' mode switch for table formulas to omit seconds in durations
* lisp/org-table.el (org-table-duration-custom-format): Add new
	HH:MM format.
	(org-table-duration-hour-zero-padding): New option.
	(org-table-eval-formula): Select second-less format if
	requested.
	(org-table-time-seconds-to-string): Implement formats without
	seconds and without zero-padding for hours.

	* testing/lisp/test-org-table.el (test-org-table/duration):
	New test for second-less durations.

	* doc/org.texi (Formula syntax for Calc)
	(Durations and time values): Document the U mode switch.
2017-06-14 05:43:12 +02:00
Kaushal Modi 1e92f5ed39 Allow org-file-contents to fetch file contents from a URL
* lisp/org.el (org--file-cache): New variable.
(org-reset-file-cache):
(org-file-url-p): New function.
(org-mode-restart): Use new function.

* lisp/org.el (org-file-contents): Allow the FILE argument to be a
URL.  If the URL contents are already cached, return the cache
contents, else download the file and return contents of that.  The
file is automatically cached each time it is downloaded.  Add a new
optional argument NOCACHE.  If this is non-nil, the URL is always
downloaded afresh.  Use `org--file-cache' and `org-file-url-p'.

* lisp/org.el (org-edit-special): Do not allow editing the "file" if a
URL is specified for the "#+SETUPFILE".

* lisp/ox.el (org-export--list-bound-variables)
(org-export--prepare-file-contents):
* lisp/org-macro.el (org-macro--collect-macros) : Adapt to the
possibility that the input to `org-file-contents' can be a URL too.

* doc/org.texi (Export settings, In-buffer settings)
(The very busy C-c C-c key): Mention that #+SETUPFILE keyword can now
take a URL as a value, and that C-c C-c on the #+SETUPFILE line will
clear the org file cache.

* testing/lisp/test-org.el (test-org/org-file-contents-url)
(test-org/org-file-contents-file): Add tests for org-file-contents.

* testing/lisp/test-ox.el (test-org-export/get-inbuffer-options): Add
test for reading setupfile specified via a URL.
2017-06-13 11:41:58 -04:00
Nicolas Goaziou 8ebfbc1d2a Merge branch 'maint' 2017-06-10 00:14:30 +02:00
Nicolas Goaziou b8df40eccc ob-shell: Fix handling list variables
* lisp/ob-shell.el (org-babel--variable-assignments:bash): Do not
  error when value is a list.

* testing/lisp/test-ob-shell.el (ob-shell/simple-list): New test.

Reported-by: Keith Amidon <camalot@picnicpark.org>
<http://permalink.gmane.org/gmane.emacs.orgmode/113920>
2017-06-10 00:06:24 +02:00
Kaushal Modi a933b34992 Merge branch 'maint' 2017-06-09 16:18:24 -04:00
Kaushal Modi 7cd7b90dcb Update remote file syntax for Tramp
* testing/lisp/test-ox.el (test-org-export/file-uri):
* doc/org.texi (External links): The method part of remote file names
is mandatory now in the emacs master (26+).  A valid remote file name
starts with "/method:host:" or "/method:user@host:".  ssh is used as
an example method here.

This change in the examples is backward compatible with emacs 25, 24, ..

Suggested by: Michael Albinus <michael.albinus@gmx.de>
<http://lists.gnu.org/archive/html/emacs-orgmode/2017-06/msg00151.html>

Relevant commit in emacs master causing this change:
<http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=ed33337c3e0d0b1a8b140e23168421ea43d79324>
2017-06-09 16:15:15 -04:00
Nicolas Goaziou 54344574c6 Merge branch 'maint' 2017-06-09 09:45:08 +02:00
Nicolas Goaziou 9a8506b7af org-footnote: Fix footnote deletion
* lisp/org-footnote.el (org-footnote-delete-definitions): Preserve
  blank lines after the definition.
* testing/lisp/test-org-footnote.el (test-org-footnote/delete): Add
  test.
2017-06-09 09:43:49 +02:00
Nicolas Goaziou 8e8094b919 Merge branch 'maint' 2017-06-08 15:04:55 +02:00
Nicolas Goaziou 3cf6345b40 org-macro: Fix macro expansion in commented trees
* lisp/org-macro.el (org-macro-replace-all): Prevent macro expansion
  in commented trees.
* testing/lisp/test-org-macro.el (test-org/macro-replace-all): Add
  tests.
* testing/lisp/test-ox.el (test-org-export/expand-macro): Remove
  tests.
2017-06-08 14:59:34 +02:00
Nicolas Goaziou 7b3ec6c105 Merge branch 'maint' 2017-06-08 00:59:06 +02:00
Nicolas Goaziou 9f5c252f93 org-src: Fix footnote reference remote editing
* lisp/org-src.el (org-edit-footnote-reference): Do not collapse
  footnote definitions after editing remotely one of them.

* testing/lisp/test-org-src.el (test-org-src/footnote-references): New
  test.
2017-06-08 00:57:38 +02:00
Kaushal Modi 4c24ecc073 Merge branch 'maint' 2017-06-07 18:40:56 -04:00
Nicolas Goaziou 84cfa58d4a org-element: Fix footnote definition parser
* lisp/org-element.el (org-element-footnote-definition-parser):
* testing/lisp/test-org-element.el (test-org-element/footnote-definition-parser):
  Add tests.
2017-06-07 23:45:17 +02:00
Nicolas Goaziou 57bf6bbbde Merge branch 'maint' 2017-06-05 18:47:25 +02:00
Nicolas Goaziou 82db669de6 org-macro: Expand macros only within narrowed part of buffer
* lisp/org-macro.el (org-macro-replace-all): Expand macros only within
  narrowed part of buffer.
* testing/lisp/test-org-macro.el (test-org/macro-replace-all): Update
  test.

Expanding macros outside in the whole buffer could make sense, e.g.,
if a macro expands to some Babel code, which, in turn, is evaluated
prior to export.  However, by principle of least surprise, it is
better to limit expansion to current accessible part of the buffer.
2017-06-05 18:08:42 +02:00
Nicolas Goaziou 496b2a9855 Merge branch 'maint' 2017-05-30 13:39:46 +02:00
Nicolas Goaziou 444d2673bb org-colview: Fix `org-columns' with a prefix argument
* lisp/org-colview.el (org-columns): Fix `org-columns' with a prefix
  argument.
* testing/lisp/test-org-colview.el (test-org-colview/columns-scope):
  Update test.

Reported-by: Hendrik Tews <hendrik@askra.de>
<http://permalink.gmane.org/gmane.emacs.orgmode/113721>
2017-05-30 13:38:54 +02:00
Nicolas Goaziou d7b203422f org-clock: Fix failing tests
* testing/lisp/test-org-clock.el (test-org-clock/clocktable/maxlevel):
  Fix tests.
(test-org-clock/clocktable/tcolumns): Add test.
2017-05-27 18:15:05 +02:00
Nicolas Goaziou 75e9fdac6c org-clock: Fix number of time columns in clock table
* lisp/org-clock.el (org-clocktable-write-default): Limit number of
  time columns to the deepest headline level.

* testing/lisp/test-org-clock.el (test-org-clock/clocktable/maxlevel):
  Update tests.
2017-05-27 18:12:38 +02:00
Nicolas Goaziou 957850043a Prevent filling before a "n" macro where it could create list items
* lisp/org.el (org-fill-n-macro-as-item-nobreak-p): New function.
(org-setup-filling): Use new function.

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

Reported-by: Kaushal Modi <kaushal.modi@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/113587>
2017-05-25 12:33:16 +02:00
Nicolas Goaziou ad89390219 org-macro: Implement the "n" macro
* lisp/org-macro.el (org-macro--counter-table): New variable.
(org-macro--counter-initialize):
(org-macro--counter-increment): New functions.
(org-macro-initialize-templates): Use new functions.

* doc/org.texi (Macro replacement): Document new macro.

* testing/lisp/test-org-macro.el (test-org-macro/n):
(test-org-macro/property): New tests.
2017-05-25 12:25:13 +02:00
Nicolas Goaziou a023b31e48 Merge branch 'maint' 2017-05-23 18:15:42 +02:00
Nicolas Goaziou d6f096546e org-capture: Fix number of blank lines with :unnarrowed option
* lisp/org-capture.el (org-capture-finalize): Remove blank lines
  number fix, which only applies to narrowed capture buffers.
(org-capture-insert-template-here):
(org-capture-place-plain-text):
(org-capture-place-item):
(org-capture-place-entry): Do not hard-code number of blank lines
after entry.

Reported-by: Igor Perepelytsya <igorquail@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/113093>

Reported-by: Jay Dresser <jay@jaydresser.us>
<http://permalink.gmane.org/gmane.emacs.orgmode/113449>
2017-05-23 18:10:06 +02:00
Nicolas Goaziou 61eb86e06c Merge branch 'maint' 2017-05-22 15:28:48 +02:00
Nicolas Goaziou 7f0391cfe0 org-colview: Remove error upon summarizing non-numbers with a format string
* lisp/org-colview.el (org-columns--displayed-value): Remove check.
* testing/lisp/test-org-colview.el (test-org-colview/columns-summary):
  Remove a test.

Reported-by: Hendrik Tews <hendrik@askra.de>
<http://permalink.gmane.org/gmane.emacs.orgmode/113600>
2017-05-22 15:27:17 +02:00
Nicolas Goaziou c2f4eec5dc `org-fill-paragraph' handles region
* lisp/org.el (org-fill-element): New function.
(org-fill-paragraph): Use new function.  Also handle region, when
called interactively.

* testing/lisp/test-org.el (test-org/fill-element): Renamed from
  test-org/fill-paragraph.  Update tests.

Reported-by: Oskar Kvist <oskar.kvist@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/113542>
2017-05-22 15:02:34 +02:00
Nicolas Goaziou b3088eea3f Update a test
* testing/lisp/test-org.el (test-org/refile-get-targets): Update test.
2017-05-22 08:26:22 +02:00
Nicolas Goaziou 36a091fe67 Add test for `org-refile-get-targets'
* testing/lisp/test-org.el (test-org/refile-get-targets): Add test.
2017-05-22 08:21:50 +02:00
Nicolas Goaziou f335c3517d Add tests for org-refile-get-targets
* testing/lisp/test-org.el (test-org/refile-get-targets): New test.

Based on a patch from Sebastian Reuße <seb@wirrsal.net>.
2017-05-22 02:23:40 +02:00
Kyle Meyer 23ac37da7c Merge branch 'maint' 2017-05-21 14:54:59 -04:00
Kyle Meyer 0de7ad0430 org-store-link: Don't roll C-u behavior into C-u C-u behavior
* lisp/org.el (org-store-link): When a double C-u prefix argument is
given, do not reverse the meaning of the org-context-in-file-links
option.
* testing/lisp/test-org.el (test-org/store-link): Add tests.

This allows the user to fall back to the core link storing functions
without also reversing their org-context-in-file-links preference,
because wanting to do the former does not mean a user also wants to do
the latter.

Reported-by: York Zhao <gtdplatform@gmail.com>
<https://lists.gnu.org/archive/html/emacs-orgmode/2017-05/msg00254.html>
2017-05-21 14:52:30 -04:00
Nicolas Goaziou 8b79f8c91b Merge branch 'maint' 2017-05-21 11:09:02 +02:00
Nicolas Goaziou 39b3f45a7d org-colview: Fix {X%} and {X/} on recursive summaries
* lisp/org-colview.el (org-columns--summary-checkbox-count):
(org-columns--summary-checkbox-percent): Handle own output for higher
level summaries.
* testing/lisp/test-org-colview.el (test-org-colview/columns-summary):
  Add tests.
2017-05-21 11:08:11 +02:00
Nicolas Goaziou d71e708fe3 Merge branch 'maint' 2017-05-20 22:13:12 +02:00
Nicolas Goaziou ec5df01bd8 org-colview: Properly apply operator format strings on leaf nodes
* lisp/org-colview.el (org-columns--displayed-value): When value is
a number and a format string is specified, apply it.
* testing/lisp/test-org-colview.el (test-org-colview/columns-summary):
  Add tests.

Reported-by: Hendrik Tews <hendrik@askra.de>
<http://permalink.gmane.org/gmane.emacs.orgmode/113547>
2017-05-20 22:11:45 +02:00
Nicolas Goaziou dbe2424b07 Adjust `org-at-timestamp-p' behavior
* lisp/org.el (org-at-timestamp-p): Change optional argument
  behaviour.  Remove interactive call.
(org-follow-timestamp-link):
(org-get-repeat):
(org-auto-repeat-maybe):
(org-time-stamp):
(org-timestamp-up-day):
(org-timestamp-down-day):
(org-toggle-timestamp-type):
(org-timestamp-change):
(org-goto-calendar):
(org-date-from-calendar):
(org-shiftup):
(org-shiftdown):
(org-shiftright):
(org-shiftleft):
(org-org-menu):
(org-fill-paragraph-with-timestamp-nobreak-p):
(org-shiftcontrolup):
(org-shiftcontroldown):
* lisp/org-agenda.el (org-agenda-date-later):
(org-agenda-date-prompt):
* lisp/org-clock.el (org-clock-timestamps-change):
* lisp/org-mouse.el (org-mouse-delete-timestamp):
(org-mouse-context-menu):
* lisp/org-table.el (org-table-copy-down): Update callers.

* testing/lisp/test-org.el (test-org/at-timestamp-p): Add tests.
2017-05-14 10:54:25 +02:00
Nicolas Goaziou cbbe00e30e org-element: Do not parse timestamps within planning line
* lisp/org-element.el (org-element-context): Do not parse timestamps
  within planning line.
* testing/lisp/test-org-element.el (test-org-element/context): Remove test.

Strictly speaking, timestamps within planning lines are parameters
values that use timestamp syntax, not real timestamps belonging to the
document contents.
2017-05-14 10:25:13 +02:00
Nicolas Goaziou b72d29d685 Merge branch 'maint' 2017-05-13 09:21:31 +02:00
Nicolas Goaziou c0369a7984 org-element: Fix $...$ fragments followed by an apostrophe
* lisp/org-element.el (org-element-latex-fragment-parser):
* lisp/org.el (org-latex-regexps): Allow an apostrophe right after
  a fragment.

* testing/lisp/test-org-element.el (test-org-element/latex-fragment-parser):
  Add test.

In Text mode, and, as a consequence, in Org mode, "'" is not treated
as punctuation, but as word constituent.  The apostrophe isn't caught
by "\s." regexp.

Reported-by: Joe Corneli <holtzermann17@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/113464>
2017-05-13 09:18:07 +02:00
Nicolas Goaziou 79ac71d175 Tiny fix
* lisp/org.el (org-N-empty-lines-before-current): Insert empty lines
  before point, not after.
* testing/lisp/test-org.el (test-org/insert-heading): Add test.
2017-05-12 17:45:46 +02:00
Kyle Meyer 6fee6b6cde Merge branch 'maint' 2017-05-09 14:49:59 -04:00
Kyle Meyer f4bb79a10c Add tests for org-sort-list and org-sort-entries
* testing/lisp/test-org-list.el:
* testing/lisp/test-org.el: New test.
2017-05-09 14:49:22 -04:00
Nicolas Goaziou 93b5e5087f Merge branch 'maint' 2017-05-08 11:26:33 +02:00
Nicolas Goaziou f1da21f7d9 ob-core: Fix regression
* lisp/ob-core.el (org-babel-balanced-split): Fix regression
  introduced in 500abcd7fb.

* testing/lisp/test-ob.el (test-ob/balanced-split): Add tests.

Reported-by: Eric S Fraga <e.fraga@ucl.ac.uk>
<http://permalink.gmane.org/gmane.emacs.orgmode/113401>
2017-05-08 11:25:17 +02:00
Nicolas Goaziou 6a4d3988b9 Merge branch 'maint' 2017-05-05 19:52:55 +02:00
Nicolas Goaziou cecdb2bd67 Merge branch 'maint' 2017-05-02 08:24:24 +02:00
Nicolas Goaziou 500abcd7fb ob-core: Fix `org-babel-balanced-split'
* lisp/ob-core.el (org-babel-balanced-split): Rewrite function.

Reported-by: Moritz Heidkamp <moritz@twoticketsplease.de>
<http://permalink.gmane.org/gmane.emacs.orgmode/113204>
2017-05-01 23:35:39 +02:00
Nicolas Goaziou 5bc540eae1 Merge branch 'maint' 2017-04-30 22:26:52 +02:00
Nicolas Goaziou 3502e6fa7c Fix indentation bug
* lisp/org.el (org--get-expected-indentation): Correctly indent line
  when last element in an item is not a greater element.
* testing/lisp/test-org.el (test-org/indent-line): Add test.
2017-04-30 22:26:10 +02:00
Nicolas Goaziou 6834142d87 Merge branch 'maint' 2017-04-29 14:34:09 +02:00
Nicolas Goaziou 1332bbd616 ox: Do not trim leading and trailing blank lines from code
* lisp/ox.el (org-export-get-loc):
(org-export-unravel-code):
(org-export-format-code):
(org-export-format-code-default): Do not trim leading and trailing
blank lines from code during export.

* testing/lisp/test-ox.el (test-org-export/unravel-code): Update tests.
(test-org-export/format-code-default): Add tests.

Reported-by: Li DebugFan <debugfanli@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/113205>
2017-04-29 14:32:29 +02:00
Nicolas Goaziou 2a3443f142 Merge branch 'maint' 2017-04-29 11:48:45 +02:00
Nicolas Goaziou 91236a3db3 org-src: Fix indentation when tabs are involved
* lisp/org-src.el (org-src--source-type):
(org-src--tab-width): New variables.
(org-src--edit-element): Set variables above.

(org-src--contents-for-write-back): Re-indent properly non-blank lines
before inserting contents back into the source buffer.
(org-edit-src-code): Delegate block indentation to
`org-src--contents-for-write-back'.

* testing/lisp/test-org-src.el (test-org-src/indented-blocks): New
  test.

Reported-by: Brent Goodrick <bgoodr@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/113207>
2017-04-29 11:45:45 +02:00
Nicolas Goaziou 5e1f7ff04b ox: Ignore INCLUDE keywords in commented headlines
* lisp/ox.el (org-export-expand-include-keyword): Ignore INCLUDE
  keywords in commented headlines.
* testing/lisp/test-ox.el (test-org-export/expand-include): Add test.
2017-04-23 19:48:50 +02:00
Nicolas Goaziou 4e5bc38040 org-clock: Add test
* testing/lisp/test-org-clock.el (test-org-clock/clocktable/link): New
  test.
2017-04-17 10:03:23 +02:00
Nicolas Goaziou 0be422187f Merge branch 'maint' 2017-04-15 17:28:04 +02:00
Nicolas Goaziou 8a2ffac88a org-element: Fix radio link parser
* lisp/org-element.el (org-element--object-lex): Fix parsing of radio
  links within emphasis.
* testing/lisp/test-org-element.el (test-org-element/link-parser): Add
  test.

Reported-by: R C <recifx@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/113063>
2017-04-15 17:27:01 +02:00
Nicolas Goaziou 42f24c167c Merge branch 'maint' 2017-04-15 16:52:46 +02:00
Nicolas Goaziou 74379eaaa2 Fix `org-forward-heading-same-level'
* lisp/org.el (org-forward-heading-same-level): Do not fail when
  heading is at the beginning of the buffer.
* testing/lisp/test-org.el (test-org/forward-heading-same-level): New
  test.

Reported-by: Rafael Laboissière <rafael@laboissiere.net>
<http://permalink.gmane.org/gmane.emacs.orgmode/113084>
2017-04-15 16:51:33 +02:00
Nicolas Goaziou 926b093c16 Merge branch 'maint' 2017-04-10 21:12:47 +02:00
Skip Collins 90f5c0d1a4 Ensure test files are opened in Emacs in test-org/fuzzy-links 2017-04-10 21:12:15 +02:00
Nicolas Goaziou a126020e56 Merge branch 'maint' 2017-03-29 14:18:14 +02:00
Nicolas Goaziou 1f8cf90d2e Add test for link search
* testing/lisp/test-org.el (test-org/fuzzy-links): Add test.
2017-03-29 14:17:50 +02:00
Nicolas Goaziou 72c3c42259 Merge branch 'maint' 2017-03-27 13:36:49 +02:00
Nicolas Goaziou 4dde26f086 Fix lsearch strings with newline characters
* lisp/org.el (org-link-search): Fix regexp.
* testing/lisp/test-org.el (test-org/fuzzy-links): Add test.

Reported-by: Matt Lundin <mdl@imapmail.org>
<http://permalink.gmane.org/gmane.emacs.orgmode/112876>
2017-03-27 13:34:04 +02:00
Nicolas Goaziou 0f51e643c4 Merge branch 'maint' 2017-03-23 16:46:52 +01:00
Nicolas Goaziou b791cd59a5 ox: Fix "Fix :filter-options"
* lisp/ox.el (org-export-as): Remove uninterpreted data from back-end
  specific parsed keywords.

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

This fixes 6cd42b08f9.
2017-03-23 16:46:28 +01:00
Marco Wahl 86ff112707 Merge branch 'maint' 2017-03-21 20:53:02 +01:00
Marco Wahl f50f8d0d10 test-org-agenda: Test agenda buffername when reload sticky agenda
* testing/lisp/test-org-agenda.el: One additional test to Check that
  buffer name remains the same after reload.  (BTW some cleanup.)
2017-03-21 20:42:08 +01:00
Nicolas Goaziou a9762b37dd org-clock: Add test
* testing/lisp/test-org-clock.el (test-org-clock/clocktable/formula):
  Add test.
2017-03-19 10:59:52 +01:00
Nicolas Goaziou 36c7cfe9eb Merge branch 'maint' 2017-03-18 10:29:33 +01:00
Nicolas Goaziou b72920344f ob-exp: Fix export of src blocks with pathological name
* lisp/ob-exp.el (org-babel-exp-process-buffer): Discard false
  positives.
* testing/lisp/test-ob-exp.el (ob-exp/src-block-with-affiliated-keyword):
  New test.

Reported-by: Skip Collins <skip.collins@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/112797>
2017-03-18 10:28:15 +01:00
Marco Wahl 3a9ac1f035 Merge branch 'maint' 2017-03-17 19:54:48 +01:00
Marco Wahl d262ae53c9 org-agenda: Fix agenda standard name when going unsticky
* lisp/org-agenda.el (org-agenda-list): Reset `org-agenda-buffer-name'
  to the original name.
* testing/lisp/test-org-agenda.el: Pertaining unit test.  + 2 basic
  agenda tests.
* testing/examples/agenda-file.org: File to produce content for an
  agenda to test.
2017-03-17 19:52:22 +01:00
Nicolas Goaziou f2e5920f41 Fix display bug when inserting a heading
* lisp/org.el (org-N-empty-lines-before-current): Do not hide newline
  character before current headline.

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

Reported-by: Rick Frankel <rick@rickster.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/112751>
2017-03-16 13:01:39 +01:00
Nicolas Goaziou 10dc237eee Merge branch 'maint' 2017-03-14 18:14:32 +01:00
Nicolas Goaziou 6cd42b08f9 ox: Fix :filter-options
* lisp/ox.el (org-export--remove-uninterpreted-data): Do not modify
  communication channel.  Change "blob" to "datum".
(org-export--remove-uninterpreted-data-1): Remove function.
(org-export-as): Remove uninterpreted data from parsed keyword before
applying filters.

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

Reported-by: Rasmus <rasmus@gmx.us>
<http://permalink.gmane.org/gmane.emacs.orgmode/112730>
2017-03-14 18:10:07 +01:00
Nicolas Goaziou c41c2be339 Merge branch 'maint' 2017-03-14 09:07:55 +01:00
Nicolas Goaziou 92ee4d06a2 org-capture: Fix escaping characters in template embedded S-exps
* lisp/org-capture.el (org-capture-fill-template): Escape backslash
  characters in %i contents when those are inserted within a S-exp.
  Also prevent adding any prefix to %i contents spanning over multiple
  lines when they are inserted within a S-exp.

* testing/lisp/test-org-capture.el (test-org-capture/fill-template):
  Add tests.

Reported-by: Samuel Wales <samologist@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/112232>
2017-03-14 09:03:59 +01:00
Nicolas Goaziou 33b9c42395 org-lint: Report invalid durations in effort properties
* lisp/org-lint.el (org-lint-invalid-effort-property): New checker.
* testing/lisp/test-org-lint.el (test-org-lint/invalid-effort-property):
New test.
2017-03-12 09:08:28 +01:00
Marco Wahl 38b372e143 Merge branch 'maint' 2017-03-07 17:54:54 +01:00
Marco Wahl 4108f52f36 test-org-list.el: Fix visibility tests
* testing/lisp/test-org-list.el (test-org-list/move-item-down):
  Replace several calls of `org-invisible-p2' with calls on a lower
  level.
2017-03-07 16:37:25 +01:00
Marco Wahl 5dfa6d6c47 testing/README: Added hint to 'test-dirty' 2017-03-07 11:23:57 +01:00
Nicolas Goaziou eb1847e29c org-clock: Fix failing test
* testing/lisp/test-org-clock.el (test-org-clock/clocktable/scope):
  Fix failing test.
2017-03-06 19:31:54 +01:00
Eduardo Bellani 78bddaca1f org-clock.el: Add nullary function evaluation as a clocktable scope parameter
* lisp/org-clock.el (org-dblock-write:clocktable): Funcall the scope
  argument if it is a function.

* doc/org.texi: Document the feature of using a nullary function as the
  scope for the clocktable.

* testing/lisp/test-org-clock.el: Adds a test for the above
  feature.  Also, fix the number of hours of a test that seemed to be
  broken.

TINYCHANGE
2017-03-06 18:00:19 +01:00
Nicolas Goaziou df34657905 Merge branch 'maint' 2017-03-05 18:05:33 +01:00
Nicolas Goaziou 8dfab7be23 Fix failing tests
* testing/lisp/test-ob.el (test-ob/org-babel-insert-result): Fix
  failing tests.

Reported-by: "Charles C. Berry" <ccberry@ucsd.edu>
<http://permalink.gmane.org/gmane.emacs.orgmode/112475>
2017-03-05 18:05:02 +01:00
Nicolas Goaziou 6251c87f66 Merge branch 'maint' 2017-03-01 22:19:29 +01:00
Nicolas Goaziou a4eb60931a ob-core: Properly escape Org syntax when inserting results
* lisp/ob-core.el (org-babel-examplify-region): Escape Org syntax
  before wrapping it.

* testing/lisp/test-ob.el (test-ob/org-babel-insert-result): Add test.
  Renamed from `test-ob/org-babel-insert-result--improper-lists'.

Reported-by: D M German <dmg@turingmachine.org>
2017-03-01 22:19:04 +01:00
Nicolas Goaziou 9263bf5766 org-duration: `org-duration-to-minutes' accepts plain numbers
* lisp/org-duration.el (org-duration-to-minutes): Accept plain numbers
  for backward compatibility with `org-hh:mm-string-to-minutes'.

* testing/lisp/test-org-duration.el (test-org-duration/to-minutes):
  Add test.

Reported-by: Dale <dale@codefu.org>
<http://permalink.gmane.org/gmane.emacs.orgmode/112290>
2017-02-23 12:46:37 +01:00
Nicolas Goaziou b1353cb6f8 org-duration: Fix bug with decimal units
* lisp/org-duration.el (org-duration-to-minutes): Fix bug where the
  same unit with a decimal unit would be matched multiple times.
* testing/lisp/test-org-duration.el (test-org-duration/to-minutes):
  Fix test.
2017-02-22 19:34:44 +01:00
Nicolas Goaziou d1577d1e1b Merge branch 'maint' 2017-02-19 15:37:41 +01:00
Nicolas Goaziou 7d7c38c6b1 org-capture: Fix `org-capture-refile'
* lisp/org-capture.el (org-capture-refile): Preserve location of point
  when refiling.

* testing/lisp/test-org-capture.el (test-org-capture/refile): New
  test.

Reported-by: Liu Hui <liuhui1610@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/112202>
2017-02-19 15:37:12 +01:00
Nicolas Goaziou 35822684c1 org-clock: Refactor tests
* testing/lisp/test-org-clock.el (test-org-clock-clocktable-contents):
  Change signature.
(test-org-clock/clocktable/ranges):
(test-org-clock/clocktable/tags):
(test-org-clock/clocktable/scope):
(test-org-clock/clocktable/maxlevel):
(test-org-clock/clocktable/formula):
(test-org-clock/clocktable/lang):
(test-org-clock/clocktable/compact):
(test-org-clock/clocktable/properties): Use updated function.
2017-02-18 20:55:40 +01:00
Nicolas Goaziou a6c318f471 org-clock: Fix missing properties in Clock table
* lisp/org-clock.el (org-clocktable-write-default): Do not ignore
  properties specified by :properties parameter.

* testing/lisp/test-org-clock.el (test-org-clock/clocktable/properties):
  New test.

The regression was introduced in b897ab722.

Reported-by: Dale <dale@codefu.org>
<http://permalink.gmane.org/gmane.emacs.orgmode/112219>
2017-02-18 20:24:51 +01:00
Nicolas Goaziou 552c5c771a org-clock: Small refactoring
* lisp/org-clock.el (org-clocktable-write-default): Small refactoring.
* testing/lisp/test-org-clock.el (test-org-clock/clocktable/compact):
  Add tests.
2017-02-18 14:54:43 +01:00
Nicolas Goaziou 542890cd3f Fix: Prevent spurious newlines when inserting a new heading
* lisp/org.el (org-insert-heading): Do not insert spurious newline
  characters when inserting a headline.

* testing/lisp/test-org.el (test-org/insert-heading): Add tests.

Reported-by: Kyle Sherman <kylewsherman@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/112205>
2017-02-17 21:51:16 +01:00
Nicolas Goaziou 82c3039ce4 org-clock: Fall back to English when no translation is available
* lisp/org-clock.el (org-clock--translate): New function.
(org-clocktable-write-default): Use new function.

* testing/lisp/test-org-clock.el (test-org-clock/clocktable/lang): New
  test.
2017-02-17 15:11:55 +01:00
Nicolas Goaziou f6525e8fe4 Merge branch 'maint' 2017-02-17 13:24:06 +01:00
Nicolas Goaziou 013c0af8b0 org-lint: Add checker for empty headlines with tags
* lisp/org-lint.el (org-lint--checkers): Add checker.
(org-lint-empty-headline-with-tags): New function.

* testing/lisp/test-org-lint.el (test-org-lint/empty-headline-with-tags):
  New test.
2017-02-17 13:23:26 +01:00
Nicolas Goaziou 473ca5c86c Merge branch 'maint' 2017-02-17 08:37:55 +01:00
Fabrice Popineau b5a67ebddd Fix file:// uri handling for windows-nt and cygwin
* lisp/org-element.el (org-element-link-parser):
  Handle drive names in uri like file:///c:/dir/file

* lisp/ox.el (org-export-file-uri):
  Handle drive names in uri like file:///c:/dir/file

* testing/lisp/test-ox.el (test-org-export/file-uri):
  Generate the right uri to be tested against link exporter.
2017-02-17 08:36:00 +01:00
Nicolas Goaziou 2e32709843 Merge branch 'maint' 2017-02-13 21:32:28 +01:00
Nicolas Goaziou b897ab7223 org-clock: Fix regression in Clock table
* lisp/org-clock.el (org-clocktable-write-default): Do not raise an
  error when :maxlevel is 0.  Small refactoring.

* testing/lisp/test-org-clock.el (test-org-clock/clocktable): Split
into ...
(test-org-clock/clocktable/ranges):
(test-org-clock/clocktable/tags):
(test-org-clock/clocktable/scope):
(test-org-clock/clocktable/maxlevel):
(test-org-clock/clocktable/formula): ... these.  Add tests.

This fixes regression introduced in ccf832e83.

Reported-by: Christoph LANGE <math.semantic.web@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/112091>
2017-02-13 21:28:59 +01:00
Nicolas Goaziou 5902b9c2a7 Merge branch 'maint' 2017-02-13 17:22:22 +01:00
Nicolas Goaziou 990fd09ca8 Fix some tests
* testing/lisp/test-org-element (test-org-element/link-parser): Remove
  a test.
* testing/lisp/test-org-pcomplete (test-org-pcomplete/keyword):
* testing/lisp/test-ox.el (test-org-export/file-uri): Fix tests.
2017-02-13 17:21:24 +01:00
Nicolas Goaziou b0251b747a Merge branch 'maint' 2017-02-13 16:35:32 +01:00
Nicolas Goaziou d347d85a15 org-element: Fix `org-element-insert-before'
* lisp/org-element.el (org-element-insert-before): Do not call
  `reverse' as contents might use `eq' objects.

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

Reported-by: Justin Kirby <justinkirby@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/112065>
2017-02-13 16:29:54 +01:00
Nicolas Goaziou 7e8cf5f4c2 Use Org duration library
* contrib/lisp/org-depend.el (org-depend-trigger-todo): Use new
  functions.

* contrib/lisp/org-invoice.el (org-invoice-heading-info):
(org-invoice-info-to-table):
(org-invoice-list-to-table): Use new functions.

* contrib/lisp/ox-taskjuggler.el (org-taskjuggler--build-task): Use
  new functions.

* lisp/org-agenda.el (org-agenda-show-clocking-issues):
(org-agenda-format-item):
(org-agenda-filter-effort-form): Use new functions.

* lisp/org-clock.el (org-clock-get-clock-string):
(org-clock-modify-effort-estimate):
(org-clock-notify-once-if-expired):
(org-clock-out):
(org-clock-display):
(org-clock-put-overlay):
(org-clocktable-write-default): Use new functions.

* lisp/org-table.el (org-table-sort-lines): Use new functions.

* lisp/org.el (org-properties-postprocess-alist):
(org-refresh-effort-properties):
(org-set-effort):
(org-entry-properties):
(org-property-next-allowed-value): Use new functions.

(org-time-clocksum-format):
(org-time-clocksum-use-fractional):
(org-time-clocksum-use-fractional-format):
(org-time-clocksum-use-effort-durations): Declare as obsolete.  Move
to "org-compat.el".

(org-minutes-to-clocksum-string):
(org-hh:mm-string-to-minutes):
(org-duration-string-to-minutes): Declare as obsolete.  Move to
"org-compat.el".
(org-hours-to-clocksum-string): Remove function.

* lisp/org-colview.el (org-columns--collect-values): Use new
  functions.
(org-columns--duration-re): Remove variable.
(org-columns--time-to-seconds): Rename to...
(org-columns--age-to-minutes): ... this.
(org-columns--format-age): New function.
(org-columns--summary-apply-times):
(org-columns--summary-min-age):
(org-columns--summary-max-age):
(org-columns--summary-mean-age): Use new functions.

* testing/lisp/test-org-clock.el (test-org-clock-clocktable-contents-at-point):
* testing/lisp/test-org-colview.el (test-org-colview/columns-summary):
  Update tests.
2017-02-13 14:41:15 +01:00
Nicolas Goaziou 1d39286183 Add tests for "org-duration.el"
* testing/lisp/test-org-duration.el: New file.
2017-02-13 14:39:40 +01:00
Nicolas Goaziou cc14aa6cfe Merge branch 'maint' 2017-02-07 17:01:10 +01:00
Nicolas Goaziou ccf832e831 org-clock: Fix clock percent
* lisp/org-clock.el (org-clocktable-write-default): Fix percent computation.
(org-clock-time%): Remove function.

* testing/lisp/test-org-clock.el (test-org-clock/clocktable): Update
  test.

As a consequence of this patch, a ":formula %" doesn't generate
a TBLFM line anymore.
2017-02-07 16:52:30 +01:00
Nicolas Goaziou 693bda9e5c Remove duplicate test 2017-02-04 21:54:34 +01:00
Nicolas Goaziou 2dfafb9272 Merge branch 'master' of orgmode.org:org-mode 2017-02-04 21:52:36 +01:00
Nicolas Goaziou 6632ce537e Change `org-get-repeater' signature
* lisp/org.el (org-get-repeater): Change optional argument meaning.
* lisp/org-habit.el (org-habit-parse-todo): Apply signature change.
* testing/test-org.el (test-org/get-repeater): Add tests.
2017-02-04 21:45:35 +01:00
Nicolas Goaziou 737ada43c6 Fix "Fix `org-get-repeat'"
* lisp/org.el (org-get-repeat): Make sure matching group refers to the
  proper regexp.
* testing/lisp/test-org.el (test-org/get-repeat): New test.

The bug was introduced in aef7eef0f.
2017-02-04 21:26:17 +01:00
Marco Wahl de58e0ae33 Fix org-get-repeat
* lisp/org.el (org-get-repeat): Wrap call to save match data against
  side effects.

* testing/lisp/test-org.el (test-org/get-repeat): New test for
  `org-get-repeat'.
2017-02-04 00:19:49 +01:00
Nicolas Goaziou 9da78f3e8d Merge branch 'maint' 2017-02-03 22:04:12 +01:00
Nicolas Goaziou 6da9d0a416 Fix indentation of some elements
* lisp/org.el (org--get-expected-indentation): Tiny refactoring.
(org-indent-line): Ignore LaTex environments.
(org-indent-region): Better handling for export blocks, LaTeX
environments and example blocks.

* testing/lisp/test-org.el (test-org/indent-line):
(test-org/indent-region): Add tests.
2017-02-03 22:03:25 +01:00
Nicolas Goaziou a10ddbe2ac Add tests
* testing/lisp/test.org.el (test-org/auto-repeat-maybe):
(test-org/at-timestamp-p): New tests.
2017-02-03 00:36:05 +01:00
Nicolas Goaziou 86efe92484 Merge branch 'maint' 2017-02-01 21:02:48 +01:00
Nicolas Goaziou 73330079c0 org-table: Fix error with `org-table-get-field' at bob
* lisp/org-table.el (org-table-get-field): Do not return
  `beginning-of-buffer' error when called at beginning of buffer.

* testing/lisp/test-org-table.el (test-org-table/get-field): New test.
2017-02-01 20:56:38 +01:00
Marco Wahl 195151a153 Merge branch 'maint' 2017-01-29 16:14:29 +01:00
Marco Wahl 39682d4854 Fix: keep repeaters at rescheduling
* lisp/org.el (org--deadline-or-schedule): Removed a blank in a regexp.
* testing/lisp/test-org.el (test-org/schedule): New test.
2017-01-29 16:11:35 +01:00
Nicolas Goaziou 0ba5e35082 Merge branch 'maint' 2017-01-27 00:29:14 +01:00
Nicolas Goaziou 126a1cd7c1 Fix "APPT_WARNTIME" inheritance
* lisp/org.el (org-refresh-properties): Handle inheritance from global
  values (e.g., from "#+PROPERTY:" keyword).
(org-refresh-property): Handle property inheritance with a new
optional argument.

* testing/lisp/test-org.el (test-org/refresh-properties): New test.
2017-01-27 00:21:42 +01:00
Nicolas Goaziou 3d7c221a45 Merge branch 'maint' 2017-01-25 23:29:40 +01:00
Nicolas Goaziou 7d52a8c3cc Fix `org-schedule' with repeater
* lisp/org.el (org--deadline-or-schedule): New function.
(org-schedule):
(org-deadline): Use new function.

* testing/lisp/test-org.el (test-org/deadline):
(test-org/schedule): New tests.

Reported-by: Michael Welle <mwe012008@gmx.net>
<http://permalink.gmane.org/gmane.emacs.orgmode/111569>
2017-01-25 23:27:33 +01:00
Nicolas Goaziou 2348d18343 Merge branch 'maint' 2017-01-24 22:02:47 +01:00
Nicolas Goaziou c77b658b39 Fix `org-entry-get' with "TIMESTAMP" or "TIMESTAMP_IA"
* lisp/org.el (org-entry-properties): Fix special property value in
  current entry, do not leak into next entry.
* 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/111648>
2017-01-24 22:01:19 +01:00
Nicolas Goaziou eda4684d35 Merge branch 'maint' 2017-01-22 14:29:05 +01:00
Nicolas Goaziou 12a23d6c61 `org-entry-delete' can remove erroneous special properties
* lisp/org.el (org-entry-delete): Also remove erroneously inserted
  special properties in properties drawer.  Small refactoring.

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

Reported-by: Michael Welle <mwe012008@gmx.net>
<http://permalink.gmane.org/gmane.emacs.orgmode/111564>
2017-01-22 14:28:02 +01:00
Nicolas Goaziou 7289293e4e ox-texinfo: Delegate "info" links handling to "org-info.el"
* lisp/org-info.el (org-info-export): Handle links when exporting to
  "texinfo" back-end.
* lisp/ox-texinfo.el (org-texinfo-link): Delegate "info" links
  handling to the function above.
2017-01-21 14:19:29 +01:00
Nicolas Goaziou dbd7d995e8 Merge branch 'maint' 2017-01-21 13:58:03 +01:00
Nicolas Goaziou 2950be040d org-info: Add tests
* testing/lisp/test-org-info.el: New file.
2017-01-21 13:56:58 +01:00
Nicolas Goaziou 37bffbb347 Merge branch 'maint' 2017-01-21 11:59:12 +01:00
Nicolas Goaziou ade36c4b50 org-element: Fix failing test
* testing/lisp/test-org-element.el (test-org-element/cache): Fix
  failing test.
2017-01-21 11:58:42 +01:00
Nicolas Goaziou 6dc6eb3b02 Fix failing test
* lisp/org.el (org-link-search): Remove priority cookie from headlines
  during a fuzzy search.  Tiny optimization.
* testing/lisp/test-org.el (test-org/get-heading): Add tests.
2017-01-19 00:22:49 +01:00
Kyle Meyer c3d67b3556 Merge branch 'maint' 2017-01-17 21:22:11 -05:00
Kyle Meyer 1fbc7a424f org-clone-subtree-with-time-shift: Fix SHIFT check
* lisp/org.el (org-clone-subtree-with-time-shift): Don't choke on a
  blank SHIFT argument.
* testing/lisp/test-org.el (test-org/clone-with-time-shift): Add
  test.

This fixes a regression introduced by c31462f33.
2017-01-17 21:16:24 -05:00