Commit Graph

1886 Commits

Author SHA1 Message Date
Tom Gillespie 44d08f35cb testing/org-test.el: Ensure font-lock is set in temp text
* testing/org-test.el (org-test-with-temp-text): Ensure
font-lock is set.

TINYCHANGE
2020-02-12 09:37:04 +01:00
Nicolas Goaziou fa707c4cf1 Merge branch 'maint' 2020-02-11 19:11:37 +01:00
Nicolas Goaziou b4daf54591 test-ox: Fix comment.
* testing/lisp/test-ox.el (test-org-export/expand-include/links): Fix
comment.

This is a followup to 1af8c5a0df.
2020-02-11 19:11:11 +01:00
Nicolas Goaziou a70fff50d0 Merge branch 'maint' 2020-02-11 19:02:53 +01:00
Nicolas Goaziou 1af8c5a0df ox: Fix extra character deletion after link
* lisp/ox.el (org-export--update-included-link): Account
for :post-blank property when inserting back the link.
* testing/lisp/test-ox.el (test-org-export/expand-include/links): Add
test.

Fixes bug#39173.
2020-02-11 18:59:52 +01:00
Bastien 0d4e364635 Merge branch 'maint' 2020-02-11 10:43:36 +01:00
Bastien 749c08c263 testing/lisp/test-ob-lilypond.el: Delete test
The test does not work and prevented a bug to be detected.
2020-02-11 10:42:49 +01:00
Bastien 4fe4d12a79 Merge branch 'maint' 2020-02-07 20:44:31 +01:00
Bastien 5fc950a494 org-capture.el: Fix entry template insertion
* lisp/org-capture.el (org-capture-place-entry): Place point
correctly before narrowing the buffer.

* testing/lisp/test-org-capture.el (test-org-capture/entry):
Fix test.

Thanks to Bernt Hansen for reporting this.
2020-02-07 20:43:50 +01:00
Bastien 6ec3b993fd Merge branch 'maint' 2020-02-04 19:09:55 +01:00
Bastien 6671e41e40 testing/lisp/test-org-capture.el: Fix typo
* testing/lisp/test-org-capture.el (test-org-capture/entry):
Fix typo.
2020-02-04 18:42:14 +01:00
Jack Kamm cc89d5523f ob-python: Fix several issues with :session :results value
* lisp/ob-python.el (org-babel-python-evaluate-session): Fix a few
related issues with :session :results value blocks, including broken
if-else statements, indented blocks with blank lines, and returning
the wrong value when underscore has been used.
(org-babel-python--eval-ast): New constant variable, a string
consisting of Python code to execute a source block using ast.

Previously, python blocks with parameters ":session :results value"
were entered line-by-line into the Python session, which could cause
issues around indentation and new lines.  Now, such python blocks are
written to temp files, then the built-in ast python module is used to
parse and execute them, and to extract the last line separately to
return as a result.  Introduces a change in behavior, requiring that
the last line must be a top-level expression statement if its result
is to be saved (otherwise, the result is None).
2020-02-03 21:17:38 -08:00
Bastien 1de5e80adf Rename `org-x-priority' functions and variables to `org-priority-x'
* lisp/org.el (org-priority-enable-commands)
(org-priority-start-cycle-with-default)
(org-set-regexps-and-options, org-sort-entries, org-priority)
(org-get-priority, org-entry-properties)
(org-property-get-allowed-values, org-shiftup, org-shiftdown):
Rename `org-[x]-priority' functions and variables to
`org-priority-[x]'.

* lisp/org-pcomplete.el (org-priority-default)
(org-priority-highest)
(pcomplete/org-mode/file-option/priorities): Ditto.

* lisp/org-mouse.el (org-mouse-get-priority)
(org-mouse-priority-list): Ditto.

* lisp/org-agenda.el (org-agenda-fontify-priorities)
(org-agenda-format-item, org-agenda-priority): Ditto.

* lisp/ox-icalendar.el (org-icalendar--vtodo): Ditto.

* doc/org-manual.org (Priorities, Summary of In-Buffer Settings): Ditto.

