Commit Graph

24029 Commits

Author SHA1 Message Date
Bastien 945c019176 lisp/org.el: Fix indentation when `org-adapt-indentation' is 'headline-data
* lisp/org.el (org--get-expected-indentation): Fix indentation of
non-headllines with `org-adapt-indentation' set to 'headline-data.
(org-indent-line): When `org-adapt-indentation' is 'headline-data,
don't indent when point is at the first line after a headline.
Update the docstring to make it explicit that indenting relatively
to current level only happens when `org-adapt-indentation' is set
to `t'.
2021-05-03 06:35:33 +02:00
Jeremie Juste 9014577df2 test-ob-R.el: add tests for how NA values are printed
* testing/lisp/test-ob-R.el (ert-deftest test-ob-r/NA-blank): new test
for :results value. Make sure that NA values in R data.frames are
empty string instead of nil previously

see https://orgmode.org/list/87pn1dufm2.fsf@gmail.com/
2021-05-03 00:29:09 +02:00
Jeremie Juste c0338142b7 test-ob-R.el: add tests for output with substrings matching prompt
* testing/lisp/test-ob-R.el (test-ob-r/output-with-<>): new test for output
  angle brackets
 (test-ob-R/output-nonprinted): New test for output results that aren't
explicitly printed.  (Here all the lines are expected to be printed
not just the last one)

Patch suggested by Jack Kamm:
https://orgmode.org/list/87h7slgbi5.fsf@gmail.com/
2021-05-03 00:18:33 +02:00
Jeremie Juste ac8c009e00 lisp/ob-R.el: Fix session output with substrings matching prompts
* lisp/ob-R.el (org-babel-R-evaluate-session): New implementation for session output
results, that concat "^" to comint-prompt-regexp to avoid prompt
confusion with R.

Patch suggested by Jack Kamm:
https://orgmode.org/list/87h7slgbi5.fsf@gmail.com/
2021-05-03 00:15:09 +02:00
Bastien 884a3454fc Merge branch 'maint' 2021-05-02 19:30:31 +02:00
Ihor Radchenko 4c76962814 lisp/org.el: Don't fontify headlines with "::" as description items
* lisp/org.el (org-set-font-lock-defaults): Avoid fontifying headlines
with "::" as description list items.

Lists can start with "*", but "*" must not be at the beginning of
line.  Old regexp did not require whitespace before "*" in description
list items.

Reported-by: Ypo <ypuntot@gmail.com>
Link: https://orgmode.org/list/5adcfcda-35de-8281-a1ff-18d1c95bbde6@gmail.com/
2021-05-02 19:29:23 +02:00
Nicholas Savage 562e325c75 lisp/org-colview.el: Update org-columns to respect global-visual-line-mode
* lisp/org-colview.el (org-columns): Prevent enabling `truncate-lines'
when `global-visual-line-mode' is enabled.

This fixes a bug where `org-columns' overlays were disabling wrapping
of lines when `global-visual-line-mode` was already activated, and so
therefore expectation was that the lines would continue wrapping.
This is because `org-columns' was setting truncate-lines to t, when
global-visual-line-mode requires it to be set to nil. The interaction
between the two caused the wrapping not to occur.
2021-05-02 19:21:44 +02:00
Nicholas Savage cb0ef12801 lisp/org-colview.el: Update org-columns to respect global-visual-line-mode
* lisp/org-colview.el (org-columns): Prevent enabling `truncate-lines'
when `global-visual-line-mode' is enabled.

This fixes a bug where `org-columns' overlays were disabling wrapping
of lines when `global-visual-line-mode` was already activated, and so
therefore expectation was that the lines would continue wrapping.
This is because `org-columns' was setting truncate-lines to t, when
global-visual-line-mode requires it to be set to nil. The interaction
between the two caused the wrapping not to occur.
2021-05-02 19:21:26 +02:00
Nicolas Goaziou 3e497bec35 Merge branch 'maint' 2021-05-02 17:51:15 +02:00
Nicolas Goaziou ab82d6ae25 ox-ascii: Fix title when 2 width char is used
* lisp/ox-ascii.el (org-ascii-template--document-title): Find width of
title with `string-width' instead of counting characters.

Fixes: #48148

