Commit Graph

1691 Commits

Author SHA1 Message Date
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