Commit Graph

1886 Commits

Author SHA1 Message Date
Benjamin Motz 3cb4ffe957 org-colview: Add property :exclude-tags to column view table
* lisp/org-colview.el (org-columns--capture-view): Add parameter.
(org-dblock-write:columnview): Add new property.
* doc/org-manual.org (Capturing column view): Document feature.
* testing/lisp/test-org-colview.el (test-org-colview/dblock): Add
  test.

This addition allows to specify a list of tags to exclude from column
view tables.

TINYCHANGE
2018-10-03 18:44:34 +02:00
Nicolas Goaziou 6995f206ad org-colview: Fix failing test
* testing/lisp/test-org-colview.el (test-org-colview/columns-summary):
  Fix failing test.

Since 3367ac945796d7b65feb3c2d0ceb9734a6bbd19c, plain numbers in
properties are minutes instead of hours.
2018-10-03 18:44:34 +02:00
Chris Kauffman d0a5308435 org-table: Adding single cell movement functions
* lisp/org-table.el (org-table--swap-cells):
(org-table--move-cell):
(org-table-move-cell-up):
(org-table-move-cell-down):
(org-table-move-cell-left):
(org-table-move-cell-right): New functions.

* testing/lisp/test-org-table.el (test-org-table/move-cell-down):
(test-org-table/move-cell-up):
(test-org-table/move-cell-right):
(test-org-table/move-cell-left): New tests.

* doc/org-manual.org (Column and row editing): Document functions and
  keybindings for single cell movement.
2018-10-03 18:44:34 +02:00
stardiviner 1b81d6e07b ob-eshell.el: Add Eshell support for Babel
* lisp/ob-eshell.el (org-babel-execute:eshell): Execute Eshell code in Babel.
(org-babel-prep-session:eshell):
(ob-eshell-session-live-p):
(org-babel-eshell-initiate-session):
(org-babel-variable-assignments:eshell):
(org-babel-load-session:eshell):

* testing/test-ob-eshell.el: Write test for ob-eshell.

* doc/org-manual.org (Languages): Add Babel language eshell identity.
2018-10-03 18:44:34 +02:00
Marco Wahl f82a3051a9 test-org-bbdb.el: new tests
* testing/lisp/test-org-bbdb.el (test-org-bbdb-anniv-extract-date):
  Test function `org-bbdb-anniv-extract-date'.
2018-09-23 17:03:00 +02:00
Nicolas Goaziou 17edaf8c14 "src block" -> "source block" in documentation and comments
* etc/ORG-NEWS (Maxima: new headers ~:prologue~ and ~:epilogue~):
(Texinfo exports inline source blocks as ~@code{}~):
(Default lexical evaluation of emacs-lisp source blocks):
* lisp/ob-clojure.el (org-babel-clojure-default-ns):
* lisp/ob-core.el (org-babel-named-src-block-regexp-for-name):
(org-babel-current-src-block-location):
(org-babel-mark-block):
(org-babel-insert-result):
* lisp/ob-emacs-lisp.el (org-babel-default-header-args:emacs-lisp):
* lisp/ob-exp.el (org-babel-exp-process-buffer):
* lisp/ob-lob.el (org-babel-lob-ingest):
* lisp/ob-ref.el:
* lisp/org-element.el (org-element-object-restrictions):
(org-element-src-block-parser):
(org-element-inline-src-block-parser):
* lisp/org-lint.el:
(org-lint--checkers):
* lisp/org-pcomplete.el (pcomplete/org-mode/block-option/src):
* lisp/org-src.el (org-edit-inline-src-code):
* lisp/org.el (org-ctrl-c-ctrl-c):
(org-in-src-block-p):
(org-fill-element):
* lisp/ox-html.el (org-html--textarea-block):
(org-html-format-code):
* lisp/ox-latex.el (org-latex-minted-options):
(org-latex-custom-lang-environments):
* lisp/ox-md.el:
* lisp/ox-odt.el (org-odt-format-code):
* lisp/ox.el (org-export-collect-listings):
* testing/lisp/test-ob-exp.el (ob-exp/src-block-with-affiliated-keyword):
* testing/lisp/test-ob.el (test-ob/preserve-results-indentation):
  Correct "src block" occurrences when they do not specifically refer
  to the element type `src-block'.
2018-09-20 11:23:49 +02:00
Robert Klein 1e6ab19b2a Fix tests for sqlite
- sqlite executable used by ob-sqlite is 'sqlite3'
- require ob-sqlite for test
2018-09-13 23:04:57 +02:00
Nicolas Goaziou 9029161bcd org-footnote: Fix failing test
* testing/lisp/test-org-footnote.el (test-org-footnote/new): Fix
  failing test.
2018-09-05 19:04:34 +02:00
Nicolas Goaziou cbb7be9c25 Revert "org-footnote: Fix location after moving to definition"
This reverts commit 8500501984.
2018-08-30 23:59:01 +02:00
Nicolas Goaziou 1334572582 org-macs: Optimize `org-string-width'
* lisp/org-macs.el (org--string-from-props): New function.
(org-string-display): Remove function.
(org-string-width): Use new function.
2018-08-30 21:09:57 +02:00
Matt Lundin 5e27b2fd32 Ensure that org-get-tags returns all local tags
* lisp/org.el: (org-get-tags) Create a clearer separation between
  local and inherited tags in the function, so that
  org-remove-uninherited tags is only run on inherited tags. This is
  important to avoid destroying existing tags when adding new tags.
* testing/lisp/test-org.el: (test-org/get-tags) Add regression test
2018-08-19 10:28:27 +02:00
Nicolas Goaziou d975b44fd4 Fix `org-kill-line' on tag lines
* lisp/org.el (org-kill-line): Preserve tags when `org-special-ctrl-k'
  is non-nil.
* testing/lisp/test-org.el (test-org/kill-line): New test.

Reported-by: Matt Lundin <mdl@imapmail.org>
<http://lists.gnu.org/r/emacs-orgmode/2018-07/msg00122.html>
2018-07-17 22:24:01 +02:00
Nicolas Goaziou 65ebb128bc org-macro: Fix "results" macro
* lisp/org-macro.el (org-macro-initialize-templates): Do not
  initialize the special "results" macro.
(org-macro-replace-all): Do not raise an error if "results" macro has
no associated template yet.
* lisp/ox.el (org-export-as): Update code comments.
* testing/lisp/test-ox.el (test-org-export/expand-macro): Add test.
2018-07-07 12:53:13 +02:00
Nicolas Goaziou 7d9e4da447 Prevent spurious newline character in fixed-width area value
* lisp/org-element.el (org-element-fixed-width-parser): Prevent
  spurious newline character at the end of the value.
* lisp/ox-latex.el (org-latex-fixed-width):
* lisp/ox-man.el (org-man-fixed-width):
* lisp/ox-texinfo.el (org-texinfo-fixed-width):
* contrib/lisp/ox-groff.el (org-groff-fixed-width): Adapt to change.
* testing/lisp/test-org-element.el (test-org-element/fixed-width-parser):
  Update tests.

Reported-by: 孙振祥 <sunznx@icloud.com>
<http://lists.gnu.org/archive/html/emacs-orgmode/2018-07/msg00003.html>
2018-07-02 00:24:38 +02:00
Nicolas Goaziou 937e7ce76b org-macs: Fix last commit
* lisp/org-macs.el (org-parse-time-string): Fix typo in last commit.
* testing/lisp/test-org-element.el (test-org-element/timestamp):
  Rename to `test-org-element/timestamp-parser'.
2018-07-02 00:18:44 +02:00
Robert Irelan e1f197aec7 org-clock: Test clocktable behavior under `org-extend-today-until'
* testing/lisp/test-org-clock.el (test-org-clock/clocktable/extend-today-until):
  New test.
2018-06-27 08:31:47 +02:00
Nicolas Goaziou 627cb7f578 org-footnote: Fix `org-footnote-goto-previous-reference'
* lisp/org-footnote.el (org-footnote-goto-previous-reference): Only
  add to mark ring on a successful match.  Improve error message when
  reference is outside visible part of buffer.
(org-footnote-get-next-reference): Avoid using
`org-footnote-at-reference-p', which is inaccurate, due to
`org-footnote-in-valid-context-p'.
* testing/lisp/test-org-footnote.el (test-org-footnote/goto-previous-reference):
  New test.
2018-06-24 11:25:15 +02:00
Marco Wahl a6b4cec691 org-agenda: Refactored. Add test.
* lisp/org-agenda.el (org-agenda-mode): Factored out a function for a
  loop occuring two times.
* testing/lisp/test-org-agenda.el: test the text scale after
  agenda-undo.