* testing/lisp/test-org.el (test-org/set-regexps-and-options)
(test-org/entry-properties): Ditto.
2020-01-30 14:56:38 +01:00
Bastien 5c1b3e648c Revert "Fix test"
This reverts commit 4e322f25bc.
2020-01-27 23:43:14 +01:00
Marco Wahl 4e322f25bc Fix test
* testing/lisp/test-org-agenda.el (test-org-agenda/rescale): Remove
  the check against text-scale-mode.  This follows the current
  implementation.
2020-01-27 23:32:35 +01:00
Nicolas Goaziou 3999320aa4 Merge branch 'maint' 2020-01-11 20:18:47 +01:00
Nicolas Goaziou b1822760f4 Fix exporting visible parts of a buffer
* lisp/org-element.el (org-element--parse-elements): Only ignore parts
due to folding, not because of fontification.
* lisp/org-macs.el (org-invisible-p): Add an optional argument.
* testing/lisp/test-org-element.el (test-org-element/parse-buffer-visible):
Add tests.
2020-01-11 20:13:39 +01:00
Nicolas Goaziou 2fde90aa2e org-duration: Read and write duration in compact form
* lisp/org-duration.el (org-duration-format): Add `compact' symbol.
(org-duration-set-regexps): Make white space between duration parts
optional
(org-duration-from-minutes): Handle `compact' symbol.
* testing/lisp/test-org-duration.el (test-org-duration/from-minutes):
(test-org-duration/p): Add tests.
2020-01-04 18:39:05 +01:00
Kyle Meyer 93c11da002 Merge branch 'maint' 2020-01-01 13:39:26 -05:00
Kyle Meyer ff5fc050d3 Update copyright year to 2020 2020-01-01 13:38:46 -05:00
Kyle Meyer 90f0f24015 test-ob-clojure.el: Correct copyright year 2020-01-01 13:38:46 -05:00
Marco Wahl c637195e45 Merge branch 'maint' 2019-12-31 13:58:26 +01:00
Marco Wahl 524ccf3adb org: Fix: keep archived subtrees hidden after C-c C-k
* lisp/org.el (org-kill-note-or-show-branches): Hide archived
subtrees.

Report by Allen Li
https://lists.gnu.org/archive/html/emacs-orgmode/2019-12/msg00396.html
2019-12-31 13:55:12 +01:00
Nicolas Goaziou 2eeafcaf34 Merge branch 'maint' 2019-12-22 14:58:14 +01:00
Nicolas Goaziou 546cbad531 Link syntax require to escape every square bracket
* lisp/ol.el (org-link-make-regexps): Update regexp to forbid any
un-escaped square bracket in the URI.
(org-link-escape):
(org-link-unescape):
* testing/lisp/test-ol.el (test-ol/escape):
(test-ol/unescape):
(test-ol/store-link):
* testing/lisp/test-org.el (test-org/custom-id):
(test-org/fuzzy-links):
* testing/lisp/test-ox.el (test-org-export/resolve-fuzzy-link): Adapt
to new syntax.
* doc/org-manual.org (Link Format): Update documentation.

The new syntax allowed un-escaped opening square brackets in the URI
part of bracket links. Unfortunately, it led to bug as described here:

  <https://lists.gnu.org/archive/html/emacs-orgmode/2019-12/msg00312.html>

Now, we require to escape every square bracket in the URI.
2019-12-22 14:52:53 +01:00
Nicolas Goaziou d2c5c5622c ob-python: Slightly refactor tests
* testing/lisp/test-ob-python.el (test-ob-python/colnames-yes-header-argument):
(test-ob-python/colnames-yes-header-argument-again):
(test-ob-python/colnames-nil-header-argument):
(test-ob-python/colnames-no-header-argument-again):
(test-ob-python/colnames-no-header-argument):
(test-ob-python/session-multiline):
(test-ob-python/insert-necessary-blank-line-when-sending-code-to-interpreter):
Slightly refactor tests.
2019-12-22 14:51:57 +01:00
Nicolas Goaziou 72708b33e3 org-clock: Fix tests
* testing/lisp/test-org-clock.el (test-org-clock/clocktable/link): Fix
tests.
2019-12-22 14:51:31 +01:00
Nicolas Goaziou ee2a8eb241 org-element: Forbid affiliated keywords for comments
* lisp/org-element.el (org-element--current-element): Forbid
affiliated keywords for comments.
* testing/lisp/test-org-element.el (test-org-element/comment-parser):
Tiny refactoring.

