* lisp/ob-core.el (org-babel--expand-body): New function.
(org-babel-check-confirm-evaluate):
(org-babel-execute-src-block): Use org-babel--expand-body.
As of 727c6d7fe (lisp/ob-core.el: org-babel-check-confirm-evaluate
strip coderefs, 2020-09-04), org-babel-check-confirm-evaluate and
org-babel-execute-src-block use the same logic to expand the body and
strip coderefs. Move that code to a helper function.
This patch is functionally equivalent to the patch originally proposed
by Tom Gillespie at
https://orgmode.org/list/CA+G3_PNi3uMvBiWgBdKuC3C6VJt1T1j-RKH43LRqYbr+4NS8ZA@mail.gmail.com
* lisp/ob-core.el (org-babel-check-confirm-evaluate): strip coderefs
before passing the body of the block to org-confirm-babel-evaluate
using the same let block as is used in org-babel-execute-src-block.
* lisp/ob-core.el (org-babel-result-to-file): Use
`buffer-base-buffer' so that `buffer-file-name' returns correct
results in indirect buffers too.
See <https://orgmode.org/list/87eeos3w7v.fsf@localhost>
TINYCHANGE
* lisp/org-capture.el (org-capture-finalize): Update
`org-capture-plist' with local-value before finalizing.
We use the global-variable `org-capture-plist' to populate the
local-variable `org-capture-current-plist' on the init of the
`org-capture' buffer. However, we do not do the opposite (i.e. update
the global-variable with the local-variable) on
`org-capture-finalize'.
This is fine for the majority of `org-capture-finalize', since we’re
using the LOCAL arg of `org-capture-get' to read
`org-capture-current-plist' instead of `org-capture-list', but this
trick does not work for `org-capture-after-finalize', since the hook
is run after the `org-capture-buffer' has been closed.
This causes problem with `:kill-buffer t', and it limits what can be
done with cleanup functions in `org-capture-after-finalize'.
See <https://orgmode.org/list/87h7tv9pkm.fsf@hidden/> for details.
* lisp/org.el (org-make-tags-matcher): Add a parameter to make it
optional to include non-buffer tags.
(org-match-sparse-tree): Use the new parameter.
TINYCHANGE
* lisp/org-goto.el (org-goto-location): Call make-indirect-buffer with
a non-nil CLONE to preserve the base buffer's state, avoiding a more
expensive call to org-mode.
Reported-by: Vladimir Nikishkin <lockywolf@gmail.com>
Suggested-by: Ihor Radchenko <yantar92@gmail.com>
* doc/org-manual.org (Results of Evaluation): Distinguish between
behavior when the :file-desc header argument is not present and when
it has no value.
The current handling of the :file-desc argument is to omit the
description if the header argument isn't present and to use the :file
value as the description if :file-desc is present without a value.
This matches the original intention [*].
[*] https://orgmode.org/list/87vclky211.fsf@med.uni-goettingen.de
Reported-by: Matt Huszagh <huszaghmatt@gmail.com>
https://orgmode.org/list/87sgbzl6uy.fsf@gmail.com
* lisp/ob-J.el (org-babel-execute:J, org-babel-J-eval-string): Add
customizability.
(org-babel-execute:J): Lookup optional parameter `:sit' to allow one
to wait for a specified amount of time before grabbing the output of
the J subprocess. Pass this specified value or the previous default
of .1 to `org-babel-J-eval-string'.
(org-babel-eval-string): Pass new argument `sit-time' to `sit-for'
before grabbing output.
The problem is that we read the contents of the output after 0.1
seconds, which, for expensive computations, results in the mangling of
output. Output from expensive computations gets propagated down to
subsequent code-blocks' outputs, producing a horrible mess.
TINYCHANGE
* lisp/org-clock.el (org-clock-sum-current-item): Do not include
clocked time from the parent when inside inlinetask.
Calling `org-narrow-to-subtree' from inside inlinetask would narrow to
the parent's subtree (correct behaviour). However, it is not what we
want when calculating the clocking sum. Inlinetask case should be
treated specially.
This fixes a bug in set-tags-command excluding a tag that is both set
locally and inherited from the initial minibuffer input by modifying
org-get-tags to prefer keeping the locally set tag over the inherited
tag, as this behavior is more intuitive for org-get-tags anyway.
* lisp/org.el (org-get-tags): Keep local tags over inherited.
* testing/lisp/test-org.el (test-org/set-tags-command): Add test.
* contrib/lisp/org-eldoc.el (org-eldoc-documentation-function):
b2b587387 did not set eldoc-documentation-functions, resulting in
`eldoc--invoke-strategy' throwing a void-function error.
Modified-by: Kyle Meyer <kyle@kyleam.com>
Added Emacs<25 branch.
* lisp/org.el (org-get-cursor-date): Fix regular expression.
Previous regular expression assumed the time grid string will have two
digits in the hour portion of the time string. However, the time grid
string does not always have two digits. For example:
" 8:00......"
* lisp/org-faces.el (org-block): Set background extension beyond
end-of-line.
* lisp/org-compat.el (org--set-faces-extend): New function to
temporarily (re)set :extend for Emacs≥27.
* lisp/org.el (org-mode): Call it to set the extend attribute of
relevant faces to the correct value.
* lisp/ob-core.el (org-babel-check-confirm-evaluate): Expand noweb
references in the body passed to org-confirm-babel-evaluate.
* testing/lisp/test-ob.el (test-ob/check-eval-noweb-expanded): New
test.
When noweb references are set to be expanded for evaluation,
org-confirm-babel-evaluate should receive the expanded body so that it
can make its decision based on what actually will be evaluated
(without resorting to calling org-babel-get-src-block-info itself).
Note that this results in up to three calls to
org-babel-expand-noweb-references. Possible ways to avoid this are
discussed at the thread referenced below.
Reported-by: Tom Gillespie <tgbugs@gmail.com>
https://orgmode.org/list/CA+G3_PNi3uMvBiWgBdKuC3C6VJt1T1j-RKH43LRqYbr+4NS8ZA@mail.gmail.com/
* contrib/lisp/org-eldoc.el (org-eldoc-documentation-function): Accept
and ignore additional arguments for compatibility with Emacs 28.
(org-eldoc-load): Use add-function to register
org-eldoc-documentation-function for Emacs versions 25 through 27, as
documented in eldoc-documentation-function.
See Emacs's fd020a2931 (eldoc: modify `eldoc-documentation-function'
using `add-function', 2014-12-05) and c0fcbd2c11 (Expose ElDoc
functions in a hook (Bug#28257), 2020-02-25) for more information on
the Emacs 25 and Emacs 28 changes, respectively.
* lisp/org.el (org-todo): Use nil instead of
org-loop-over-headlines-in-active-region as the MATCH argument.
org-loop-over-headlines-in-active-region isn't related to the MATCH
argument; it's related to SCOPE and decides the value of the let-bound
cl variable that's passed as SCOPE. Note, though, that
org-loop-over-headlines-in-active-region is let-bound to nil around
the org-map-entries call, so this didn't cause any issues.
* lisp/ox.el (org-export--dispatch-ui): Restore buffer position after
inserting text to avoid auto-scrolling at start.
When filling in the dispatch buffer, point ends up at the end of the
buffer, which can cause the buffer to be re-centered on point when
org-fit-window-to-buffer is called, in particular if scroll-margin is
above zero and there is a vertical split. Avoid this by putting point
where it was before the buffer was refreshed.
Reported-by: Gustavo Barros <gusbrs.2016@gmail.com>
https://orgmode.org/list/87tv3a56vv.fsf@gmail.com
* lisp/org-habit.el (org-habit-build-graph): Check if on the very
first "done" and set the standard color for done.
Recent behavior: Give that very first done the color to mean "done
ahead of schedule".
* lisp/org.el (org-fontify-meta-lines-and-blocks-1): Rewrite the "line
begins with *" check so that it does not assume that match data has
remained intact.
The upstream call to org-src-font-lock-fontify-block overwrites the
match data in some cases. As a result, (match-string 1) signals an
error and #+end_src is not fontified. Wrapping the call to
org-src-font-lock-fontify-block with save-match-data would fix the
reported issue. However, the position at the beginning of the line is
already stored in a variable, so use that information instead to check
whether the line starts with "*".
Reported-by: John Ciolfi <ciolfi@mathworks.com>
<r9r1ulpctz.fsf@ah-ciolfi-lah-ciolfi-l.dhcp.mathworks.com>
* lisp/ob-tangle.el (org-babel-tangle-single-block): Fix regression
from v9.0.2 that resulted in org-babel-tangle-use-relative-file-links
being ignored.
* testing/lisp/test-ob-tangle.el
(ob-tangle/comment-links-relative-file): Add test.
As of 7b148e2d0 (ob-tangle: Respect buffer local variables,
2016-12-10), the condition in org-babel-tangle-single-block that
checks whether to return a file link with a relative target always
returns nil because the full org-link-types-re match, including the
final colon, is compared with "file" (no colon). Also, were this
condition to succeed, "file:" would be used as the file name.
Adjust the condition and fix the extracted file name.
Reported-by: Jeremias Gonzalez <jgonzalez49@ucmerced.edu>
https://orgmode.org/list/6fb12326-52d3-7177-eff5-62603261b388@ucmerced.edu