2018-06-24 09:52:29 +02:00
Nicolas Goaziou 62dd2cc829 Fix regression in tags alignment
* lisp/org.el (org--align-tags-here): Correctly preserve column.
* testing/lisp/test-org.el (test-org/tag-align): Add test.

The regression was introduced in
593058e4a6.

Reported-by: Bernt Hansen <bernt@norang.ca>
<http://lists.gnu.org/r/emacs-orgmode/2018-06/msg00245.html>
2018-06-22 18:49:11 +02:00
Henry Blevins f2500e06f3 ob-scheme: Add tests for scheme result types
* test-ob-scheme.el (test-ob-scheme/verbatim, test-ob-scheme/list):
  New tests.
2018-06-21 22:00:50 +02:00
Nicolas Goaziou 031c53103a org-capture: Fix formulas when capturing rows
* lisp/org-capture.el (org-capture-finalize): Possibly update formula
  when inserting the captured rows in the table.

* testing/lisp/test-org-capture.el (test-org-capture/table-line): Add
  tests.

Reported-by: "Holst Thomas (PS-EC/ESE4)" <Thomas.Holst@de.bosch.com>
<http://lists.gnu.org/r/emacs-orgmode/2018-06/msg00276.html>
2018-06-21 18:09:40 +02:00
Nicolas Goaziou 547b431e70 org-capture: Fix row insertion in a table with a formula
* lisp/org-capture.el (org-capture-place-table-line): Insert new row
  above the formula, not below.
* testing/lisp/test-org-capture.el (test-org-capture/table-line): Add
  test.
2018-06-21 12:17:07 +02:00
Nicolas Goaziou 593058e4a6 `org-set-tags' modifies buffer only when necessary
* lisp/org.el (org--align-tags-here):
(org-set-tags): Modify buffer only when necessary.

* testing/lisp/test-org.el (test-org/set-tags): Add tests.

Reported-by: Allen Li <darkfeline@felesatra.moe>
<http://lists.gnu.org/r/emacs-orgmode/2018-06/msg00242.html>
2018-06-19 09:40:00 +02:00
Nicolas Goaziou 3745c0af9f Fix indentation when wrapping a block around a region
* lisp/org.el (org-insert-structure-template): Indent like the first
  line, not the line the point happens to be on.

Reported-by: stardiviner <numbchild@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2018-06/msg00107.html>
2018-06-12 09:03:33 +02:00
Marco Wahl 13a09b3ba5 Merge branch 'maint' 2018-06-06 16:05:26 +02:00
Marco Wahl 2b76aebfc6 org-element: Fix interpretation as todo kwd when prefix of headline
* lisp/org-element.el (org-element-headline-parser): Check for space
  after todo-kwd.
* testing/lisp/test-org-element.el (test-org-element/headline-todo-keyword):
  Respective tests.
2018-06-06 15:58:20 +02:00
Nicolas Goaziou ed7d1dc6d7 Fix quirks in `org-insert-structure-template'
* lisp/org.el (org-insert-structure-template): Fix some issues.
  Refactor code.
* testing/lisp/test-org.el (test-org/insert-structure-template):
  Update tests.

Reported-by: stardiviner <numbchild@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2018-05/msg00553.html>
2018-06-02 23:41:56 +02:00
Nicolas Goaziou 9d51a8b5a0 org-capture: Fix table line capture with custom location
* lisp/org-capture.el (org-capture-place-table-line): Fix error when
  a precise location is given, e.g. with `file+function' target.

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

Reported-by: Thomas Holst <thomas_holst@gmx.de>
<http://lists.gnu.org/r/emacs-orgmode/2018-05/msg00359.html>
2018-05-17 22:57:49 +02:00
Nicolas Goaziou c46fcd9874 org-lint: Add checker for spurious colons in tags
* lisp/org-lint.el (org-lint--checkers): Add checker.
(org-lint-spurious-colons): New function.
* testing/lisp/test-org-lint.el (test-org/spurious-colons): New test.
2018-05-14 17:41:04 +02:00
Aaron Ecay d94d52489d test files: use cl- prefixed functions, and require cl-lib 2018-05-10 04:22:30 +01:00
Aaron Ecay 7fb3328db8 testing/README: update to new header arg property format 2018-05-10 04:22:30 +01:00
Nicolas Goaziou 9ab45860a6 Merge branch 'maint' 2018-05-01 15:06:57 +02:00
Nicolas Goaziou 80eb69b648 org-list: Proper error message when trying to indent top level item
* lisp/org-list.el (org-list-struct-indent): Return proper error
  message upon trying to indent a top-level item.  Use `user-error'.
* testing/lisp/test-org-list.el (test-org-list/indent-item): Add test.
2018-05-01 15:06:08 +02:00
Nicolas Goaziou ab53ee2c3d org-capture: Fix capturing in a table
* lisp/org-capture.el (org-capture-place-table-line): Rewrite function.
* testing/lisp/test-org-capture.el (test-org-capture/table-line): New
  test.