The motivation is to avoid distinguishing between top-level comments,
which cannot have affiliated keywords, and other comments, which
could.  Therefore, we keep a single type of comment.
2019-12-15 14:06:20 +01:00
Nicolas Goaziou af99544286 org-element: Fix top-level property-drawer parsing
* lisp/org-element.el (org-element-comment-parser): Top level comments
do not have affiliated keywords.
(org-element--current-element): Properly parse top-level comments and
top-level properties drawer.
(org-element--next-mode): Change signature.
(org-element--parse-elements): Apply signature change.
(org-element--parse-to): Apply signature change.  Look for top-level
comments or properties drawer.
* testing/lisp/test-org-element.el (test-org-element/property-drawer-parser):
Add comment.

Initially, `org-element--current-element' would defer to
`org-get-property-block' to validate a property-drawer, which is the
wrong way to look at the low-level Org Element library. Also, it would
allow affiliated keywords, which is not possible.
2019-12-15 13:34:30 +01:00
Jason Dunsmore a410413be8 org-capture: Add support for month trees
* doc/org-manual.org: Add `:tree-type month' option for capture
  templates.
* lisp/org-capture.el (org-capture-set-target-location): Add
  `:tree-type month' option to capture templates to group entries by
  month.
* lisp/org-datetree.el (org-datetree-find-month-create): Add
  `org-datetree-find-month-create' function to add datetree entries
  grouped by month.
* testing/lisp/test-org-datetree.el
  (test-org-datetree/find-month-create): Add test for new function.
2019-12-09 20:08:28 +01:00
Marco Wahl 8ded89cc38 Merge branch 'master' into next 2019-11-26 22:45:10 +01:00
Nicolas Goaziou 3d4365ba03 org-clock: Fix locale issues in tests
* testing/lisp/test-org-clock.el (test-org-clock/clocktable/step):
(test-org-clock/clocktable/extend-today-until): Fix tests failing due
to translation mismatch.
2019-11-24 17:27:53 +01:00
Sebastian Miele 787fa238a9 Add tests about omission of commented src blocks when e.g. tangling
* testing/lisp/test-ob.el (test-ob/noweb-expansion): Add clause to
test.
* testing/lisp/test-ob-tangle.el (ob-tangle/commented-src-blocks): Add
test.
2019-11-24 10:27:35 +01:00
Kyle Meyer a4fa04bbd4 Merge branch 'master' into next 2019-11-16 17:19:11 -05:00
Jonas Bernoulli 5117d8a159 Fix typos 2019-11-16 17:17:36 -05:00
Gustav Wikström 00646ad817 Fix newline-issue with document property drawer
A bug was squashed where newlines after insertion of document property
drawers wasn't handled correctly.

* testing/lisp/test-org.el (test-org/insert-property-drawer):
Add test to verify that the document property drawer is
inserted above keyword lines.  Also fix the specification for
document property drawer so it doesn't remove existing blank
rows if inserted at the top of a buffer.

* lisp/org.el (org-insert-property-drawer): Make sure to add
newline after document property drawers.
2019-10-31 23:56:03 +01:00
Gustav Wikström 1bdff9f73d Org document property-drawers
Add functionality to define property-blocks on document level, in
addition to at headline level.

* doc/org-manual.org:
* etc/ORG-NEWS: Document new functionality.

* lisp/org.el (org-keyword-regexp): Define constant instead of
  hardcoding.
(org-file-properties): Renamed, see next line.
(org-keyword-properties): Renamed from above.  Due to the fact that
  properties can be defined for the whole document using property
  drawers this local variable needs a rename to make its name less
  ambigous.
(org-refresh-properties, org-refresh-property, org-entry-properties)
(org-refresh-category-properties, org-get-property-block)
(org-entry-get-with-inheritance, org-entry-put)
(org-insert-property-drawer, org-end-of-subtree): Made to work before
  first headline.
(org-at-property-block-p): New function to validate if point is at the
start of a property block.
(org-property-global-value): Renamed, see next line.
(org-property-global-or-keyword-value): Renamed from above to match
  its functionality better.
(org-back-to-heading-or-point-min): New function to make a document
  work as a level 0 node in the outline.
(org-at-keyword-p): Predicate function to answer to if we're currently
at a keyword line or not.
(org-up-heading-or-point-min): New function to make a document work as
a level 0 node in the outline.

* lisp/org-element.el (org-element--current-element): Can now detect
  property-blocks before first headline according to it's positional
  rules.

* lisp/org-attach.el (org-attach): Make it possible to call the
  attachment dispatcher also before the first headline, since document
  property drawers make attachments possible for the whole document
  now.

* lisp/org-capture.el: Modified only due to rename of function in
  org.el.

* lisp/org-compat.el (org-file-properties)
(org-property-global-value): Renamed functions declared obsolete.

* testing/lisp/test-org.el (org/insert-property-drawer)
(org/set-property, org/delete-property, org/delete-property-globally):
  Additions of tests to check if they work before first headline.
(org/at-property-p, org/at-property-block-p, org/get-property-block)
(org/entry-get, org/refresh-properties): New tests

* testing/examples/property-inheritance.org: Switch from
  property-keywords to a property-drawer in the testfile.
  Functionality should be the same, but now using a document drawer
  instead of property-keywords.

  Reason for switching is that I'd like us to slowly depricate
  property-keywords.

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

* contrib/lisp/ox-taskjuggler.el: A comment is modified only due to
  rename of function in org.el.
2019-10-19 14:07:58 +02:00
Gustav Wikström 930a1bcfc5 Fix problems with org-attach-git, failed tests
Ref. mail "[O] git-annex-related org-attach tests failing on
master"
https://lists.gnu.org/archive/html/emacs-orgmode/2019-09/msg00030.html
* lisp/org-attach-git.el (org-attach-git-commit): Add optional
argument to function contract to make it work with
`org-attach-after-change-hook'.  Even though that argument is
not used in the actual code (due to legacy functionality).

