* lisp/org.el (org--at-headline-data-p): New function used to check if
element at point belongs to headline data.
(org--get-expected-indentation):
(org-indent-line): Use `org--at-headline-data-p' instead of
explicit (and inaccurate) condition.
* testing/lisp/test-org.el (test-org/indent-region): Add tests.
Fixes incorrect LOGBOOK drawer indentation when
`org-adapt-indentation' is set to 'headline-data.
* lisp/ob-tangle.el (org-babel-tangle, org-babel-tangle-finished-hook):
Create a new hook, `org-babel-tangle-finished-hook', and run it at the
end of `org-babel-tangle'.
(org-babel-pre-tangle-hook): Update docstring to mention buffer the hook
is run in, to match the docstring of `org-babel-tangle-finished-hook`.
* lisp/org-table.el (org-table-separator-space): Remove.
(org-table--separator-space-pre):
(org-table--separator-space-post): Use non-`eq' spaces as table cell
boundaries. This way, Emacs display engine will not merge the two
spaces with `eq' 'display properties in empty table cells.
(org-table--make-shrinking-overlay):
(org-table--align-field): Use the new constants for table alignment.
Fixes https://debbugs.gnu.org/cgi/bugreport.cgi?bug=45915
* lisp/org-agenda.el (org-agenda-get-sexps): Remove trailing
whitespaces in SEXP-ENTRY via buffer movements. It is faster than
re-creating string objects in `org-trim'.
* lisp/org-agenda.el: Remove unnecessary variable assignment. Prefer
checking ELEMENT type over regexp match when checking if we are inside
comment. Postpone let-binding until it is strictly necessary.
* lisp/org.el (org--diary-sexp-entry-cache): New variable holding
cached return values of `org-diary-sexp-entry'.
(org-diary-sexp-entry): Use `org--diary-sexp-entry-cache'.
* lisp/org-element.el: Remove unconditional checks when verification
is disabled. Do not call costly `derived-mode-p' and unnecessary
`org-element-property'.
* lisp/org-element.el (org-element--cache-active-p): Remove expensive
`derived-mode-p' call. Reshuffle the conditions to avoid costly
`memq' call as much as possible. Inline the function.
* lisp/org-agenda.el (org-agenda-skip): Make use of ELEMENT argument
when calling `org-in-src-block-p'.
(org-agenda-get-sexps): Pass actual element at point to `org-agenda-skip'.
* lisp/org.el (org-end-of-subtree): Avoid unnecessary call to
`org-back-to-heading-or-point-min' when ELEMENT is provided.
* lisp/oc-basic.el (org-cite-basic--set-keymap): Do not use
`buffer-substring' generalized variable. It is obsolete in Emacs 29.
Explicitly call `delete-region' + `insert'.
* lisp/org-agenda.el (org-element-lineage): Declare function.
* lisp/org.el (org--align-node-property): Use `delete-region' instead
of `buffer-substring' generalized variable.
* lisp/ox-latex.el (org-latex-generate-engraved-preamble): Amends
795783d644 where the number of arguments
`org-latex-generate-engraved-preamble' takes was reduced to 1, but the
change to the defun line was lost during conflict resolution.
* lisp/ox-latex.el (org-latex-generate-engraved-preamble): The type of
engraved-theme could be a string or a symbol, depending on whether the
default value was used. This can lead to type issue bugs. It is better
to have the same type, so let's intern as needed to consistantly have
symbols.
* lisp/ox-latex.el (org-latex-template,
org-latex-generate-engraved-preamble): The second argument of
`org-latex-generate-engraved-preamble' is only ever t, so there's not
much point in having it.
* lisp/ox-beamer.el (org-beamer-template): Update to not call
`org-latex-generate-engraved-preamble' with the second argument.
* lisp/ob-core.el (org-babel-expand-noweb-references): Do not rely on
reference cache being populated as a condition that all the references
in buffer have been processed. Set this information explicitly.
* testing/lisp/test-ob.el (test-ob/noweb-expansion): Add new test.
* lisp/org-element.el (org-element--cache-sync): Check
`org-element--cache-sync-requests' value early and quit if there are
none. This reduces the number of conditions checked when the request
queue is empty.
* lisp/ol.el (org-insert-link): Do not bypass code trying to generated
description and prompt user when link path and description are
identical. Make behavior of description prompt more consistent.
Remove confusing `auto-desc' local variable. Originally the variable
was added with implementation of completion of stored link target by the
description in the commit 1e34c5d34 Bastien Guerry, "org.el: Fontify
links to current buffer when inserting a link",
2012-08-03 14:08:20 +0200. The feature was broken soon by the commit
7f096ad37 Tony Day, "org-insert-link: Use ido when inserting links",
2012-10-12 14:39:53 +1100. Last decade users were not asked to edit
description in the case of the same link target and description
(a remained side effect of 1e34c5d34). Recent commit 0432f4fe6 Max
Nikulin, "ol.el: Restore complete by description for insert link",
2022-09-10 17:23:13 +0700 restored completion by description.
Due to the commit 4fc2c8dd8 Ihor Radchenko, "org-store-link: Default to
empty description for target/custom-id links", 2022-08-10 13:25:26 +0800
description identical to link path became a more rare case.
An alternative would be fixing condition to allow users to edit
description when it is the same as the path, but use stored description
without additional interaction when the link is chosen by description
completion. Despite it was likely the original intention, always asking
the user to confirm or edit description may be more consistent behavior.
* testing/org-batch-test-init.el (lambda): Remove the code that has
never been working. One could still rewrite the code using
`autoloadp', but it would break things terribly and should not be
needed as autoload does not need to be updated after changing the
`load-path'. See
https://orgmode.org/list/jwvedwczhbv.fsf-monnier+emacs@gnu.org
Mainly, add the corresponding cookie, but also add various `require`s
so that the compiler knows which vars should be trated as dynbound.
This does not fix all the warnings, but does try to eliminate
all those about "unused" variables. For the variables truly unused,
the patch usually adds an underscore to their name to silence the warning.
Some of the fixes affect files which already used `lexical-binding`.
Not sure why the test worked before: maybe because the tests were run
without compiling them first (which could cause some of the
missing `require`d packages to be autoloaded before we got to the
problematic code, thus hiding the problem)?
I found some suspicious code, for which I added FIXMEs.
There are also a few changes to the main files.
* lisp/org-protocol.el (org-protocol-check-filename-for-protocol):
Don't call `server-edit` if it's not yet defined. [ Needed to get
the tests to pass. ]
* lisp/ob-core.el (org-babel-temporary-directory)
(org-babel-temporary-stable-directory): Always define (and use nil
if we don't want to create a directory for it). Simplify the code based
on the fact that (defvar V E) only evaluates E if V is not yet `boundp`.
(org-babel-temp-file, org-babel-temp-stable-file)
(org-babel-remove-temporary-directory)
(org-babel-remove-temporary-stable-directory): Adjust accordingly.
* lisp/org.el (org-log-beginning): Add FIXME.
* testing/org-test.el: Require `org` and `org-id`.
(org-id-locations-file): Don't `defconst` it.
(org-test-at-id, org-test-in-example-file, org-test-at-marker)
(org-test-with-temp-text, org-test-with-temp-text-in-file): Move edebug
specs into `declare` (and simplify them).
(org-test-with-tramp-remote-dir--worker): Declare dynbound tramp vars.
(org--compile-when): Fix quoting of `exp`.
(org-test-load): Tweak regexps.
* testing/org-batch-test-init.el: Tweak regexp, remove dead code and
add a FIXME about it.
* testing/lisp/test-ox.el: Require `ox` instead of
erroring out if it's not already loaded. Also require `org-inlinetask`.
(org-test-with-parsed-data): Silence warnings when `info` is not used.
(test-org-export/bind-keyword): Add FIXME.
* testing/lisp/test-ox-publish.el: Require `org-test` and `ox-publish`.
(test-org-publish/resolve-external-link): Expose lambdas to
the compiler. Remove unused var `ids`.
(test-org-publish/get-project-from-filename): Remove unused var `file`.
* testing/lisp/test-org.el: Require `org-macs`, `org`,
`org-inlinetask`, `org-refile`, and `org-agenda`.
(test-org/org-read-date): Declare `org-time-was-given` as dynbound.
(test-org/set-regexps-and-options): Add FIXME.
* testing/lisp/test-org-timer.el: Require `org-timer`.
* testing/lisp/test-org-table.el: Require `ox`.
* testing/lisp/test-org-protocol.el: Require `org-protocol` instead of
erroring out if it's not already loaded. Also require `capture`, and
add missing `provide` statement.
* testing/lisp/test-org-pcomplete.el: Require `org`.
* testing/lisp/test-org-list.el: Require `org-list` and `org`.
* testing/lisp/test-org-lint.el: Require `org-footnote` and `org-lint`.
* testing/lisp/test-org-footnote.el: Require `org-footnote`.
* testing/lisp/test-org-element.el: Require `org-element` instead of
erroring out if it's not already loaded. Also require `org` and
`org-inlinetask`.
* testing/lisp/test-org-duration.el: Require `org-duration`.
* testing/lisp/test-org-datetree.el: Require `org-datetree`.
* testing/lisp/test-org-colview.el: Require `org-colview`,
`org-duration`, and `org-inlinetask`.
* testing/lisp/test-org-clock.el: Require `org-duration` and `org-clock`.
* testing/lisp/test-org-archive.el: Require `org-archive`.
* testing/lisp/test-org-agenda.el
(test-org-agenda/bulk-custom-arg-func): Add FIXME.
* testing/lisp/test-ol.el: Require `ol` and `org-id`.
(test-org-link/store-link): Declare `org-store-link-props` and add FIXME.
* testing/lisp/test-oc.el (test-org-cite/export-capability): Add FIXME.
* testing/lisp/test-ob.el: Require `ob-core`, `org-src`, `ob-ref`,
and `org-table`.
(test-ob/eval-header-argument): Rename `foo` to `test-ob--foo` and
declare it as dynbound.
(test-ob/blocks-with-spaces, test-ob/specific-colnames): Add FIXME.
(test-ob/noweb-expansions-in-cache):
Declare `noweb-expansions-in-cache-var` as dynbound.
* testing/lisp/test-ob-tangle.el: Require `org` and `ob-tangle`.
* testing/lisp/test-ob-shell.el:
* testing/lisp/test-ob-python.el: Require `ob-core`.
* testing/lisp/test-ob-lob.el: Require `ob-lob`.
(temporary-value-for-test): Declare as dynbound.
* testing/lisp/test-ob-plantuml.el: Require `ob-plantuml` instead of
erroring out if it's not already loaded.
* testing/lisp/test-ob-lilypond.el: Require `ob-lilypond` instead of
erroring out if it's not already loaded. Use `with-current-buffer`.
* testing/lisp/test-ob-julia.el: Require `ob-core`.
* testing/lisp/test-ob-java.el (org-babel-temporary-directory):
Remove dead code now that `org-babel-temporary-directory` is always bound.
* testing/lisp/test-ob-exp.el: Require `ob-exp`, `org-src`, and `org-test`.
(ob-exp/evaluate-all-executables-in-order):
Declare `*evaluation-collector*` as dynbound.
* testing/lisp/test-ob-emacs-lisp.el (ob-emacs-lisp/dynamic-lexical-edit)
(ob-emacs-lisp/dynamic-lexical-execute):
Rename dynbound var to `ob-emacs--x` and declare it as such.
* testing/lisp/test-ob-R.el: Require `ob-core`.
(ess-ask-for-ess-directory, ess-history-file): Declare vars.
* lisp/org-compat.el:
* lisp/org-macs.el: Do not check Org version. These two libraries are
the base libraries required to generate the Org version. The version
is not yet known when loading them; or, worse, built-in
`org-git-version' may be defined from built-in Org distribution.
Fixes https://orgmode.org/list/cdf0bc7d-3ed1-e1ce-84bb-239575a9c0b9@oracle.com
* lisp/org.el (org-log-beginning): Fix edge case when current headline
is the last headline in the buffer and does not have a final newline.
Fixes https://orgmode.org/list/m21qvi8er5.fsf@ntnu.no
* lisp/org.el (org-log-beginning): Fix edge case when there is a
headline at the end of buffer and that headline does not have a
trailing newline.
Fixes https://orgmode.org/list/m24k0ffjyd.fsf@ntnu.no
* lisp/ol.el (org-store-link): Do not set description for "<<target>>"
links to avoid case when it is more detailed than link target.
While inserting to the same file, file part of the link target is
stripped, description is inserted without modification. I do not think,
file path adds real value in comparison to "[[target]]" link to some
point in the same file. A side effect is user prompt for description
since link and description are not identical any more.
* list/ol.el (org-store-link): Suppress storing of
"file:file.org::#custom_id" link when point is <<target>>.
CUSTOM_ID link is stored as additional option, so new chunk of code
introduced by b4b35fc92 is not necessary. It prevented adding of
"file:file.org::*Heading" link and caused duplication of
"file:file.org::#custom_id" link.
Reported-by: Fr Ml <fr_ml@t-online.de>
Link: https://orgmode.org/list/aadb23f3-c0fe-19aa-be79-50e51d16c41a@t-online.de/
* lisp/ol.el (org-insert-link): Allow completion of link target by its
description. Almost certainly the feature was removed unintentionally.
Link descriptions were added to completion options in
the commit 1e34c5d34 Bastien Guerry, "org.el: Fontify links to current
buffer when inserting a link", 2012-08-03 14:08:20 +0200
in response to
https://list.orgmode.org/877gw6ocva.fsf@okhotsk19.lowtem.hokudai.ac.jp/T/#u
Yagnesh Raghava Yakkala, "#+LABEL and CUSTOM_ID with reftex",
Mon, 21 May 2012 04:45:29 +0900
List of description was removed from completion options
likely because `ido-completing-read' signals an error in the case of nil
variant (that is not uncommon for links with no description), see the
commit 7f096ad37 Tony Day, "org-insert-link: Use ido when inserting
links", 2012-10-12 14:39:53 +1100 and the discussion of the patch
- https://list.orgmode.org/04D0E787-A8A1-4246-8DD2-D607E38D61BA@gmail.com/T/#u
tony day. [PATCH] * org-insert-link: use ido when inserting links.
Fri, 12 Oct 2012 14:58:29 +1100
- https://list.orgmode.org/5CE03302-7C87-44BE-B4AF-A6A92C96C803@gmail.com/T/#u
tony day. [PATCH] org-insert-link: allow ido usage when inserting
links. Fri, 14 Sep 2012 19:21:50 +1000
- https://list.orgmode.org/0CADA13B-8A22-4F34-91B1-2232997C1F04@gmail.com/T/#u
tony day. [PATCH] org-insert-link: allow ido usage when inserting
links. Fri, 12 Oct 2012 14:56:10 +1100
- https://list.orgmode.org/97F9790D-3C7F-490B-BE9B-1A652BB9F187@gmail.com/
tony day. PATCH: using ido when inserting links.
Fri, 14 Sep 2012 18:58:43 +1000
Since auto-desc variable added by first commit was not removed
by second one, I assume that disabling the feature was a side effect
rather than the purpose.
Hi,
many years ago a colleague and myself wrote a patch for quarters into
org-mode/clocktable for blocks, today I noticed that :step should allow
'quarter' as an argument too. Here's the tiny patch to allow that.
* doc/org-manual.org (The clock table): Document the new clocktable
option.
* lisp/org-clock.el:
(org-clocktable-steps): Add new 'quarter allowed value.
TINYCHANGE