* lisp/ol-bibtex.el: :doi and :url entries added to optional list of
entries to export to BiBTeX when present in the properties.
* etc/ORG-NEWS: added news item noting this change.
* lisp/ob-tangle.el (org-babel-effective-tangled-filename): Check for
the "no" parameter in this function to avoid erroneous tangling of a
single block (e.g. with C-u C-c C-v t) even with the parameter
:tangle no
TINYCHANGE
Fixes: `org-mode-map` binds `<tab>` which is unnecessary and harmful,
since it takes precendence over bindings of TAB even in keymaps with
higher precedence.
Reported-by: Daniel Mendler <mail@daniel-mendler.de>
* lisp/org.el (org-follow-timestamp-link): Do not set global agenda name.
The tmp value for the agenda buffer name is used in `org-agenda-list'
to set `org-agenda-buffer-name'. Wrap the call in a let-binding for
this symbol (like the agenda dispatcher does), since otherwise it
inadvertently sets the global value.
* lisp/org-keys.el (org-speed-commands): Use the right argument to
call the "goto variant" of org-refile with non-confusing user promt
for speed key "g".
* lisp/org-compat.el (org--setup-calendar-bindings): Fix logic
in test of 'org-agenda-diary-file' (bug#48199).
Prevent Org mode from mistakenly changing Calendar keymap
19f2f2699499d87186c6f580e4ec79205d59c096
Stephen Berman
Fri Jun 25 11:11:43 2021 +0200
* lisp/org-clock.el (org-clock-out): Possibly create a note at the
very end of the process, when there's no need for point to be on the
correct headline. Also call `org-clock-remove-empty-clock-drawer'
unconditionally instead of putting it in `org-clock-out-hook'.
Reported-by: Dave Dai <wenlong.dai@gmail.com>
<https://yhetil.org/orgmode/87pmwaang6.fsf@HUE.i-did-not-set--mail-host-address--so-tickle-me/»
* lisp/org-src.el (org-edit-src-save):
(org-edit-src-exit): Use `replace-buffer-contents' only for emacs >=
27.
It was introduced in emacs 26.1, but earlier versions made no
guarantees of correctness.
* lisp/org-agenda.el (org-agenda-format-item): Call
`org-get-time-of-day' twice. Once to get proper time information, and
a second time to format it.
(org-get-time-of-day): Remove an optional argument. Extend the one
left, and document it. Rewrite function.
Reported-by: Eric S Fraga <e.fraga@ucl.ac.uk>
<https://orgmode.org/list/87lf84408r.fsf@ucl.ac.uk/>
* lisp/ox-latex.el (org-latex-reference-command): Create a new variable
so the user may modify the reference command used.
(org-latex-link): Make use of the new `org-latex-reference-command' when
generating references for labels without a description (previously using
\ref).
(org-latex-prefer-user-labels): Mention the new
`org-latex-reference-command' when describing the generated LaTeX
referencing labels.
lisp/ox-latex.el (org-latex--make-option-string): If `value' of
a `pair' from `options' contains a bracket the whole `value' is
surrounded by braces.
In case of LaTeX export using listings the dialect of
a language (e.g. [LaTeX]TeX) is surrounded by brackets. For inline
source blocks all options end as optional argument to \lstinline
between brackets which breaks the LaTeX parser.
TINYCHANGE
* org-refile.el (org-refile-get-location): When we generate the `tbl'
variable, we add extra slash depending on the value of
`org-refile-use-outline-path'. This patch updates some locations which
add another extra slash assuming the target did not have it.
`org-refile--get-location' does lookup for entries with and without
slash, so it was not causing any issues before. It works as it is now
as well.
Thanks to Gustavo Barros for a very detailed bug report.
TINYCHANGE
* lisp/org-plot.el (org-plot/gnuplot): Table information is obtained
using (org-plot/goto-nearest-table), however it was not used when
fetching data from the table. It is more sensible to use the same
method. This also now allows a #+plot statement to be placed before
a #+RESULTS line and a table.
* lisp/org-timer.el (org-timer--run-countdown-timer): Use closures.
lisp/org/org-timer.el (org-timer--run-countdown-timer): Use closures
09ed51b9c89390059ccae30c0ae5dc39bc20523b
Stefan Monnier
Tue May 18 19:54:38 2021 -0400
[km: This was independently applied to master with 1a5a326f1.]
* lisp/org-mouse.el: Make use of lexical scoping.
(org-mouse-todo-menu): Simplify by eta-reduction.
(org-mouse-popup-global-menu): Remove redundant `eval`.
(org-mouse-keyword-menu, org-mouse-keyword-replace-menu)
(org-mouse-tag-menu, org-mouse-match-closure): Use proper closures.
lisp/org/org-mouse.el: Make use of lexical scoping
5746fd57ab7c9d27bcc6220f2b9faaba2982deba
Stefan Monnier
Tue May 18 19:51:26 2021 -0400
* lisp/org-colview.el (org-columns-map): Use proper closures
(org-columns-map): Use derived-mode-p.
lisp/org/org-colview.el (org-columns-map): Use proper closures
4e240bf09678a41055e46fb16a798541d58d372e
Stefan Monnier
Tue May 18 19:36:54 2021 -0400
[km: This was independently applied to master in 71c40314f.]
* lisp/org-clock.el (org-clock-get-table-data): Use proper closures.
lisp/org/org-clock.el (org-clock-get-table-data): Use proper closures
af68b49565671821361d089ae9a68af32d760e2c
Stefan Monnier
Tue May 18 19:32:35 2021 -0400
[km: This was independently applied to master in 038aff34d.]
Adds functionality to ob-comint.el to implement async session eval on
a per-language basis. Adds a reference implementation for ob-python.
* lisp/ob-comint.el (org-babel-comint-with-output): Remove comment.
(org-babel-comint-async-indicator, org-babel-comint-async-buffers,
org-babel-comint-async-file-callback,
org-babel-comint-async-chunk-callback,
org-babel-comint-async-dangling): Add buffer-local variables used for
async comint evaluation.
(org-babel-comint-use-async): Add function to determine whether block
should be evaluated asynchronously.
(org-babel-comint-async-filter): Add filter function to attach to
comint-output-filter-functions for babel async eval.
(org-babel-comint-async-register): Add function to setup buffer
variables and hooks for session eval.
(org-babel-comint-async-delete-dangling-and-eval): Add helper function
for async session eval.
* lisp/ob-python.el (org-babel-execute:python): Check for async header
argument.
(org-babel-python-evaluate): Check whether to use async evaluation.
(org-babel-python-async-indicator): Add constant for indicating the
start/end of async evaluations.
(org-babel-python-async-evaluate-session): Add function for Python
async eval.
*
testing/lisp/test-ob-python.el (test-ob-python/async-simple-session-output):
Unit test for Python async session eval.
(test-ob-python/async-named-output): Unit test that Python async eval
can replace named output.
(test-ob-python/async-output-drawer): Unit test that Python async eval
works with drawer results.
* lisp/org-macs.el (org-url-p): New function.
* lisp/org-compat.el (org-file-url-p): Make obsolete alias for
function above.
* lisp/org-lint.el (org-lint-non-existent-setupfile-parameter):
* lisp/org.el (org--collect-keywords-1):
(org-file-contents):
(org-edit-special): Use new function.
* lisp/org.el (org-log-setup): New variable.
(org-auto-repeat-maybe): Check against `org-log-setup' if we are
currently logging.
(org-add-log-setup): Only use `post-command-hook' when logging a
note, otherwise use `org-log-setup'.
(org-add-log-note): Reset `org-log-setup' to nil.
(org-store-log-note): Remove useless code.
* lisp/org-agenda.el (org-agenda-bulk-action): Check
`org-log-setup' instead of `post-command-hook'.
This is a more correct fix that supersedes the previous attempt with
08a47b09 for the same problem.
Reported-by: Warren Lynn <wrn.lynn@gmail.com>
Link: https://orgmode.org/list/87v98a8mes.fsf@gnu.org/
* lisp/org.el (org-update-statistics-cookies): Replace
usage of `org-map-entries' with `org-map-region' to prevent bug where
an error was thrown if the current buffer had not yet been saved to disk.
Formatted from a patch proposal by mail@kisaragi-hiu.com
Reported-by: mail@kisaragi-hiu.com
* lisp/org-src.el (org-src--contents-for-write-back): Shorten the
first line of the docstring.
(org-edit-src-exit): Conditionnally kill the write-back buffer.
* lisp/org-src.el (org-src--contents-for-write-back): Use a write
back buffer.
* lisp/org-src.el (org-edit-src-exit, org-edit-src-save): Use
`replace-buffer-contents'.
Reported-by: "Sébastien Miquel" <sebastien.miquel@posteo.eu>
Link: https://orgmode.org/list/603f9c4e-c621-7592-5b20-a7354c11d5d2@posteo.eu/
* lisp/org-element.el (org-element-drawer-parser): A single ":END:"
line should not be recognized as a drawer.
* testing/lisp/test-org-element.el (test-org-element/drawer-parser):
Add test.
Reported-by: Ihor Radchenko <yantar92@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2021-05/msg00819.html>
* org-agenda.el (org-agenda-show-clocking-issues): Fix regex
to prevent false-positive clocking issue detection.
Regex was missing a grouping to restrict the alternative \| to the
literal parentheses.
TINYCHANGE
* lisp/org-attach-git.el (org-attach-git-dir): New option to allow
using the attachment directory of the current node as a Git
repository, if correctly initialized.
(org-attach-git-use-annex, org-attach-git-annex-get-maybe)
(org-attach-git-commit): Use the new option.
* etc/ORG-NEWS: Announce the new option.
Link: https://orgmode.org/list/87y2g8rj7s.fsf@posteo.net/
* 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.
* 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
* 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).
* 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
* 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
* 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
* 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
* 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
* 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
* 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/
* 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/
* 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'.
* 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'.
* 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.
* 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.
* ol-w3m.el (org-w3m-copy-for-org-mode)
(org-w3m-get-next-link-start, org-w3m-get-prev-link-start):
Account for w3m-img links.
(org-w3m-get-anchor-start, org-w3m-get-prev-link-start)
(org-w3m-no-prev-link-p): Unused function notes.
(org-w3m-get-image-end): New function, for w3m-img links.
Related to Emacs bug #47088.
* lisp/org.el (org-insert-heading): When inserting a headline
before the first one, insert a blank line after the inserted
heading if the previous call to `org--blank-before-heading-p'
returned `t'.
Reported-by: Gustavo Barros <gusbrs.2016@gmail.com>
Link: https://orgmode.org/list/87y2cxoybz.fsf@gmail.com/
lisp/ob-tangle.el (org-babel-tangle-single-block): Fix the result when
`only-this-block' is `t' to match what is expected by
`org-babel-tangle'.
(org-babel-effective-tangled-filename): Extract the
computation of filename of tangled src block.
(org-babel-tangle-collect-blocks): Use `org-babel-effective-tangled-filename'.
* lisp/ob-core.el (org-babel-edit-distance): Rename function
`org-string-distance' and move it to "org-compat.el".
(org-babel-check-src-block): Use `org-string-distance' instead.
* lisp/org-compat.el: Add `org-string-distance' for a future
deprecation in favor of `string-distance'.
* lisp/org-agenda.el (org-agenda-later): Prevent window from
scrolling to the point when `scroll-conservatively' is > 101.
Reported-by: Gustavo Barros <gusbrs.2016@gmail.com>
Link: https://orgmode.org/list/87lfh2hk4k.fsf@gmail.com/
* lisp/org-agenda.el (org-agenda-later): Prevent window from
scrolling to the point when `scroll-conservatively' is > 101.
Reported-by: Gustavo Barros <gusbrs.2016@gmail.com>
Link: https://orgmode.org/list/87lfh2hk4k.fsf@gmail.com/
* lisp/ox.el (org-export-to-file): Don't load the major mode.
Prior to this, when `org-export-to-file' was called it activated the
major mode for that file type based on `auto-mode-alist'. This can be
mildly annoying in various ways as loading the major mode (1) makes
the export take longer, (2) can produce unwanted "noise" while
initialising, namely warnings and errors related to the mode itself,
(3) can produce spurious files like an .auctex-auto folder. By
locally binding `auto-mode-alist' to nil, all of these undesirable
behaviours can be avoided.
Link: https://orgmode.org/list/87lfa3fips.fsf@gmail.com/
* etc/ORG-NEWS: Announce `org-speed-commands'.
* doc/org-manual.org (Speed Keys): Document `org-speed-commands'
instead of `org-speed-commands-user'.
* lisp/org-compat.el (org-speed-commands-user): Make an obsolete
variable.
* lisp/org-keys.el (org-speed-commands-user): Remove.
(org-speed-commands): Rename from `org-speed-commands-default' and
make a defcustom. Add the docstring of `org-speed-commands-user'.
(org-speed-command-help): Throw a message about obsolete option
`org-speed-commands-user' when set in the user configuration.
(org-speed-command-activate): Update docstring.
Link: https://orgmode.org/list/87eeep3c1u.fsf@bzg.fr/
* lisp/org.el (org-indent-line): Fixes indentation.
(org--get-expected-indentation): Don't handle the 'headline-data
value for `org-adapt-indentation' here, it is taken care upstream
in `org-indent-line'.
* lisp/org-colview.el (org-columns): Replace call to `org-map-entries'
to build cache with `org-scan-tags'.
Simplifies `org-columns' to call `org-scan-tags' instead of
`org-map-entries'. This is to fix a bug where an unexpected non-existent
agenda file error was thrown if the buffer that `org-columns' was called
on was not yet saved to disk. This also simplifies `org-columns' and
prevents unnecessary agenda preparation functions from running.
* lisp/org.el (org-indent-line): When `org-adapt-indentation' is
'headline-data, prevent indentation for any first non-empty line
after the headline, not just the one right after the headline.
* 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'.
* 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'.
* 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/
* 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/
* 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.
* 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.
* 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>
* 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.
* 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
* 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
* 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/
* 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/
* 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
* 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.