Commit graph

24192 commits

Author SHA1 Message Date
Bastien bfb350777d etc/ORG-NEWS: Various enhancements 2021-05-15 15:44:43 +02:00
Juan Manuel Macías 89040fbf95 ox-latex.el: Support specific attributes for verse block
* lisp/ox-latex.el (org-latex-verse-block): Support verse-specific
attributes.

* doc/org-manual.org (Verse blocks in LaTeX export): New section.

Link: https://orgmode.org/list/874kfdn0k5.fsf@posteo.net/
2021-05-15 15:44:36 +02:00
Thomas S. Dye e0bc2b37fb lisp/ox-latex.el: Allow arbitrary float environments
* lisp/ox-latex.el (org-latex--inline-image)
(org-latex--decorate-table): Recognize arbitrary :float value.

* etc/ORG-NEWS: Announce new :float capability.

LaTeX users are able to define arbitrary float types.
This patch makes them accessible from Org mode.
2021-05-15 15:20:35 +02:00
Bastien 200f454714 Merge branch 'maint' 2021-05-15 15:06:16 +02:00
Ihor Radchenko 4da4b3aa66 Allow moving inlinetasks using org-metaup/down
* lisp/org.el (org-metaup, org-metadown): Use
`org-drag-elementbackward'/`org-drag-element-forward' to move
inlinetasks.
2021-05-15 15:06:01 +02:00
Bastien 34fc18040d lisp/org-agenda.el: Use "09:00" instead of " 9:00"
* lisp/org-agenda.el (org-get-time-of-day): Use "09:00" instead
of " 9:00" when displaying as a string.

This makes the string more readable, especially for users reading
the agenda with a screen reader.

Reported-by: Sébastien Hinderer
2021-05-15 15:01:55 +02:00
Bastien 65de88bebf Merge branch 'maint' 2021-05-15 14:45:31 +02:00
Kévin Le Gouguec 4764a2fbf9 Set org-adapt-indentation explicitly in some tests
* testing/lisp/test-org.el (test-org/indent-line)
(test-org/indent-region): Make sure `org-adapt-indentation' is
consistent with expected results.
2021-05-15 14:45:23 +02:00
Kévin Le Gouguec d85f4158e2 Set org-adapt-indentation explicitly in some tests
* testing/lisp/test-org.el (test-org/with-electric-indent)
(test-org/without-electric-indent): Make sure
`org-adapt-indentation' is consistent with expected results.
2021-05-15 14:45:21 +02:00
Ihor Radchenko b72b718ac6 Add a test for known bug in org-element-cache
* testing/lisp/test-org-element.el (test-org-element/cache-bugs): A
new test documenting a known bug:

1. Create initial file like:

P0

  P1
  | a | b |
<point>| c | d |

Note that second line of the table is not indented.  Now,
org-element-at-point returns table-row.

2. Modify the file to test org-element-cache

P0

- item

  P1
  | a | b |
<point>| c | d |

Now, the first (indented) row of the table belongs to item.  The
second row should be an individual table and org-element-at-point
returns table.
2021-05-15 14:34:37 +02:00
Bastien 937a0d8598 Merge branch 'maint' 2021-05-15 14:27:06 +02:00
Bastien ed5e28939b Fix code typo in 06c064e9 (take 2) 2021-05-15 14:26:56 +02:00
Bastien 405d82ed38 Merge branch 'maint' 2021-05-15 14:18:24 +02:00
Bastien 77213acb8f Fix code typo in 06c064e9 2021-05-15 14:17:38 +02:00
Adam Spiers 9e127a720c New command `org-refile-reverse' bound to C-c C-M-w
* lisp/org-refile.el (org-refile-reverse): New command.

* lisp/org-keys.el (org-mode-map): Bind C-c C-M-w to
`org-refile-reverse'.