* testing/lisp/test-org-attach.el
(test-org-attach/dired-attach-to-next-best-subtree/1)
(test-org-attach/dired-attach-to-next-best-subtree/2):
Modify tests to also work if user has git-annex installed

* testing/lisp/test-org-attach-git.el
(test-org-attach-git/use-annex): Correct errors from previous
commit, where git-annex was refactored out from org-attach
into it's separate module.
2019-09-08 14:43:46 +02:00
Michaël Cadilhac 5cb360c7d0 Add test for the hidefiles parameter in clocktables.
* testing/lisp/test-org-clock.el (test-org-clock/clocktable/hidefiles):
Add test.
2019-09-05 18:56:32 +02:00
Gustav Wikström 4b7eda1a2f org-attach, test-org-attach: Restore fs check in org-attach-dir
In commit ae9cd4370 the filsystem check for org-attach-dir was
removed.  Adding it back here, together with an optional flag to
override the check.

To satisfy compatabilty issues with org-brain. Ref. thread here:
- https://github.com/Kungsgeten/org-brain/pull/203
2019-09-02 23:15:13 +02:00
Nicolas Goaziou 4848b8b9aa ob: Preserve comma escaping when inserting results
* lisp/ob-core.el (org-babel-insert-result): Fix typo
* testing/lisp/test-ob.el (test-ob/preserve-comma-escape): New test.

Reported-by: "Berry, Charles" <ccberry@ucsd.edu>
<http://lists.gnu.org/r/emacs-orgmode/2019-08/msg00250.html>
2019-08-22 10:03:56 +02:00
Nicolas Goaziou e48fac5231 Fix failing tests
* testing/lisp/test-org.el (test-org/timestamp-from-string):
(test-org/timestamp-from-time): Fix failing tests due to wrong locale.
2019-08-20 14:21:21 +02:00
Nicolas Goaziou 1ff9cab0a3 Merge branch 'maint' 2019-07-09 12:43:29 +02:00
Nicolas Goaziou 63e851ddbd ox: Add test
* testing/lisp/test-ox.el (test-org-export/uninterpreted): Add test.
2019-07-09 12:42:49 +02:00
Nicolas Goaziou 24daf224c0 Fix test
* testing/lisp/test-org-table.el (test-org-table/copy-down): Fix test.
2019-07-09 12:03:32 +02:00
Gustav Wikström ae9cd4370b org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el