Reported-by: Shingo Tanaka <shingo.fg8@gmail.com>
2021-05-02 17:48:47 +02:00
Bastien 379e22bfcc Merge branch 'maint' 2021-05-02 11:06:46 +02:00
Ihor Radchenko 0e7153e63d org-test: Fix wrong-numbre-of-arguments error on master+native-comp
* testing/org-test.el (org-test-at-time): Use correct number of
arguments in 'decode-time cl-letf binding. `decode-time' accepts up to
3 arguments on master.

The wrong-numbre-of-arguments error is raised on Emacs master
configured with native-comp support when running make test on Org mode
master.  Native-comp modifies function calls with optional arguments
in the way that omitted arguments are still provided as `nil'.  For
example, `decode-time' called as (decode-time time) in lisp source may
be compiled into (decode-time time nil nil) call by native-compiler.
If redefined `decode-time' does not accept 3 arguments, it result in
error.

See Emacs bug#48133.
2021-05-02 11:06:32 +02:00
Bastien c67413a7b6 Merge branch 'maint' 2021-05-02 08:50:18 +02:00
Bastien 5584ffc6c4 lisp/org.el (org--backward-paragraph-once): Handle corner case
* lisp/org.el (org--backward-paragraph-once): Don't throw an error
when at the first headline after a single empty line.
2021-05-02 08:49:53 +02:00
Bastien d3b6cdbf37 etc/ORG-NEWS: Use https instead of http when available 2021-05-02 07:59:07 +02:00
Bastien feacffe865 Merge branch 'maint' 2021-05-02 07:10:46 +02:00
Bastien 5021bada95 lisp/org.el: Fix bug when unfolding a subtree
* lisp/org.el (org-cycle-internal-local): Use 'tree instead of
'canonical when setting the visibility of the subtree to unfold.

Reported-by: Yasushi SHOJI <yasushi.shoji@gmail.com>
Link: https://orgmode.org/list/CAELBRWLakDCbawmMdS5Qi0qh5FC2ixF82xNfCg75wMjmze6pbA@mail.gmail.com/
2021-05-02 07:09:55 +02:00
Bastien c7824f9cf8 Merge branch 'maint' 2021-05-02 05:46:57 +02:00
Bastien eedbe286ef lisp/org-table.el: Fix bug with `org-table-wrap-region'
* lisp/org-table.el (org-table-copy-region): Only display a
message when called interactively.
(org-table-wrap-region): Prevent `org-table-cut-region' from
losing track of the region beginning.

Reported-by: Marko Schuetz-Schmuck <marko.schutz@upr.edu>
Link: https://orgmode.org/list/875z84fnwv.fsf@tpad-m.i-did-not-set--mail-host-address--so-tickle-me/
2021-05-02 05:44:46 +02:00
Sébastien Miquel a2cb9b853d ob-tangle.el: Improve tangling
* lisp/ob-tangle.el (org-babel-tangle-collect-blocks): Group
collected blocks by tangled file name.
(org-babel-tangle): Avoid quadratic behavior in number of blocks and
set modes before writing to file.
* testing/lisp/test-ob-tangle.el (ob-tangle/block-order): Update test.
2021-05-01 22:30:42 +02:00
Bastien f84033b088 Merge branch 'maint' 2021-05-01 22:26:06 +02:00
Bastien ccd513a3c5 lisp/org.el: Don't let `visual-line-mode' override Org's keybindings
* lisp/org.el (org-mode): Don't let `visual-line-mode' override
Org's keybindings for C-a, C-e and C-k.

Reported-by: Gustavo Barros <gusbrs.2016@gmail.com>
Link: https://orgmode.org/list/87a6zkv3m2.fsf@gmail.com/
2021-05-01 22:24:57 +02:00
Kyle Meyer 2d965df01a Merge branch 'maint' 2021-05-01 15:49:24 -04:00
Kyle Meyer 94837fc6b5 agenda: Fix org-agenda-show-new-time on Emacs 24
* lisp/org-agenda.el (org-agenda-show-new-time): Add fallback for when
window-font-width isn't available.

efbf96389 (org-agenda.el: Fix display of agenda new time, 2020-02-02)
reworked the column calculation to use window-font-width, but that
function isn't available until Emacs 25, and it's definition can't be
easily ported to org-compat.