* doc/org-manual.org (Refile and Copy): Document
`org-refile-reverse'.

* etc/ORG-NEWS (New command ~org-refile-reverse~ (=C-c C-M-w=)):
Announce the new command.

Link: https://orgmode.org/list/20200830001047.21362-1-orgmode@adamspiers.org/
2021-05-15 14:07:03 +02:00
Ihor Radchenko ba273278a5 Use cache in org-up-heading-safe
* lisp/org.el (org-up-heading-safe): Use buffer-local cache to store
positions of parent headings.  The cache is invalidated when buffer
text is changed, according to `buffer-chars-modified-tick'.
(org--up-heading-cache):  Buffer-local hash-table storing the cache.
(org--up-heading-cache-tick):  The buffer modification state for
currently active `org--up-heading-cache'.

The optimisation is critical when running agenda or org-entry-get
queries using property/tag inheritance.  In such scenarios
`org-up-heading-safe' can be called thousands of times.  For example,
building todo agenda on large number of headings lead to the following
benchmark results:

Benchmark:

1. (elp-instrument-function #'org-up-heading-safe)
2. Run agenda
3. (elp-results) ;; function, # calls, total time, avg time

Without cache:
org-up-heading-safe  27555       8.4234025759  0.0003056941

With cache, first run:
org-up-heading-safe  23227       0.5300747539  2.282...e-05

With cache, second run on unchanged buffer:
org-up-heading-safe  23227       0.1447754880  6.233...e-06

The final speedup is 1-2 orders of magnitude (~15-56 times).
2021-05-15 13:58:05 +02:00
Bastien 8b0b206b52 lisp/org.el: Use "[BUG]" instead of "Bug:" for bug reports
* lisp/org.el (org-submit-bug-report): Use "[BUG]" as the subject
prefix.
2021-05-15 13:55:12 +02:00
Bastien 402bd498ab Merge branch 'maint' 2021-05-15 13:51:15 +02:00
Ihor Radchenko 6ab5299e5b Fix test-org-element/cache "Preserve local structures when re-parenting."
* testing/lisp/test-org-element.el (test-org-element/cache): Add
spaces to make the "abcd" table a single table.  The old version uses
example org text with two tables and was passing because of another
bug in org-element-cache.  Testing the old version with
org-element-use-cache set to nil would yield error, while it should
not.
2021-05-15 13:51:02 +02:00
Bastien dc45e84a06 Merge branch 'maint' 2021-05-15 13:49:57 +02:00
Bastien 4ce78810ac lisp/org.el: Don't let RET indent in source code blocks
* lisp/org.el (org-return): Don't try to indent in source code
blocks.

Reported-by: Nathaniel W Griswold <nate@manicmind.earth>
Link: https://orgmode.org/list/5DCBAF63-0E88-44AC-B892-1260F37E7E00@manicmind.earth/
2021-05-15 13:48:40 +02:00
Bastien b923a23221 Merge branch 'maint' 2021-05-15 11:01:16 +02:00
Bastien d37e8a14b7 lisp/org.el: Fix indenting of planning line
* lisp/org.el (org-indent-line): Fix indenting of planning line.
2021-05-15 11:00:49 +02:00
Bastien e2cf4369d6 Merge branch 'maint' 2021-05-15 10:33:34 +02:00
Ihor Radchenko f313b81841 Improve org-link-plain-re
* lisp/ol.el (org-link-make-regexps): Allow URLs with up to two
levels of nested brackets.

* lisp/org.el (org-link-plain-re): Update docstring.

* testing/lisp/test-ol.el: Add tests for the plain link regular
expression.

(org-link-plain-re): Update docstring.  Now,

Now, URLs like [1] can be matched.  The new regexp is based on [2].
The docstring of `org-link-plain-re'  explicitly mentions that the
regexp must contain groups for the link type and the path.

[1] https://doi.org/10.1016/0160-791x(79)90023-x
[2] https://daringfireball.net/2010/07/improved_regex_for_matching_urls
2021-05-15 10:33:23 +02:00
Bastien b2c5028e5b lisp/org.el: Minor aesthetic clean-up 2021-05-15 10:25:40 +02:00
satotake d285831af3 org-refile.el: Fix the case of emtpy buffer name
* lisp/org-refile.el (org-refile-get-targets): Ensure that the
arguments of `file-name-nondirectory' and `file-truename' are not nil.

This prevents errors from being raised when calling `org-refile' in a
buffer that is not visiting a file.

TINYCHANGE
2021-05-15 10:19:19 +02:00
Bastien 5a1a1ebdeb Merge branch 'maint' 2021-05-15 10:13:07 +02:00
Samim Pezeshki 06c064e97c lisp/org-agenda.el: Fix bug in `org-agenda-highlight-todo'
* lisp/org-agenda.el (org-agenda-highlight-todo): Skip formatting
the to-do keyword when `org-agenda-todo-keyword-format' is the
empty string.

TINYCHANGE
2021-05-15 10:11:36 +02:00
Bastien f98e3ef65a lisp/ox-md.el: Mark some arguments as unused
* lisp/ox-md.el (org-md-latex-environment)
(org-md-latex-fragment): Mark some arguments as unused.
2021-05-15 10:02:09 +02:00
Bastien c6d4c9344c Merge branch 'maint' 2021-05-15 09:58:06 +02:00
Bastien 78e39d58d4 lisp/org-id.el: Small enhancements
* lisp/org-id.el (org-id-locations-load, org-id-add-location):
Update messages.
(org-id-hash-to-alist, org-id-paste-tracker, org-id-find-id-file):
Docstring minor enhancements.
(org-id-new): Tiny refactoring.
2021-05-15 09:57:45 +02:00
Bastien 8544f555ac lisp/org-inlinetask.el: Silent the byte-compiler
* lisp/org-inlinetask.el (org-inlinetask-promote)
(org-inlinetask-demote): Fix calls to `looking-back'.
2021-05-15 09:55:12 +02:00
Bastien 3581f3730f CONTRIBUTE: Small enhancements 2021-05-14 21:24:52 +02:00
Bastien 0e39bf839a Throw user errors when trying to drag inline tasks
* lisp/org.el (org-metaup, org-metadown): Throw a user error
explaining that dragging inline tasks is not supported.

* lisp/org-inlinetask.el (org-inlinetask-insert-task)
(org-inlinetask-promote, org-inlinetask-demote): Fix bug when
demoting/promoting inline tasks at the end of the buffer and
throw user errors instead of errors.

Based on an initial patch by Carsten.

Reported-by: Christian Hemminghaus <chrhemmi@gmail.com>
Link: https://orgmode.org/list/CAE47VC=yhObXs3jexLUkf53cNzcOWUkTMqpF8QK4Dcg98QijyQ@mail.gmail.com/
2021-05-14 21:24:52 +02:00
Bastien 34bbb03cca CONTRIBUTE: Small enhancements 2021-05-14 05:15:20 +02:00
Bastien cb8e50ed15 Merge branch 'maint' 2021-05-13 15:00:29 +02:00
Bastien 8b18405857 Throw user errors when trying to drag inline tasks
* lisp/org.el (org-metaup, org-metadown): Throw a user error
explaining that dragging inline tasks is not supported.

* lisp/org-inlinetask.el (org-inlinetask-insert-task)
(org-inlinetask-promote, org-inlinetask-demote): Fix bug when
demoting/promoting inline tasks at the end of the buffer and
throw user errors instead of errors.

Based on an initial patch by Carsten.

Reported-by: Christian Hemminghaus <chrhemmi@gmail.com>
Link: https://orgmode.org/list/CAE47VC=yhObXs3jexLUkf53cNzcOWUkTMqpF8QK4Dcg98QijyQ@mail.gmail.com/
2021-05-13 14:56:18 +02:00
Nicolas Goaziou dcb6013fb6 agenda: Fix org-duration-to-minutes error (take 2)
* lisp/org.el (org-stamp-time-of-day-regexp): Limit match group 2 to
first time.
* lisp/org-agenda.el (org-agenda-format-item): Compute duration before
formatting time with `org-get-time-of-day'.
2021-05-12 06:37:54 +02:00
Bastien 27621a5b03 Add Luc Pellissier as maintainer for two ob-* files
* lisp/ob-coq.el: Add a maintainer.

* lisp/ob-asymptote.el: Ditto.
2021-05-12 06:33:13 +02:00
Bastien 88fbe21a88 Add Luc Pellissier as maintainer for two ob-* files
* lisp/ob-coq.el: Add a maintainer.

* lisp/ob-asymptote.el: Ditto.
2021-05-12 06:30:22 +02:00
Nicolas Goaziou 8f03cd7290 Merge branch 'maint' 2021-05-11 09:40:46 +02:00
Nicolas Goaziou c26f8d2cc5 agenda: Fix org-duration-to-minutes error (take 2)
* lisp/org.el (org-stamp-time-of-day-regexp): Limit match group 2 to
first time.
* lisp/org-agenda.el (org-agenda-format-item): Compute duration before
formatting time with `org-get-time-of-day'.
2021-05-11 09:39:08 +02:00
Nicolas Goaziou 9a7207404c Merge branch 'maint' 2021-05-10 18:02:32 +02:00
Nicolas Goaziou 6107c2b15b Revert "agenda: Fix "org-duration-to-minutes: Invalid duration format" error"
This reverts commit bc857bfc62.

The "fix" breaks elsewhere, as reported below.

Reported-by: Daniel Ortmann <daniel.ortmann@oracle.com>
<http://lists.gnu.org/r/emacs-orgmode/2021-05/msg00592.html>
2021-05-10 18:00:58 +02:00
Timothy 981f25031d
ox-md: Use TeX-style $ math wrapping
* lisp/ox-md.el (org-md-latex-environment, org-md-latex-fragment):
These two new filters wrap LaTeX maths in $ / $$ TeX-style notation.
While ox-md endeavours to adhere to the original Markdown specification,
and not any particular variant, the original specification does not deal
with LaTeX fragments at all, and so this change does not reduce how
faithfully the original specification is followed.
There is a major upside to this though. Of the many Markdown variants
that have emerged, those that support LaTeX very often exclusively
support TeX style notation.  This change thus improves the utility of
the Markdown export for many use cases, and deviates no more from the
original specification that the current method.
2021-05-10 04:11:00 +08:00
Nicolas Goaziou 6f1ea80bbd Merge branch 'maint' 2021-05-09 21:51:17 +02:00
Nicolas Goaziou bc857bfc62 agenda: Fix "org-duration-to-minutes: Invalid duration format" error
* lisp/org-agenda.el (org-agenda-format-item): Compute duration with
`org-duration-to-minutes' before normalizing input.

Reported-by: Stephen Eglen <sje30@cam.ac.uk>
<http://lists.gnu.org/r/emacs-orgmode/2021-05/msg00584.html>
2021-05-09 21:49:23 +02:00
TEC 2ae308342a
org-plot: Fix calling at start of #+plot line
* lisp/org-plot.el (org-plot/gnuplot): When called with point at the
start of the #+plot: line, the behaviour of `org-table-begin' (called in
`org-table-to-lisp') caused no table to be detected.  To work around
this, when the point is at the zeroth column, it is temporarily shifted
one character to the right.
2021-05-09 23:49:46 +08:00
TEC 7dd667af67
org-plot: Use labels with 2d histogram plot
* lisp/org-plot.el (org-plot/preset-plot-types): When the :with
parameter is histograms, use text indices as the x-values.
2021-05-09 23:49:37 +08:00