Changed the way attachments deal with property-inheritance.  It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.

Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).

Added attachment link type with the prefix "attachment:".

Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function

Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook

A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes.  This works for both ID and DIR properties.  The goal is to
make the functionality for attachment links mirror the functionality
for file links.

* lisp/org-attach-git.el

New file, existing functionality.  Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately.  It extends org-attach by use of its
hooks.

Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.

Naming of both functions and tests has been modified to match the move
of functionality into its own module.

* lisp/org.el

Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.

Make org-open-at-point respect ARG when opening attachment-dir.

* lisp/org-compat.el

org-attach-directory has been deprecated in favour for
org-attach-id-dir.  The new name matches its purpose better.

* lisp/ox-html.el

Export attachment links to images as inline images, in the same way as
file links work today.

* etc/ORG-NEWS

Mention the changes in this patch.

* doc/org-manual.org

The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
  existing data around.

- "Capture, Attachments, RSS Feeds and Protocols" for information
  related to working with external data.

The attachment-part has been rewritten and extended to match the
changes in this patch.

The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.

Documentation related to external links has been improved.

* testing/lisp/test-org-attach-annex.el

Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.

* testing/lisp/test-org-attach.el

Add tests for org-attach.

* testing/org-test.el

Define a symbol for a file to test attachments with.

* testing/examples/*

A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2019-07-07 19:55:49 +02:00
Gustav Wikström 3cbe356b0a org-test, test-org-element, test-org, test-ox, test-property-inheritance
* org-test.el:

Fix org-test-with-temp-text-in-file.  Make it work with <point>, as
some tests already expect it to do!  Also make it fail more gracefully
by still removing temporary buffers and files.

Improve org-test-in-example-file.  Make it behave similar to
org-test-with-temp-text and org-test-with-temp-text-in-file, in that
it will return the last evaluated expression.

* testing/lisp/test-org-element.el

Fix a temp-text strings so that it doesn't have an initial newline.

* testing/lisp/test-org.el

Minor cleanup to align code-structure with other tests.  Nothing
changes in the test execpt style.

* testing/lisp/test-ox.el

Fix a couple of temp-text strings so that they don't have initial
newlines.

** test-org-export/expand-include

Test specification was wrong, due to org-test-with-temp-text-in-file
not previously working with <point>.  Since that is fixed in this
patch the test needed to be updated to match the expected outcome.

* testing/lisp/test-property-inheritance.el

Fix wrong file-header and file-ending.
2019-07-07 19:42:50 +02:00
Nicolas Goaziou 0201d1c0cc Fix inserting capture templates at point
* lisp/org-capture.el (org-capture):
(org-capture-set-target-location):
(org-capture-place-entry):
(org-capture-place-item):
(org-capture-place-table-line): Fix inserting capture templates at
point.  Insert a new internal property for capture
template: :insert-here.
(org-capture-insert-template-here): Remove function.

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

Reported-by: Dominic Surano <sk8ingdom@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2019-07/msg00002.html>
2019-07-06 16:02:37 +02:00
Nicolas Goaziou 9ddfe45314 org-table: Improve `org-table-copy-down'
* lisp/org-table.el (org-table--increment-field): New function.
(org-table-copy-down): Use new function.
* testing/lisp/test-org-table.el (test-org-table/copy-down): New test.
* doc/org-manual.org (Calculations): Update documentation.
2019-06-28 00:07:25 +02:00
Nicolas Goaziou bba9116cb8 org-element: Parse affiliated keywords according to granularity
* lisp/org-element.el (org-element--current-element): Parse affiliated
  keywords according to granularity.
* lisp/ox.el (org-export-get-caption): Refactor code.
* testing/lisp/test-org-element.el (test-org-element/affiliated-keywords-parser):
  Add tests.

Reported-by: ihor <ihor@antonovs.family>
<http://lists.gnu.org/r/emacs-orgmode/2019-06/msg00023.html>
2019-06-09 00:51:53 +02:00