Instead just use the old logic, which had been in place since v8.2.6,
when window-font-width isn't available.

Reported-by: Ihor Radchenko <yantar92@gmail.com>
Link: https://orgmode.org/list/87y2d2mqik.fsf@localhost
2021-05-01 15:48:11 -04:00
Kyle Meyer 8bd3bd093b ob-C: Adjust pcase pattern for Emacs 24 compatibility
* lisp/ob-C.el (org-babel-C-header-to-C): Switch pcase patterns to
"`X" rather than "'X", which isn't supported until Emacs 25.

These were introduced by 38f87a26b (ob-C.el: Fix a number a
regressions related to table parameters, 2021-04-29).

Reported-by: Ihor Radchenko <yantar92@gmail.com>
Link: https://orgmode.org/list/87y2d2mqik.fsf@localhost
2021-05-01 15:43:01 -04:00
Bastien Guerry 586eaeae8d Merge branch 'maint' 2021-05-01 18:45:27 +02:00
Ihor Radchenko 0a8079b4d7 Bypass read-only state in org-entry-put
* lisp/org.el (org-entry-put): Ignore read-only state of the buffer.

Fixes bug when ID property is not insered when creating ID in an
indirect read-only org-goto buffer. [1]

[1] https://orgmode.org/list/8ffe2da5-e2cb-f44c-0a46-b19873c0bdf2@gmx.de/
2021-05-01 18:45:15 +02:00
Bastien Guerry 6ceb4c1c89 Merge branch 'maint' 2021-05-01 18:40:26 +02:00
Bastien Guerry 842ab092ae lisp/org.el: Make `org-toggle-link-display' more consistent
* lisp/org.el (org-do-emphasis-faces): Don't hide with `org-link'
as the value for the invisible text property.

Before this commit, M-x org-toggle-link-display RET would also toggle
the emphasis markers.

Reported-by: Gustavo Barros <gusbrs.2016@gmail.com>
Link: https://orgmode.org/list/87o8jnzjao.fsf@gmail.com/
2021-05-01 18:38:31 +02:00
Bastien Guerry 6f72efd390 Merge branch 'maint' 2021-05-01 18:00:08 +02:00
Bastien Guerry fb30301888 lisp/org.el: Fix bug about inserting a heading before the first headline
* lisp/org.el (org-insert-heading): Fix bug when inserting a
heading before the first headline.

Reported-by: Gustavo Barros <gusbrs.2016@gmail.com>
Link: https://orgmode.org/list/875z73br32.fsf@gmail.com/
2021-05-01 17:59:20 +02:00
Gustavo Barros e8562a3327 date/time prompt: Provide support for HHhMM time input
* lisp/org.el (org-read-date-analyze): Add support for HHhMM time
input, in similar way as for am/pm times.
* doc/org-manual.org (The date/time prompt): Add example to illustrate
the feature.

TINYCHANGE
2021-05-01 17:40:17 +02:00
Alan D. Salewski a2403321ac etc/ORG-NEWS: Announce clocktable per-file time percentages (':formula %')
* etc/ORG-NEWS: New entry announcing clocktable calculation and
display of per-file time percentages, when ':formula %' is used.

TINYCHANGE

Signed-off-by: Alan D. Salewski <ads@salewski.email>
2021-05-01 16:55:43 +02:00
Ihor Radchenko c7de815c5a lisp/ob-gnuplot.el: Use `org-babel-local-file-name'
* lisp/ob-gnuplot.el (org-babel-gnuplot-process-vars): Use
`org-babel-local-file-name'.

TINYCHANGE
2021-05-01 16:32:56 +02:00
TEC c1a5f5c155
etc/ORG-NEWS: LaTeX env #+results now removed 2021-05-01 19:43:05 +08:00
Bastien Guerry 40c7ddb4ec etc/ORG-NEWS: Add a new :refile-targets template option
* etc/ORG-NEWS: Add a new :refile-targets template option.
2021-05-01 13:13:31 +02:00
Bastien Guerry 611e806ef9 doc/org-manual.org: Document the new property :refile-targets
* doc/org-manual.org (Template elements): Document the new
property :refile-targets.
2021-05-01 13:12:44 +02:00
Richard Garner 154e1f19a9 lisp/org-capture.el: Add a new :refile-targets template option
* lisp/org-capture.el (org-capture-templates): Add :refile-targets.
(org-capture-refile): Honor :refile-targets.