2018-04-30 00:52:57 +02:00
Nicolas Goaziou 946b469cc2 Remove unnecessary `(require 'cl)'
* testing/examples/babel.org: Remove unnecessary `(require 'cl)'.
2018-04-29 12:04:26 +02:00
Nicolas Goaziou a2994cb005 Mark "org-version-check" obsolete
* lisp/org-compat.el (org-version-check): Mark as obsolete.
(org-no-popups):
* testing/examples/babel.org: Remove use of `org-version-check'.
2018-04-29 11:54:40 +02:00
Nicolas Goaziou ba5bedc17f org-clock: Re-activate tests
* testing/lisp/test-org-clock.el (test-org-clock/clocktable/ranges):
(test-org-clock/clocktable/step): Un-comment tests.

They were commented out in "org-clock.el: New option :tags to insert
tags in clock reports".
2018-04-29 00:22:53 +02:00
Nicolas Goaziou 1615261cdc Preserve point when setting or aligning tags
* lisp/org.el (org--align-tags-here):
(org-set-tags-command):
(org-align-tags): Preserve point.
* testing/lisp/test-org.el (test-org/set-tags-command): Add test.
2018-04-28 23:45:04 +02:00
Nicolas Goaziou c7c8370dfb Fix clock-related failing tests
* testing/lisp/test-org-clock.el (test-org-clock/clocktable/match):
(test-org-clock/clocktable/tags): Fix test.
2018-04-28 02:47:35 +02:00
Nicolas Goaziou 031f362352 Fix `org-toggle-tag'
* lisp/org.el (org-toggle-tag): Fix weird behavior with inherited tags.

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

Reported-by: Bernt Hansen <bernt@norang.ca>
<http://lists.gnu.org/r/emacs-orgmode/2018-04/msg00537.html>
2018-04-28 02:10:44 +02:00
Marco Wahl a0a40a4651 org: Remove special whitespace treatment when moving subtree
* lisp/org.el (org-move-subtree-down): Remove special whitespace treatment.
* testing/lisp/test-org.el (test-org/drag-element-backward):
  Accommodate test.
2018-04-27 01:08:29 +02:00
Bastien f80f7ed98b org-clock.el: New option :tags to insert tags in clock reports
* lisp/org-clock.el (org-clocktable-defaults)
(org-clocktable-write-default, org-clock-get-table-data):
Rename :tags to :match and use :tags to insert a column with
the headline's tags.

Thanks to Raymond Zeitler for suggesting this.
2018-04-26 20:55:27 +02:00
Nicolas Goaziou 3719cdd48e org-table: Fix shrunk hlines
* lisp/org-table.el (org-table--shrink-field): Handle properly shrunk
  hlines with a width cookie.
* testing/lisp/test-org-table.el (test-org-table/toggle-column-width):
  Add test.  Fix tests.

Reported-by: William Denton <wtd@pobox.com>
<http://lists.gnu.org/r/emacs-orgmode/2018-04/msg00306.html>
2018-04-20 11:57:37 +02:00
Nicolas Goaziou 4d152b994e Rewrite tags setting functions
* lisp/org.el (org-setting-tags): Remove variable.
(org-set-tags-command): Change signature.  For interactive use only.
(org-set-tags-to): Remove function.
(org-align-all-tags): Remove function.
(org-align-tags): New function.
(org-set-tags): Change signature.  For non-interactive use only.
(org-promote):
(org-demote):
(org-refile):
(org-todo):
(org-priority):
(org-toggle-tag):
(org-entry-put):
(org-fix-tags-on-the-fly):
(org-ctrl-c-ctrl-c):
(org-delete-indentation):
(org-return):
(org-kill-line): Apply signature change.  Use new functions.
* lisp/ox-beamer.el (org-beamer-property-changed):
(org-beamer-select-environment): Apply signature change.  Use new
functions.
* testing/lisp/test-org-archive.el (test-org-archive/to-archive-sibling):
  Update test.
* testing/lisp/test-org.el (test-org/set-tags): Add tests.
(test-org/set-tags-command): New test.
(test-org/set-tags-to): Remove test.
2018-04-20 10:51:21 +02:00
Nicolas Goaziou 2a293843ad org-lint: Remove useless checker
* lisp/org-lint.el (org-lint--checkers): Remove useless checker.
(org-lint-empty-headline-with-tags): Remove function.
* testing/lisp/test-org-lint.el (test-org-lint/empty-headline-with-tags):
  Remove test.
2018-04-19 11:52:07 +02:00
Nicolas Goaziou fbe56f89f7 Change `org-get-tags' specifications
* lisp/org.el (org-tag-line-re): New variable.
(org-hide-archived-subtrees):
(org-get-buffer-tags): Use new function.
(org--get-local-tags): New function.
(org-get-tags): Change meaning.  Now get all inherited tags.  Change
signature.
* lisp/org-archive.el (org-archive-subtree):
* lisp/org-mobile.el (org-mobile-apply):
(org-mobile-edit):
* lisp/org-mouse.el (org-mouse-tag-menu):
* lisp/org-pcomplete.el (pcomplete/org-mode/tag): Apply change

* testing/lisp/test-org.el (test-org/get-tags): New test.
(test-org/tags-at): Remove test.
2018-04-19 11:51:54 +02:00
stardiviner b088389c6b ob-core: Add document and test for "graphics" format
* doc/org-manual.org: Document value.

* lisp/ob-core.el (org-babel-common-header-args-w-values): Handle
  symbol "graphics".

* testing/lisp/test-ob.el (test-ob/result-graphics-link-type-header-argument):
  New test.
2018-04-12 15:16:04 +02:00
stardiviner 296b0de4e8 ob-core: Add "link" results format
* lisp/ob-core.el (org-babel-execute-src-block): Handle "link" :results
  format.

* doc/org-manual.org: Add document for new result format "link".

* testing/lisp/test-ob.el (test-ob/result-file-link-type-header-argument):
  New test.
2018-04-12 15:15:59 +02:00
Nicolas Goaziou fb58727f32 Merge branch 'maint' 2018-04-08 18:39:36 +02:00
Nicolas Goaziou f05c2eae33 Fix RET on multi-line links
* lisp/org.el (org-return): Follow multi-line links.
* testing/lisp/test-org.el (test-org/return): Add tests.

Reported-by: Brent Goodrick <bgoodr@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2018-04/msg00105.html>
2018-04-08 18:35:40 +02:00
Rasmus d04c20deec org: Change structure insertion
* lisp/org.el (org-insert-structure-template): Change newline
  behavior.
* testing/lisp/test-org.el (test-org/insert-template): New tests.

`org-insert-structure-template' considers indentation and also insert
newlines between the beginning and the end of the block.
2018-04-08 12:47:12 +02:00
Rasmus e5f6cb6c8b org-tempo: Various improvements
* lisp/org-tempo.el (org-tempo-keywords-alist): Improve docstring.
(org-tempo--update-maybe):
(org-tempo--keys): New function.
(org-tempo-complete-tag):
(org-tempo-setup):
(org-tempo-add-templates): Use new functions.
(org-tempo-add-block): Smarter position of point.
* testing/lisp/test-org-tempo.el (test-org-tempo/cursor-placement):
 (test-org-tempo/space-first-line): New tests.
* testing/lisp/test-org-tempo.el (test-org-tempo/completion): Adapt
  test to changes.

Org Tempo more carefully checks for new definitions.  When inserting
blocks point will differ depending on whether it is source block.
2018-04-08 12:47:12 +02:00
Rasmus b56df737b7 org: org-structure-template-alist uses string keys
* lisp/org-tempo.el (org-tempo-keywords-alist):
  (org-tempo-setup):
  (org-tempo-add-templates):
* testing/lisp/test-org-tempo.el (test-org-tempo/add-new-templates):
* lisp/org.el (org-structure-template-alist): Use string keys.
  (org--insert-structure-template-mks):
  (org--insert-structure-template-unique-keys): New functions for block selection.
  (org-insert-structure-template): Use new functions.
* etc/ORG-NEWS:
* doc/org-manual.org: Reflect changes.
2018-04-08 12:47:12 +02:00
Nicolas Goaziou a1ca78d5b8 Merge branch 'maint' 2018-04-03 21:28:37 +02:00
Gong Qijian 1966d58b25 ob-python: Insert blank line when sending code to interpreter
* lisp/ob-python.el (org-bable-python-evaluate-session):

Syntax error occurs when evaluating the following code block:

\#+begin_src python :session
if True:
    1
2
\#+end_src

A blank line is required for top level module code to end an indented block, such as a for loop, try/except, or if statement.

https://www.python.org/dev/peps/pep-0008/#blank-line

TINYCHANGE
2018-04-03 21:24:18 +02:00
Nicolas Goaziou e462125cfc org-table: Improve shrinking on right-aligned and centered columns
* lisp/org-table.el (org-table--make-shrinking-overlay): New function.
(org-table--shrink-field): Use new function.
(org-table--shrink-columns): Update function.
* testing/lisp/test-org-table.el (test-org-table/toggle-column-width):
  Update test.
2018-04-02 20:30:40 +02:00
Nicolas Goaziou 9aaa035e88 Merge branch 'maint' 2018-03-25 22:56:01 +02:00
Nicolas Goaziou 8c9ebc81f0 Revert "ob-table: Fix org-sbe's handling of quotes in cell values"
This reverts commit 5b59e16c9e.
2018-03-25 22:55:24 +02:00
Nicolas Goaziou 9e70db6bab Revert "ob-table: Fix org-sbe's handling of list arguments"
This reverts commit c9d617b322.
2018-03-25 22:55:14 +02:00
Nicolas Goaziou d33e6eae51 org-macro: Refactoring
* lisp/org-macro.el (org-macro-initialize-templates): Refactor function.
* testing/lisp/test-org-macro.el (test-org/macro-replace-all): Remove
  duplicate tests.  Add new test.
2018-03-23 23:40:56 +01:00
Bastien 3a4fd33e58 Merge branch 'maint' 2018-03-22 09:21:33 +01:00
Martin Kampas dd4e57b1d1 Extend match-sparse-tree test for tag hierarchies
* test-org.el (test-org/match-sparse-tree): Add new test.

Test commit 894ec00: Fix recursion stop condition when expanding tags.
2018-03-22 09:21:23 +01:00
Sebastian Reuße 681f870b25 Extend org-sort-entries test
* test-org.el (test-org/sort-entries): Test with empty headings.
2018-03-20 09:18:01 +01:00
Nicolas Goaziou 55d807f348 Merge branch 'maint' 2018-03-20 00:02:26 +01:00
Vladimir Panteleev c9d617b322 ob-table: Fix org-sbe's handling of list arguments
* ob-table.el (org-sbe): Add an explicit case for handling list
arguments. This avoids doing the wrong thing (%s-formatting a list,
thus losing syntax like double-quotes). This enables passing org-table
ranges through org-sbe in a simple and correct manner.

* test-ob-table.el: Add test.
2018-03-20 00:01:09 +01:00
Vladimir Panteleev 5b59e16c9e ob-table: Fix org-sbe's handling of quotes in cell values
* ob-table.el (org-sbe): org-sbe did the wrong thing when given a
reference to a cell containing quotes or backslashes, because it would
simply wrap any $-prefixed value in quotes, without any escaping. Fix
this by using "%S" (instead of "\"%s\"").

* test-ob-table.el: Add test.
2018-03-20 00:01:05 +01:00
Nicolas Goaziou beeb4bf23f ox: Fix regression in INCLUDE keywords
* lisp/ox.el (org-export--prepare-file-contents): Activate Org mode in
  temporary buffer so all regexps are set.  Also, be more strict when
  updating links, i.e., do not bother if both includer and includee
  belong to the same directory, or if there's no includer at all.
  Eventually, only update links within lines specifications, if any.

* testing/lisp/test-ox.el (test-org/expand-include/links): Add tests.

Reported-by: Kaushal Modi <kaushal.modi@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2018-03/msg00394.html>
2018-03-19 23:48:38 +01:00
Nicolas Goaziou a23be068f6 ox: Add test for included files.
* testing/lisp/test-ox.el (test-org/expand-include/links): New test.
2018-03-18 16:13:06 +01:00
Nicolas Goaziou 594b2dbae8 Merge branch 'maint' 2018-03-17 14:57:25 +01:00
Nicolas Goaziou ea4cb14883 Fix `org-set-tags-to'.
* lisp/org.el (org-set-tags-to): Do not throw an error on empty
  headlines.
* testing/lisp/test-org.el (test-org/set-tags): Move test.
(test-org/set-tags-to): New test.

Reported-by: Adrian Bradd <a.bradd@columbia.edu>
<http://lists.gnu.org/r/emacs-orgmode/2018-03/msg00210.html>
2018-03-17 14:56:49 +01:00
Nicolas Goaziou 5aaf3dfc7e Move `org-heading-delete-metadata' into "org-list.el"
* lisp/org.el (org-heading-delete-metadata): Move to...
* lisp/org-list.el (org-list--delete-metadata): ... here.  Refactor
  code.
(org-toggle-item): Use new function.

* testing/lisp/test-org-list.el (test-org-list/toggle-item): Add test.

At the moment, this function is only used internally in "org-list.el",
so it belongs there.

Also refrain from removing log or clock drawers, because they may not
contain all clocks or notes anyway. Besides, the information they
contain may still make sense in a plain list.
2018-03-17 11:49:16 +01:00
Sebastian Reuße 4b19029a72 Improve ‘org-sort-list’ test
* test-org-list.el (test-org-list/sort): Take case-sensitive
vs. insensitive sorting into account.
2018-03-13 09:09:58 +01:00
Sebastian Reuße 88bf8aef28 org-table-sort-lines: Fix case-sensitive sorting
* org-table.el (org-table-sort-lines): Fix case sensitive sorting,
improve docstring.
* test-org-table.el (test-org-table/sort-lines): Enforce C locale when
testing alphabetic sorting.

‘sort-subr’ ignores ‘sort-fold-case’ when a predicate is provided. To
correctly handle case-sensitivity, we now bake it into the predicate.

Since we are now sorting according to the user’s locale, WITH-CASE
will not make a difference in most instances, since most locales
always sort case-insensitively (cf. how GNU sort ignores the ‘-f’
switch).  We now mention this in the function docstring.

In order to meaningfully test case-sensitive sorting, we now enforce
the C locale in the respective unit test.
2018-03-13 09:09:54 +01:00
Sebastian Reuße 89ec5e198b Fix org-table-sort-lines test
* test-org-table.el (test-org-table/sort-lines): Fix and improve
testcase.

Sorting and reversing «a C b» should result in «C b a», not in «b a
C».  This test did not fail previously only because
org-table-sort-lines had an issue whereby sorts were always
case-sensitive.
2018-03-13 09:09:41 +01:00
Nicolas Goaziou 8ebf4b7274 Change `org-paste-subtree' behavior
* lisp/org.el (org-paste-subtree): Never split a section. Instead
  always insert tree before the headline after point.  Use `org-yank'
  to split the section.
* testing/lisp/test-org.el (test-org/paste-subtree): New test.
2018-02-27 00:03:31 +01:00
Nicolas Goaziou bbcf2f939c Merge branch 'maint' 2018-02-15 15:04:59 +01:00
Nicolas Goaziou df80fde9d0 Fix failing tests
Use relative symlinks instead of absolute ones.

Reported-by: Nick Dokos <ndokos@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2018-02/msg00241.html>
2018-02-15 15:01:45 +01:00
Nicolas Goaziou 58da7d4d17 org-table: Fix shrunk columns on hlines
* lisp/org-table.el (org-table--shrunk-field): Fix function when on
  a hline.
* testing/lisp/test-org-table.el (test-org-table/shrunk-columns): Add
  tests.

Reported-by: Kaushal Modi <kaushal.modi@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2018-02/msg00231.html>
2018-02-14 18:48:48 +01:00
Nicolas Goaziou 2a7a4a65ad Merge branch 'maint' 2018-02-13 14:10:28 +01:00
Nicolas Goaziou 7c21dfc771 ox-publish: Follow symlink directories
* lisp/org-compat.el (directory-files-recursively): Remove
  compatibility function, no longer needed.
* lisp/ox-publish.el (org-publish--expand-file-name):
(org-publish-org-to):
(org-publish-collect-index):
(org-publish--store-crossrefs):
(org-publish-resolve-external-link): Preserve symlinks in file name.
(org-publish-get-base-files): Follow symlink directories.
(org-publish-get-project-from-filename): Preserve symlinks in file
name.  Do not use `file-in-directory-p', which ignores symlinks.

Reported-by: Michel Damiens <michel.damiens@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2018-02/msg00186.html>
2018-02-13 14:06:56 +01:00
Nicolas Goaziou c29efc8f91 Remove non-functional test
* testing/lisp/test-org.el (test-org/sort-entries): Remove a test.
2018-02-12 17:56:46 +01:00
Sebastian Reuße 551d2f1fe7 Fix alphabetic sorting for headlines, tags
* org.el (org-sort-entries): Use collated sorting.
(org-tags-sort-function): Use collated sorting.
(org-string-collate-greaterp): Add helper-function to use as defcustom
option, since there is no ‘string-collate-greaterp’ in Emacs.

* org-compat.el (org-string-collate-lessp): Add proxy to fall-back on
string-lessp when string-collate-lessp is missing (Emacs ≤ 24).

* test-org.el (test-org/string-collate-lessp): Add test.
(test-org/sort-entries): Add regression test for non-ASCII inputs.

‘org-sort-entries’ and ‘org-tags-sort-function’ advertise alphabetic
sorting, but actually sort based only on character code.  This
produces non-alphabetic orderings of strings in non-ASCII locales.

E. g., German Umlauts “Ä Ü Ö” are alphabetically sorted as if they
were “A U O”, whereas sorting based on character-code will place them
after “Z”, which is unexpected.
2018-02-12 14:57:54 +01:00
Kaushal Modi b505a5b6ad Merge branch 'maint' 2018-02-11 15:29:57 -05:00
Kaushal Modi fe7619cd18 Do not auto-fill when point is in Org property drawer
* lisp/org.el (org-return): Set auto-fill-function to nil when point
  is in an Org property drawer.
* testing/lisp/test-org.el (test-org/return): Add test.

<http://lists.gnu.org/r/emacs-orgmode/2018-02/msg00102.html>
2018-02-11 15:19:49 -05:00
Nicolas Goaziou 3558e6e835 Merge branch 'maint' 2018-02-05 15:37:15 +01:00
Tim Landscheidt 61a885a399 Make manual and URL links in docstrings clickable 2018-02-05 15:27:12 +01:00
Marco Wahl 8554aa93a7 test-ob: Fix test case
* testing/lisp/test-ob.el (test-ob/org-babel-remove-result--results-list):
  Removed the inner list.  Expectation "- (quote (4 5))" did not match
  the result "- '(4 5)".  I think this difference is not worth testing
  in this test.
2018-02-05 10:45:12 +01:00
Nicolas Goaziou f500d7c7f6 org-element: Fix example and src block interpreter.
* lisp/org-element.el (org-element-example-block-interpreter):
(org-element-src-block-interpreter): Correctly handle indentation.
* testing/lisp/test-org-element.el (test-org-element/example-block-interpreter):
  Add tests.

Reported-by: Yasushi SHOJI <yasushi.shoji@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2018-02/msg00006.html>
2018-02-04 10:04:17 +01:00
Nicolas Goaziou 85418667a6 Merge branch 'maint' 2018-02-04 00:31:47 +01:00
Nicolas Goaziou 248bc9631b org-element: Revert regexp change for inline source blocks and babel calls
* lisp/org-element.el (org-element-inline-babel-call-parser):
(org-element-inline-src-block-parser): Revert commit
7efa0f2879.

* testing/lisp/test-ob-exp.el (ob-exp/exports-inline-code):
* testing/lisp/test-org-element.el (test-org-element/inline-src-block-parser):
Update tests.

Reported-by: Greg Minshall <minshall@acm.org>
<http://lists.gnu.org/r/emacs-orgmode/2018-02/msg00002.html>
2018-02-04 00:30:00 +01:00
Nicolas Goaziou 892ae3c2e1 Merge branch 'maint' 2018-02-04 00:13:36 +01:00
Nicolas Goaziou 19dcbab6f0 ox: Fix select tags and exclude tags and tags hierarchy
* lisp/ox.el (org-export--selected-trees): Expand select tags groups.
(org-export--prune-tree): Expand exclude tags groups.
(org-export--skip-p): Change signature.

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

Reported-by: Pierre-Luc Gauthier <p.luc.gauthier@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2018-02/msg00039.html>
2018-02-04 00:12:45 +01:00
Nicolas Goaziou 485f218510 Merge branch 'maint' 2018-01-30 10:12:32 +01:00
Nicolas Goaziou 7efa0f2879 Fix inline src and inline babel calls parsing
* lisp/org-element.el (org-element-inline-babel-call-parser):
(org-element-inline-src-block-parser): Tolerate any prefix before the objects.

* testing/lisp/test-ob-exp.el (ob-exp/exports-inline-code):
* testing/lisp/test-org-element.el (test-org-element/inline-src-block-parser):
Update tests.

Reported-by: Greg Minshall <minshall@acm.org>
<http://lists.gnu.org/r/emacs-orgmode/2018-01/msg00489.html>
2018-01-30 10:11:02 +01:00
Nicolas Goaziou 8730f80c0d org-element: Fix failing test
* testing/lisp/test-org-element.el (test-org-element/interpret-data):
  Fix test.
2018-01-28 15:40:15 +01:00
Nicolas Goaziou 33a9eef11f Allow editing partially shrunk columns
* lisp/org-table.el (org-table-with-shrunk-field): New macro.
(org-table-get-field):
(org-table-toggle-column-width): Use new macro.
(org-table--shrunk-field): Update function.
(org-table--shrink-field): When there is a width cookie, leave first
characters editable.

* lisp/org.el (org-self-insert-command):
(org-delete-backward-char):
(org-delete-char): Small refactoring.  Handle shrink overlays.

* testing/lisp/test-org-table.el (test-org-table/toggle-column-width):
  Update tests.
2018-01-25 23:57:11 +01:00
Nicolas Goaziou 9cf9f56ff6 org-table: Fix `org-table-current-column' on hlines
* lisp/org-table.el (org-table-current-column): Return a meaningful
  value also on hlines.
(org-table-toggle-column-width): Use `org-table-current-column'
instead of re-inventing wheel.

* testing/lisp/test-org-table.el (test-org-table/current-column): New
  test.
2018-01-25 22:55:53 +01:00
Nicolas Goaziou 13424336a6 org-element: Prefer lower case letters for blocks and keywords
* lisp/org-element.el (org-element-center-block-interpreter):
(org-element-dynamic-block-interpreter):
(org-element-inlinetask-interpreter):
(org-element-quote-block-interpreter):
(org-element-special-block-interpreter):
(org-element-babel-call-interpreter):
(org-element-comment-block-interpreter):
(org-element-example-block-interpreter):
(org-element-export-block-interpreter):
(org-element-keyword-interpreter):
(org-element-src-block-interpreter):
(org-element-verse-block-interpreter): Use lower case letters when
interpreting object.

* testing/lisp/test-org-element.el (test-org-element/example-block-parser):
(test-org-element/center-block-interpreter):
(test-org-element/dynamic-block-interpreter):
(test-org-element/inlinetask-interpreter):
(test-org-element/quote-block-interpreter):
(test-org-element/comment-block-interpreter):
(test-org-element/example-block-interpreter):
(test-org-element/keyword-interpreter):
(test-org-element/src-block-interpreter):
(test-org-element/verse-block-interpreter):
* testing/lisp/test-ox.el (test-org-export/handle-options):
(test-org-export/expand-macro):
(test-org-export/before-processing-hook): Update tests.
2018-01-24 12:56:25 +01:00
Nicolas Goaziou 2367e25c6b Merge branch 'maint' 2018-01-22 19:29:32 +01:00
Nicolas Goaziou 4d46a20ea2 ob-lob: Fix Babel calls with external references
* lisp/ob-lob.el (org-babel-lob--src-info):
(org-babel-lob-get-info): Handle calls with external references, i.e.,
FILE:NAME(...) syntax.

* testing/lisp/test-ob-lob.el (test-ob-lob/external-reference-syntax):
(test-ob-lob/call-with-indirection): New tests.
2018-01-22 19:27:13 +01:00
Nicolas Goaziou 929b65533a Merge branch 'maint' 2018-01-19 18:31:48 +01:00
Tim Landscheidt 63c0266688 Update URLs in source code or tests
TINYCHANGE
2018-01-19 18:30:40 +01:00
Nicolas Goaziou 0155441358 Merge branch 'maint' 2018-01-19 18:22:00 +01:00
Tim Landscheidt b289a65be7 Use https for links to orgmode.org
TINYCHANGE
2018-01-19 18:14:58 +01:00
Nicolas Goaziou fd1b3ad972 Fix failing test
* testing/lisp/test-org.el (test-org/timestamp-from-time): Do not
  hardcode internal time.

Reported-by: Tim Landscheidt <tim@tim-landscheidt.de>
<http://lists.gnu.org/r/emacs-orgmode/2018-01/msg00297.html>
2018-01-17 22:49:05 +01:00
Marco Wahl 1062c63ee1 test-ob-sed: Activate testing ob-sed 2018-01-14 18:34:49 +01:00
Marco Wahl 75be0362da test-org-tempo: Fix typo which activates the org-tempo tests 2018-01-14 13:59:24 +01:00
Nicolas Goaziou 4dbb4a76a7 Implement `org-show-all'
* lisp/org.el (org-show-all): New function.
(org-cycle):
(org-cycle-internal-global):
(org-global-cycle):
(org-set-startup-visibility):
(org-set-outline-overlay-data):
(org-hide-block-all):
(org-mode-hook):
(org-tree-to-indirect-buffer):
(org-sort-entries):
(org-mode-map):
(org-org-menu):
* lisp/ob-lilypond.el (org-babel-lilypond-mark-error-line):
* lisp/org-archive.el (org-archive-subtree):
* lisp/org-capture.el (org-capture-place-template):
* lisp/org-mouse.el (org-mouse-popup-global-menu):
* lisp/ox-org.el (org-org-publish-to-org):
* testing/org-test.el (org-test-at-id):
(org-test-in-example-file): Use new function.

* lisp/org-compat.el (org-show-block-all): Mark as obsolete.
2018-01-10 15:58:21 +01:00
Nicolas Goaziou 728920a8ed Rename `org-timestamp--to-internal-time' into `org-timestamp-to-time'
* lisp/org.el (org-timestamp-to-time): New function.
(org-timestamp--to-internal-time): Remove function.
(org-timestamp-format): Use new function.

* testing/lisp/test-org.el (test-org/timestamp-to-time): New test.
2018-01-10 15:05:11 +01:00
Nicolas Goaziou d3cdc35e06 Implement `org-timestamp-from-string', `org-timestamp-from-time'
* lisp/org.el (org-timestamp-from-string):
(org-timestamp-from-time): New functions.

* testing/lisp/test-org.el (test-org/timestamp-from-string):
(test-org/timestamp-from-time): New tests.
2018-01-10 14:35:32 +01:00
Nicolas Goaziou 46e24f6830 Merge branch 'maint' 2018-01-09 19:51:17 +01:00
Nicolas Goaziou 8c7a14a850 org-clock: Consider hours when splitting the table with :steps
* lisp/org-clock.el (org-clocktable-steps): Check time when :tstart
  and :tend are defined.
* testing/lisp/test-org-clock.el (test-org-clock/clocktable/step): Add
  tests.

Reported-by: savoie@nsidc.org
<http://lists.gnu.org/r/emacs-orgmode/2018-01/msg00227.html>
2018-01-09 19:47:39 +01:00
Nicolas Goaziou b65fe0f7a2 Merge branch 'maint' 2018-01-07 10:56:02 +01:00
Nicolas Goaziou 0c93296f83 org-table: Obey to `org-table-formula-create-columns'
* lisp/org-table.el (org-table-recalculate): Return an error when the
  formula cannot create a necessary column.
(org-table-formula-create-columns): Fix docstring.
* testing/lisp/test-org-table.el (test-org-table/field-formula-outside-table):
  Fix tests.
2018-01-07 10:55:30 +01:00
Kyle Meyer d94f7024bc Merge branch 'maint' 2018-01-07 00:28:35 -05:00
Kyle Meyer 3e1641ef0a Update copyright years 2018-01-07 00:27:54 -05:00
Nicolas Goaziou b030475575 Merge branch 'maint' 2018-01-02 14:14:18 +01:00
Nicolas Goaziou 16c7ae7996 Fix handling nested VISIBILITY properties
* lisp/org.el (org-set-visibility-according-to-property): Fix handling
  nested VISIBILITY properties.
* testing/lisp/test-org.el (test-org/set-visibility-according-to-property):
  New test.

Reported-by: Michael Maurer <maurer.michael@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2018-01/msg00012.html>
2018-01-02 14:13:46 +01:00
Nicolas Goaziou e9f30779de Merge branch 'maint' 2017-12-31 15:49:55 +01:00
Nicolas Goaziou af58a6dbf7 Change Org-mode into Org mode
* lisp/ob-core.el (org-babel-result-to-file):
* lisp/ob-picolisp.el:
* lisp/org-agenda.el (org-check-for-org-mode):
(org-search-view):
(org-tags-view):
(org-agenda-cleanup-fancy-diary):
(org-agenda-get-day-entries):
* lisp/org-table.el (orgtbl-mode):
* lisp/org-w3m.el (org-w3m-copy-for-org-mode):
* lisp/org.el (org-modules):
(org-startup-options):
(org-fontify-meta-lines-and-blocks):
* mk/default.mk:
* mk/manfull.pl:
* mk/org-fixup.el (org-make-org-version):
(org-make-org-loaddefs):
* mk/orgcard2txt.pl (rep_esc):
* mk/targets.mk ($(info):
* testing/README:
(Example):
* testing/examples/no-heading.org:
* testing/examples/normal.org: Change Org-mode into Org mode
2017-12-31 15:48:09 +01:00
Nicolas Goaziou c5208634ba Fix failing tests.
* testing/lisp/test-org-list.el (test-org-list/send-list): Remove
  test.
(test-org-list/to-html):
(test-org-list/to-latex):
(test-org-list/to-texinfo): Update tests.
2017-12-31 15:19:56 +01:00
Nicolas Goaziou 2fb65b73b6 test-org-table: Tiny refactoring
* testing/lisp/test-org-table.el (test-org-table/org-table-make-reference/mode-string-EL):
(test-org-table/org-table-make-reference/mode-string-E):
(test-org-table/org-table-make-reference/mode-string-EN):
(test-org-table/org-table-make-reference/mode-string-L):
(test-org-table/org-table-make-reference/mode-string-none):
(test-org-table/org-table-make-reference/mode-string-N): Tiny
refactoring.
2017-12-30 00:24:01 +01:00
Marco Wahl 144451143a Merge branch 'maint' 2017-12-28 19:15:43 +01:00
Marco Wahl e401afffde inlinetask: Fix folding of directly consecutive inlinetask children 2017-12-28 19:12:36 +01:00
Marco Wahl 6311c12556 Merge branch 'maint' 2017-12-28 18:05:54 +01:00
Marco Wahl b29a972307 org-inlinetask:Fix folding of inline tasks within plain list
This is the fix proposed by Nicolas.  See
http://lists.gnu.org/archive/html/emacs-orgmode/2017-12/msg00564.html

Add and accommodate some tests.
2017-12-28 17:59:52 +01:00
Marco Wahl 269009d297 Merge branch 'maint' 2017-12-28 15:44:34 +01:00
Marco Wahl ab61357791 testing/README Document use of regexp filter for testing 2017-12-28 15:35:19 +01:00
Nicolas Goaziou 774e553f11 Merge branch 'maint' 2017-12-23 14:03:47 +01:00
Nicolas Goaziou d9125e435f Fix recursive Noweb expansion
* lisp/ob-core.el (org-babel-expand-noweb-references): Recursive Noweb
  expansion obey to :noweb parameter.
* testing/lisp/test-ob.el (test-ob/noweb-expansion): Add tests.

Fixes: 17523
2017-12-23 13:58:25 +01:00
Nicolas Goaziou 913aad68c3 Merge branch 'maint' 2017-12-20 13:16:28 +01:00
Nicolas Goaziou 3acc212c8f ob-core: Get :noweb-ref from definition instead of point of call
* lisp/ob-core.el (org-babel-expand-noweb-references): Get :noweb-ref
  from definition instead of point of call.

* testing/lisp/test-ob.el (test-ob/noweb-expansion-1):
(test-ob/noweb-expansion-2): Merge tests.  Add test.
2017-12-20 13:15:08 +01:00
Kyle Meyer 06b49cd837 Merge branch 'maint' 2017-12-19 00:00:49 -05:00
Jack Kamm b506bb68d0 ob-python: Fix :session :results output multiline behavior
* lisp/ob-python.el (orb-babel-python-evaluate-session): When :session
:results output, send multiline code blocks to tmpfile and execute in
Python with exec().
(org-babel-python--exec-tmpfile): New variable.
* testing/lisp/test-ob-python.el (test-ob-python/session-multiline):
Test for :session with multiple lines and indentation.
2017-12-18 23:59:04 -05:00
Nicolas Goaziou fdb2eb6701 Preserve file local variables during some operations
* lisp/org-macs.el (org-preserve-local-variables): New macro.
* lisp/org-footnote.el (org-footnote--clear-footnote-section):
(org-footnote--goto-local-insertion-point):
(org-footnote-create-definition):
(org-footnote-delete):
(org-footnote-renumber-fn:N):
(org-footnote-sort):
(org-footnote-normalize):
* lisp/org.el (org-move-subtree-down):
(org-copy-subtree):
(org-sort-entries):
(org-refile): Use new macro.
* testing/lisp/test-org-footnote.el (test-org-footnote/normalize):
(test-org-footnote/delete):
(test-org-footnote/sort):
(test-org-footnote/normalize):
* testing/lisp/test-org.el (test-org/sort-entries): Add tests.

Operations affected include copying, killing, refiling, archiving and
moving subtrees.  It also affects sorting, creating and deleting
footnotes.
2017-12-18 16:01:41 +01:00
Nicolas Goaziou 3ac619c8ac org-macro: Placeholders in (eval ...) macros are always strings
* lisp/org-macro.el (org-macro-initialize-templates): Update
  templates.
(org-macro-expand): Ensure placeholders in "eval" macros are strings.

* testing/lisp/test-org-macro.el (test-org/macro-replace-all): Update
  tests.
2017-12-17 09:40:56 +01:00
Nicolas Goaziou 6ffcdcbf02 Merge branch 'maint' 2017-12-16 13:45:43 +01:00
Nicolas Goaziou 84cb63a44a ox: Fix plain text export with `org-export-with-backend'
* lisp/ox.el (org-export-with-backend): Handle arity for plain text
  transcoder.
* testing/lisp/test-ox.el (test-org-export/with-backend): Add test.
2017-12-16 13:44:56 +01:00
Nicolas Goaziou 5d4691dfbf Merge branch 'maint' 2017-12-15 00:00:55 +01:00
Nicolas Goaziou 327ca051ae ob-ref: Fix parsing arguments with a newline character
* lisp/ob-ref.el (org-babel-ref-split-regexp): Remove variable.
(org-babel-ref-parse): Handle arguments containing a newline
character (e.g., strings).

* testing/lisp/test-ob-lob.el (test-ob-lob/assignment-with-newline):
  New test.
2017-12-15 00:00:30 +01:00
Nicolas Goaziou 6fc4a1c53b Merge branch 'maint' 2017-12-14 22:40:55 +01:00
Nicolas Goaziou fe98379fce Fix fuzzy link escaping
* lisp/org.el (org-make-link-string): Properly escape square brackets
  and percent sings in fuzzy links.

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

Reported-by: Paulo Matos <paulo@matos-sorge.com>
<http://lists.gnu.org/r/emacs-orgmode/2017-12/msg00269.html>
2017-12-14 22:39:54 +01:00
Nicolas Goaziou f8849e92e5 org-archive: Add a test
* testing/lisp/test-org-archive.el (test-org-archive/to-archive-sibling):
New test.
2017-12-11 23:22:21 +01:00
Nicolas Goaziou c3c1c52eb8 ox: Fix inline source block evaluation
* lisp/ox.el (org-export-as): Specifically expand {{{results}}} macro
  after Babel code execution.
* testing/lisp/test-ox.el (test-org-export/expand-macro): Add test.

Reported-by: "Berry, Charles" <ccberry@ucsd.edu>
<http://lists.gnu.org/r/emacs-orgmode/2017-12/msg00202.html>
2017-12-11 14:56:57 +01:00
Nicolas Goaziou fc5abc2d55 ob-core: Insert lowercase results
* lisp/ob-core.el (org-babel-insert-result): Insert lower case blocks
  and drawers.

* testing/lisp/test-ob.el (test-ob/org-babel-remove-result--results-wrap):
(test-ob/org-babel-remove-result--results-org):
(test-ob/org-babel-remove-result--results-html):
(test-ob/org-babel-remove-result--results-latex):
(test-ob/org-babel-remove-result--results-code): Update tests.
2017-12-10 23:05:32 +01:00
Rasmus 94f1a58438 org-tempo.el: New file for expansion of templates
* lisp/org-tempo.el: New file.
* doc/org.texi (Structure templates):
* lisp/org.el (org-modules): Add org-tempo.
* testing/lisp/test-org-tempo.el: New file.
2017-12-08 00:29:08 +01:00
Nicolas Goaziou 259656a76e Merge branch 'maint' 2017-12-03 09:03:37 +01:00
Nicolas Goaziou 2faaacfeeb Revert the whole time zone mess
* lisp/org.el (org-time-string-to-time):
(org-time-string-to-seconds): Remove optional ZONE argument.
(org-2ft):
(org-check-before-date):
(org-check-after-date):
(org-check-dates-range):
(org-parse-time-string):
* lisp/org-clock.el (org-clock-get-sum-start):
(org-clock-out):
(org-clock-timestamps-change):
(org-clock-sum):
(org-clock-update-time-maybe):
* lisp/org-colview.el (org-columns--age-to-minutes): Apply change.
* testing/lisp/test-org-clock.el (org-test-clock-create-clock):
(test-org-clock/clocktable/scope):
* testing/lisp/test-org-colview.el (test-org-colview/columns-summary):
  Apply change.  Simplify tests to avoid daylight saving time issue.
2017-12-03 08:57:37 +01:00
Nicolas Goaziou bdaf5dacf4 Merge branch 'maint' 2017-12-02 17:27:53 +01:00
Nicolas Goaziou ca43c1f262 Fix RET past the last column of a table
* lisp/org.el (org-return): Split the table before first column or
  after last one.
* lisp/org-table.el (org-table-next-row): Remove code handling split.

* testing/lisp/test-org.el (test-org/return): Add test.
2017-12-02 17:23:03 +01:00
Nicolas Goaziou 0ace32b045 Merge branch 'maint' 2017-12-02 12:23:02 +01:00
Nicolas Goaziou f53d1e2005 Let `or-export-last-sibling-p' handle discontinuous headlines
* lisp/ox.el (org-export-last-sibling-p): Handle discontinuous
  headlines.
* testing/lisp/test-ox.el (test-org-export/last-sibling-p): Add test.

Fixes: 24836
2017-12-02 12:22:32 +01:00
Alex Branham ee7ead62aa Make `org-comment-dwim' check if on a heading
* lisp/org.el (org-comment-dwim): If on a heading, comment the
  heading.

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

TINYCHANGE
2017-11-29 14:41:12 +01:00
Nicolas Goaziou acfb1ca4b8 Merge branch 'maint' 2017-11-29 14:37:33 +01:00
Nicolas Goaziou 12ea0f08f4 Fix some tests
* testing/lisp/test-org.el (test-org/comment-dwim): Fix tests
2017-11-29 14:37:12 +01:00
Nicolas Goaziou b0ab7008df Merge branch 'maint' 2017-11-26 10:47:55 +01:00
Nicolas Goaziou 6aac798f25 Fix publishing links to absolute file names belonging to project
* lisp/ox-publish.el (org-publish-file-relative-name): New function.
* lisp/ox-html.el (org-html-link): Use new function.

* testing/lisp/test-ox-publish.el (test-org-publish/file-relative-name):
  New test.
2017-11-26 10:46:53 +01:00
Nicolas Goaziou be1e807942 Merge branch 'maint' 2017-11-25 21:13:58 +01:00
Nicolas Goaziou 1d8126385c ob-core: Fix results removal without blank line between source and results
* lisp/ob-core.el (org-babel-remove-result): Delete blank lines before
  results.
(org-babel-result-end): Use `org-element-at-point'.
* testing/lisp/test-ob.el (test-ob-verify-result-and-removed-result):
  Remove duplicate.
* testing/lisp/test-ob.el (test-ob/org-babel-remove-result--no-blank-line):
  New test.
* testing/lisp/test-ob.el (test-ob/results-in-narrowed-buffer): Small
  refactoring.

Reported-by: Ken Mankoff <mankoff@gmail.com>
<http://lists.gnu.org/archive/html/emacs-orgmode/2017-11/msg00338.html>
2017-11-25 21:07:52 +01:00
Nicolas Goaziou 51234f9555 org-macro: Implement "keyword" macro
* lisp/org-macro.el (org-macro-initialize-templates): Implement
  "keyword" macro.
* doc/org.texi (Macro replacement): Document new macro.

* testing/lisp/test-org-macro.el (test-org-macro/keyword): New test.
2017-11-21 23:38:24 +01:00
Nicolas Goaziou 7455f4bf83 ox: Allow a less strict UNNUMBERED inheritance
* lisp/ox.el (org-export-collect-headlines):
(org-export-excluded-from-toc-p): Allow to number headlines in the
middle of an otherwise unnumbered tree.

* testing/lisp/test-ox.el (test-org-export/collect-headlines):
(test-org-export/excluded-from-toc-p):
(test-org-export/toc-entry-backend): Update tests.  Add more tests.

Reported-by: Akater <nuclearspace@gmail.com>
<http://lists.gnu.org/archive/html/emacs-orgmode/2017-11/msg00219.html>
2017-11-20 14:07:03 +01:00
Nicolas Goaziou f482cfa785 Merge branch 'maint' 2017-11-20 00:14:05 +01:00
Nicolas Goaziou 82812ff086 ox: Fix UNNUMBERED strict inheritance
* lisp/ox.el (org-export-numbered-headline-p): Use a less opinionated
  definition of inheritance.

* testing/lisp/test-ox.el (test-org-export/numbered-headline-p):
  Update test.

* doc/org.texi (Export settings): Insist on UNNUMBERED inheritance.

It is now possible to number a headline within an unnumbered tree.
2017-11-20 00:09:59 +01:00
Nicolas Goaziou b8d473a04f org-table: Insert new column to the right instead of the left
* lisp/org-table.el (org-table-insert-column): Insert new column to
  the right instead of the left.

* testing/lisp/test-org-table.el (test-org-table/insert-column): New
  test.
2017-11-19 23:22:16 +01:00
Nicolas Goaziou 966af419f9 Merge branch 'maint' 2017-11-15 18:14:44 +01:00
Nicolas Goaziou 40f73953f6 Fix `org-string-display'
* lisp/org-macs.el (org-string-display): Preserve original string's
  display property when computing displayed width.

* testing/lisp/test-org-macs.el (test-org/string-display): Add test.

Reported-by: Ruy Exel <ruyexel@gmail.com>
<http://lists.gnu.org/archive/html/emacs-orgmode/2017-11/msg00160.html>
2017-11-15 18:13:34 +01:00
Nicolas Goaziou 8ff3673dfc Merge branch 'maint' 2017-11-15 17:41:48 +01:00
Nicolas Goaziou 6059c3a057 org-table: Clean left-over `:org-untouchable' property
* lisp/org-table.el (org-table-recalculate): Clean `:org-untouchable'
  property once we no longer need it.

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

Reported-by: Ruy Exel <ruyexel@gmail.com>
<http://lists.gnu.org/archive/html/emacs-orgmode/2017-11/msg00159.html>
2017-11-15 17:40:22 +01:00
Marco Wahl 5c382f2ee2 org-attach,test-org-attach: Refactoring.
* lisp/org-attach.el (org-attach-dired-to-subtree): Renamed from
  `org-attach-dired-attach-to-next-best-subtree'.  Convenience
  functions have been dropped.

* testing/lisp/test-org-attach.el: Tests use
  `org-test-with-temp-text-in-file' now and are cleaner now.
2017-11-15 14:39:26 +01:00
Marco Wahl 615b147031 org-attach: Attach files specified in a dired buffer.
* lisp/org-attach.el (org-attach-attach-files): New.
(org-attach-dired-marked-files-in-dired): New
(org-attach-dired-marked-files-or-file-at-cursor-in-dired): New.
(org-attach-dired-attach-to-next-best-subtree): New command.
(org-attach-dired-attach-to-next-best-subtree-cp): New command.
(org-attach-dired-attach-to-next-best-subtree-mv): New command.
(org-attach-dired-attach-to-next-best-subtree-ln): New command.
(org-attach-dired-attach-to-next-best-subtree-lns): New command.
* testing/lisp/test-org-attach.el: Tests.
2017-11-15 11:25:51 +01:00
Nicolas Goaziou d07ee7f7f2 Implement :pre-blank property for items and footnotes definitions
* lisp/org-element.el (org-element-footnote-definition-parser):
(org-element-item-parser): Add `:pre-blank' property.
(org-element-footnote-definition-interpreter):
(org-element-item-interpreter):
(org-element-interpret-data):
* lisp/ox.el (org-export-data): Use new property.
* testing/lisp/test-org-element.el (test-org-element/footnote-definition-parser):
(test-org-element/item-parser): Add tests.
2017-11-10 00:38:31 +01:00
Eric Abrahamsen c04e357f3d Replace easy templates with org-insert-structure-template
* lisp/org.el (org-insert-structure-template): New function for
  wrapping region (or element at point) in a begin/end block.
  (org-structure-predefined-blocks): New option holding predefined
  blocks, for completion.
  (org-try-structure-completion,
  org-complete-expand-structure-template): Remove functions.
* doc/org.texi (Inserting structure templates): Document.
* testing/lisp/test-org.el (test-org/insert-template): New test.
2017-11-05 09:56:26 +01:00
Nicolas Goaziou 7ba058963e Merge branch 'maint' 2017-11-04 21:51:40 +01:00
Nicolas Goaziou 6186ed3a22 org-element: Fix item parser
* lisp/org-element.el (org-element--list-struct): Correctly handle end
  of sub-lists and end of last item.

* testing/lisp/test-org-element.el (test-org-element/item-parser):
(test-org-element/plain-list-parser): Add tests.
2017-11-04 21:50:11 +01:00
Nicolas Goaziou 6a273e30d7 Merge branch 'maint' 2017-11-03 22:20:46 +01:00
Xavier Martinez-Hidalgo f38a7d433b org-capture: Fix aborting after inserting text at end of buffer
* lisp/org-capture.el (org-capture-mark-kill-region): Set end marker
  insertion type so that it advances when inserting text at the end of
  the capture buffer.

* testing/lisp/test-org-capture.el (test-org-capture/insert-at-end-abort):
  Add test case.

Inserting text at the end of the capture buffer does not advance the
end kill marker.  This causes the narrowing region and the kill
markers to get out of sync, which prevents 'org-capture-finalize' from
correctly cleaning the target buffer when aborting the capture.

Setting the kill end marker insertion type fixes this.

TINYCHANGE
2017-11-03 22:20:11 +01:00
Nicolas Goaziou ee3a9e9a77 Fix failing test
* testing/lisp/test-ox-publish.el (test-org-publish/resolve-external-link):
  Rewrite test to prevent race condition which could affect results.
* testing/examples/pub/b.org: Add missing keyword.
2017-11-03 22:15:41 +01:00
Nicolas Goaziou 99dbca3d4f Remove `org-babel-use-quick-and-dirty-noweb-expansion'
* lisp/ob-core.el (org-babel-use-quick-and-dirty-noweb-expansion):
  Remove variable.
(org-babel-expand-noweb-references): Update function.

* doc/org.texi (noweb-ref): Document new behaviour.
(Noweb reference syntax): Delete reference to removed variable.

`org-babel-use-quick-and-dirty-noweb-expansion' main use is to speed
up Noweb expansion when expanding only by name.  By distinguishing
name and reference expansion, we no longer need this variable.  In the
first case, the expansion is quicker anyway, and in the second case,
we most certainly need an accurate expansion.
2017-10-26 13:09:23 +02:00
Nicolas Goaziou 1b9a66487a Move a test
* testing/lisp/test-org-macs.el (test-org/in-regexp): Moved from...
* testing/lisp/test-org.el: ... here.
2017-10-24 09:55:49 +02:00
Nicolas Goaziou 96c7fd7541 Merge branch 'maint' 2017-10-24 09:53:47 +02:00
Nicolas Goaziou 3aa4d44ba8 Fix comma escaping with multiple leading commas
* lisp/org-src.el (org-escape-code-in-region):
(org-escape-code-in-string):
(org-unescape-code-in-region):
(org-unescape-code-in-string): Fix comma escaping with multiple
leading commas.

* testing/lisp/test-org-src.el (test-org-src/escape-code-in-string):
(test-org-src/unescape-code-in-string): New tests.

Reported-by: Michal Politowski <mpol@meep.pl>
<http://lists.gnu.org/archive/html/emacs-orgmode/2017-10/msg00359.html>
2017-10-24 09:51:43 +02:00
Nicolas Goaziou bed03c4b42 Merge branch 'maint' 2017-10-22 12:42:35 +02:00
thibault 1613153aac Fix tangling of org block with nested source block
* lisp/ob-tangle.el (org-babel-tangle-single-block): Prevent double unescaping
of source block by removing unnecessary call to `org-unescape-code-in-string'.

* testing/lisp/test-ob-tangle.el (ob-tangle/nested-block) New function.
2017-10-22 12:42:05 +02:00
Nicolas Goaziou cd9cccb4b2 Merge branch 'maint' 2017-10-18 22:49:10 +02:00
Allen Li 8c5c030c64 Fix `org-insert-todo-heading'
* lisp/org.el (org-insert-todo-heading): Insert TODO keyword relative
  to the original headline, not to the headline above.

* testing/lisp/test-org.el (test-org/insert-todo-heading-respect-content):
  Add test.
2017-10-18 22:48:16 +02:00
Nicolas Goaziou b401d3a44b Implement `org-export-excluded-from-toc-p'
* lisp/ox.el (org-export-excluded-from-toc-p): New function.

* testing/lisp/test-ox.el (test-org-export/excluded-from-toc-p): New
  test.
2017-10-15 16:51:13 +02:00
Nicolas Goaziou 9b13e44ad7 ox: Implement "notoc" UNNUMBERED value
* lisp/ox.el (org-export-collect-headlines): Exclude headlines with
  UNNUMBERED property set to "notoc".

* doc/org.texi (Export settings):
(Table of contents): Document new value.

* testing/lisp/test-ox.el (test-org-export/collect-headlines): Add
  test.
2017-10-15 16:51:10 +02:00
Nicolas Goaziou 7df5d21f79 Merge branch 'maint' 2017-10-14 12:30:59 +02:00
Nicolas Goaziou 827af59873 Fix links without contents in table of contents' entries
* lisp/ox.el (org-export-toc-entry-backend): New function.

* lisp/ox-html.el (org-html--format-toc-headline):
* lisp/ox-md.el (org-md--build-toc):
* lisp/ox-odt.el (org-odt-toc): Use new function.

* lisp/ox-texinfo.el (org-texinfo--sanitize-title):
(org-texinfo--wrap-float): Handle links without contents.

* testing/lisp/test-ox.el (test-org-export/toc-entry-backend): New
  test.

Reported-by: ConcreteVitamin <concretevitamin@gmail.com>
<http://lists.gnu.org/archive/html/emacs-orgmode/2017-10/msg00235.html>
2017-10-14 12:29:52 +02:00
Nicolas Goaziou 2a55d206e3 Merge branch 'maint' 2017-10-08 10:54:00 +02:00
Georgiy Tugai 07f939f419 org-clock: Fix clock report sometimes ignoring hours before :wstart
* lisp/org-clock (org-clocktable-steps): Fix weekly-step clock report
  ignoring hours between start of period and start of week, when start
  of period is on a day of week numerically less than start of week.

  Clock report now always inserts a "week" starting at the start of
  the period, if necessary; all following weeks start on the start of
  the week as expected.

TINYCHANGE
2017-10-08 10:53:39 +02:00
Nicolas Goaziou fa56da61a7 Merge branch 'maint' 2017-10-08 10:36:48 +02:00
Nicolas Goaziou d747e51fbf Consider headlines as sentences by themselves
* lisp/org.el (org-forward-sentence): Consider headlines as sentences
  by themselves.

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

Reported-by: Mat Vibrys <vibrysec@gmail.com>
<http://lists.gnu.org/archive/html/emacs-orgmode/2017-10/msg00130.html>
2017-10-08 10:35:22 +02:00
Nicolas Goaziou 44e3745c78 Merge branch 'maint' 2017-10-06 19:35:25 +02:00
Nicolas Goaziou fb403ca34e Fix `org-backward-paragraph' on an empty heading
* lisp/org.el (org-backward-paragraph): Fix behavior on greater
  elements without contents.

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

Reported-by: Omar Antolin <omar.antolin@gmail.com>
<http://lists.gnu.org/archive/html/emacs-orgmode/2017-10/msg00099.html>
2017-10-06 19:34:28 +02:00
Nicolas Goaziou 1b12ad5cf6 Merge branch 'maint' 2017-10-04 12:58:41 +02:00
Nicolas Goaziou ef6dac812b Fix `org-backward-paragraph' on block opening line
* lisp/org.el (org-backward-paragraph): Do not error when called from
  a block opening line.
* testing/lisp/test-org.el (test-org/backward-paragraph): Add tests.

Reported-by: Omar Antolin <omar.antolin@gmail.com>
<http://lists.gnu.org/archive/html/emacs-orgmode/2017-10/msg00051.html>
2017-10-04 12:57:14 +02:00
Nicolas Goaziou 73df53f185 Merge branch 'maint' 2017-10-01 22:58:24 +02:00
Nicolas Goaziou fcdcfe682f Fix typo in comment
* testing/lisp/test-org.el (test-org/buffer-property-keys): Remove
  spurious word.
2017-10-01 22:56:57 +02:00
Nicolas Goaziou 428368af2f Merge branch 'maint' 2017-10-01 19:02:47 +02:00