TINYCHANGE
2021-05-01 13:07:55 +02:00
TEC b90b850ae8 ob-core: Remove LaTeX environment #+results type
* lisp/ob-core.el (org-babel-result-end): Alloow the result to end
into a LaTeX environment.

By adding latex-enviroment to the possible results types, a much
richer experience is possible for backends that can produce
LaTeX-formatted maths as their results (for example: Calc, Julia with
Latexify, Python with SymPy, Octave with symbolic). This is superior
to a LaTeX export block as LaTeX environments can be (1) rendered
inline, and (2) better used in non-LaTeX export formats (e.g. HTML
with MathJax).  Without this, backends can output a LaTeX environment,
but new results will be added in front instead of replacing the
environment.
2021-05-01 13:03:09 +02:00
Bastien Guerry ab01161b2a Fix 7da20ff21 2021-05-01 12:50:10 +02:00
Bastien Guerry e080eb759a lisp/org-agenda.el: Small refactoring and docstring enhancement
* lisp/org-agenda.el (org-agenda-priority): Small refactoring
and docstring enhancement.

Link: https://orgmode.org/list/87o8j3360f.fsf@kyleam.com/
2021-05-01 12:41:46 +02:00
Bastien Guerry 4394eaf0e2 Merge branch 'maint' 2021-05-01 12:27:18 +02:00
Ivan Sokolov 45ca597f96 lisp/ob-sql.el: Prevent from getting stuck with an error
* lisp/ob-sql.el (org-babel-edit-prep:sql): Prevent from getting
stuck with an error.

TINYCHANGE
2021-05-01 12:26:38 +02:00
Bastien Guerry 67db2f5e46 etc/ORG-NEWS: Announce fontification support of inline export snippets 2021-05-01 12:01:23 +02:00
TEC eef9027cd2 org: Add font-lock rule for inline export snippets
* lisp/org.el (org-set-font-lock-defaults): Add font-lock rule for
inline export snippets.
2021-05-01 12:00:20 +02:00
Bastien Guerry 80a676c722 Revert "org: Add font-lock rule for inline export snippets"
This reverts commit 9af8d55f07.
2021-05-01 12:00:08 +02:00
TEC 9af8d55f07 org: Add font-lock rule for inline export snippets
* lisp/org.el (org-set-font-lock-defaults): Add font-lock rule for
inline export snippets.
2021-05-01 11:59:46 +02:00
Bastien Guerry c1f576a7e5 Merge branch 'maint' 2021-05-01 11:57:37 +02:00
TEC 400d2d9fd7 org-src: Use point instead of column for coords
* lisp/org-src.el (org-src--coordinates)
(org-src--goto-coordinates): Use point instead of column.

Using a column-based approach fails to account for invisible regions
or display overlays that change the number of columns: for example,
showing a LaTeX \alpha as α.  In src edits which involve such
structures, this causes the point to be shifted undesirably.  By using
a point-based approach this issue does not occur.
2021-05-01 11:57:27 +02:00
Alan D. Salewski 9aa9f3b1f7 org-clock.el: clocktable ':formula %' now includes per-file time pct
* lisp/org-clock.el (org-clocktable-write-default): When ':formula %'
  is in-effect, show the per-file time percentage in the '%' column.

TINYCHANGE

This change only has an effect when multiple files are contributing to
a given clocktable (such as when ':scope agenda' has been specified).
The existing behavior is that such tables have an extra 'File' column,
and each individual file that contributes has its own summary line
with the headline value '*File time*'.  Those summary rows also
produce a rollup time value for the file in the 'Time' column.

Prior to this change, the built-in '%' formula does not produce a
calculation for those per-file times in the '%' column (the relevant
cells in the '%' column were blank).  With this change, the percentage
contribution of each individual file time to the total time is shown.

The more agenda files you have, the more useful this behavior becomes.

Signed-off-by: Alan D. Salewski <ads@salewski.email>
2021-05-01 11:51:18 +02:00