Commit graph

26057 commits

Author SHA1 Message Date
Ihor Radchenko 7048876f6f
org-export-get-ordinal: Do not ignore ELEMENT type when TYPES is given
* lisp/ox.el (org-export-get-ordinal): Append ELEMENT type to TYPES,
when TYPES is non-nil.
2022-12-13 11:49:42 +03:00
Ihor Radchenko bdb4c4c66e
org-export-get-ordinal: Fix breakage in 0551eba40
* lisp/ox.el (org-export-get-ordinal): Do not return first cached
number.  Search the actual requested element.  Do not disregard TYPES
argument in the cache.

Reported-by: Kaushal Modi <kaushal.modi@gmail.com>
Link: https://orgmode.org/list/CAFyQvY342ee8OgWVQdv=z3V1_3rgLttb2S0v27JLjF0KiMH0qA@mail.gmail.com
2022-12-13 11:49:41 +03:00
Kyle Meyer 2a529ee57b org-element: Autoload org-element-use-cache
* lisp/org-element.el (org-element-use-cache): Autoload to silence
byte compiler warning in Emacs repo.

On Emacs's emacs-29 branch, compiling lisp/org/org-loaddefs.el gives
the following warning that stems from an autoloaded defsubst,
org-element-at-point-no-context (new to Org 9.6):

  In org-element-at-point-no-context:
  org/org-loaddefs.el:846:61: Warning: Unused lexical variable
  `org-element-use-cache'

That doesn't show up in the Org repo because mk/org-fixup.el generates
org-loaddefs.el via autoload.el's generate-file-autoloads, which adds
"no-byte-compile: t" to its output file.  However, in Emacs 29,
autoload.el is now deprecated, and the Emacs build uses
loaddefs-gen.el's loaddefs-generate--emacs-batch, which does include
no-byte-compile.
2022-12-11 15:13:31 -05:00
Ihor Radchenko 41a8666c09
org-display-inline-remove-overlay: Do better job clearing images from cache
* lisp/org.el (org-display-inline-remove-overlay): Force remove
overlay images from Emacs image cache when un-displaying inline image
overlays.  This change should: (1) slightly improve Emacs memory usage
when the number of inline images is large; (2) Clear images from cache
every time Emacs removes the overlay for any
reason.  (`org-display-inline-remove-overlay' is used in
overlay 'modification-hooks.)
2022-12-11 12:16:26 +03:00
Kyle Meyer 954a95ec5f ob-core: Revert space misalignment from recent commit
cc5427b7e (org-babel-result-to-file: Fix results file inside
attachment dir, 2022-12-07) carried along an unrelated white space
change upstream of the main change.
2022-12-10 16:52:42 -05:00
Kyle Meyer 269dce9fe7 org-table: Require org-fold-core
* lisp/org-table.el: Explicitly load org-fold-core.

'make single' warns that org-fold-core-ignore-modifications in
org-table.el (introduced a few commits back) is not known to be
defined, and the Emacs repo would show the same warning.
2022-12-10 16:15:16 -05:00
Ihor Radchenko dbad11b354
org-manual: Update `org-table-blank-field' command description
* doc/org-manual.org (Re-aligning and field motion): Update the
command description according to up-to-date docstring.

Reported-by: André A. Gomes <andremegafone@gmail.com>
Link: https://orgmode.org/list/87zgfrvzz1.fsf@localhost
2022-12-10 16:53:58 +03:00
Ihor Radchenko 169333e1cb
org-footnote-sort: Improve performance
* lisp/org-footnote.el (org-footnote-sort): Group inserting the
footnote definitions into a single cache update request.  This should
improve performance.

Reported-by: arozbiz@gmail.com
Link: https://orgmode.org/list/CAJniy+MW330e8SLog4DHxzS8wvZ3OCzuwbKhUrdTCgpvtd3pkQ@mail.gmail.com
2022-12-10 13:22:12 +03:00
Ihor Radchenko 7fefc3027b
org-display-inline-images: Force-refresh image cache
* lisp/org.el (org-display-inline-images): Always refresh cached
images when displaying image overlays.  See Emacs bug#59902.  This
fixes images not updating when image file is changed on disk.

Reported-by: William Denton <wtd@pobox.com>
Link: https://orgmode.org/list/87wn7287n2.fsf@localhost
2022-12-10 13:02:13 +03:00
Ihor Radchenko 337d805354
org-link-descriptive-ensure: Small refactoring
* lisp/ol.el (org-link-descriptive-ensure): Compact the code.

Reported-by: T.V Raman <raman@google.com>
2022-12-10 12:50:37 +03:00
Ihor Radchenko 0616b3c375
org-export-as: Fix edge case during subtree export
* lisp/ox.el (org-export-as): Make sure that narrowing includes top
heading in a subtree when subtree export is requested.  This is needed
after 927621910 changed `org-export--get-subtree-options' behavior.

Reported-by: Alejandro Pérez Carballo <apc@umass.edu>
Link: https://orgmode.org/list/m2sfhpffui.fsf@umass.edu
2022-12-10 12:43:19 +03:00
Ihor Radchenko aba51fb584
org-fold-core-save-visibility: Fix macro expansion
* lisp/org-fold-core.el (org-fold-core-save-visibility): Calculate
folds on runtime, not during macro expansion.

* testing/lisp/test-org.el (test-org/org-ctrl-c-ctrl-c): Add test
ensuring that outline visibility is preserved upon refreshing Org
setup.

Reported-by: Matt Lundin <mdl@imapmail.org>
Link: https://orgmode.org/list/87wn70tlcn.fsf@fastmail.fm
2022-12-10 12:03:53 +03:00
Ihor Radchenko 76a725317e
orgtbl-to-generic: Improve performance
* lisp/org-table.el (orgtbl-to-generic): Disable org-fold checks in
temporary buffer.  Folding state is irrelevant there.

Reported-by: Majzoub, Eric <eric.majzoub@umsl.edu>
Link: https://orgmode.org/list/tn0s4e$84u$1@ciao.gmane.io
2022-12-10 08:48:29 +03:00
Kyle Meyer 33d0263de8 Merge branch 'km/from-emacs-29' into bugfix 2022-12-09 22:52:09 -05:00
Stefan Kangas c056afc153 Backport commit 262670405 from Emacs
; Normalize GPLv3 license statements in new files
26267040549da6e7f8223bea3b5344d0d5bef527
Stefan Kangas
Fri Dec 9 00:13:00 2022 +0100
2022-12-09 22:50:54 -05:00
Stefan Kangas 1ce9da0048 Backport commit 8fb2afe05 from Emacs
; Fix typos
8fb2afe051168b2eac2bba0ee102039d0af90a05
Stefan Kangas
Thu Dec 8 07:17:47 2022 +0100
2022-12-09 22:49:40 -05:00
Ihor Radchenko 34a8133715
Revert "lisp/ox-latex.el: put labels inside example blocks"
This reverts commit 304f18cb72.

This patch will break verbatim environment as the label will be
interpreted verbatim as well.
2022-12-08 15:44:58 +03:00
Ihor Radchenko 8b6df19dc7
org-fold-core-get-regions: Search whole buffer when FROM and TO are nil
* lisp/org-fold-core.el (org-fold-core-get-regions): Fix non-intuitive
when FROM and TO are nil.  Update the docstring.

Reported-by: Daniel Mendler
2022-12-08 15:04:11 +03:00
Hugo Heagren 304f18cb72
lisp/ox-latex.el: put labels inside example blocks
* lisp/ox-latex.el (org-latex-example-block): Instead of
`org-latex--wrap-label', manually add label after
\begin{<environment>}.

This produces proper label resolution in LaTeX.  Labels before the
environment begins can be interpreted as referring to the surrounding
section.
2022-12-08 14:35:01 +03:00
Ihor Radchenko 97a780f0be
org-table-justify-field-maybe: Do not allow newlines inside cells
* lisp/org-table.el (org-table-justify-field-maybe): Remove newlines
from cell values, when present.  Newlines will alter the table cell
structure.

Reported-by: Julien Palard <julien@palard.fr>
Link: https://orgmode.org/list/638faf1b.050a0220.2bd96.904b@mx.google.com
2022-12-07 16:59:21 +03:00
Ihor Radchenko 3176ed9052
org-persist: Never write data associated with encrypted files
* lisp/org-persist.el (org-persist-write): Do not write data
associated with gpg-encrypted files.  This will avoid data leakage.
(org-persist--storage-version): Bump storage version to invalidate
previously stored, potentially leaked, data.

Reported-by: Clément Pit-Claudel <clement.pitclaudel@live.com>
2022-12-07 16:05:21 +03:00
Ihor Radchenko 5d14e88c51
org-make-tags-matcher: Fix regexp
* lisp/org.el (org-make-tags-matcher): Match
<now>/<today>/<tomorrow>/<+3d>/etc time queries.  They are allowed by
"11.3.3 Matching tags and properties" section of the manual.

Fixes regression from e022a0cea.

Reported-by: Carlo Tambuatco <oraclmaster@gmail.com>
Link: https://orgmode.org/list/87bkokgtd7.fsf@kyleam.com
2022-12-07 14:23:29 +03:00
Ihor Radchenko cc5427b7ef
org-babel-result-to-file: Fix results file inside attachment dir
* lisp/ob-core.el (org-babel-result-to-file): When file path in the
result contains attachment dir, reduce the path to relative file name
when generating attachment: link.
* testing/lisp/test-ob.el (test-ob-core/dir-attach): Add test.

Reported-by: Johan Tolö <johan@toloe.se>
Link: https://orgmode.org/list/875yesnia6.fsf@toloe.se
2022-12-07 14:13:49 +03:00
Ihor Radchenko 4dddbc1436
org-clock-update-time-maybe: Preserve point position better
* lisp/org-clock.el: Try harder to preserve point position upon
updating the clock line.  Even when `save-excursion' is not
sufficient.

Reported-by: Daniel Clemente <n142857@gmail.com>
Link: https://orgmode.org/list/CAJKAhPDVs5GRKR-cmyeNd5cQFHyKpw_=JptBzi1f0FYNTqqjzA@mail.gmail.com
2022-12-07 13:48:32 +03:00
Ihor Radchenko 7e6b55b8fd
org-element--cache-active-p: Fix when cache is disabled in indirect buffers
* lisp/org-element.el (org-element--cache-active-p): Consider cache
disabled when any of the indirect buffers do not have modification
detection.  This can be important when one uses
`combine-after-change-calls' inside an indirect buffers disabling
`after-change-functions' temporarily in the indirect buffer.

Reported-by: Feng Shu <tumashu@163.com>
Link: https://orgmode.org/list/87359z8ssb.fsf@163.com
2022-12-04 16:10:25 +03:00
Ihor Radchenko 461eb2a0ec
org-fold-core-cycle-over-indirect-buffers: Fix missing indirect capture buffers
* lisp/org-fold-core.el (org-fold-core-cycle-over-indirect-buffers):
Fix logic detecting foreign `org-fold-core--indirect-buffers'.
`current-buffer' is not always at `car'.  Before this change, capture
buffers could be missed when cycling over indirect buffers causing
subtle bugs.

Reported-by: Alexandros Prekates <aprekates@posteo.net>
Link: https://orgmode.org/list/20221128122841.2246aa08@enous
2022-12-04 16:10:19 +03:00
Ihor Radchenko 4564627415
org-babel-comit-with-output: Fix when prompt is emitted partially
* lisp/ob-comint.el (org-babel-comint-with-output): Do not rely on
output filter when detecting prompt lines.  Search for
`comint-prompt-regexp' in the full output after applying the filter.
This is needed when the filter is supplied with partial prompts.

Reported-by: Frédéric Santos <frederic.santos@u-bordeaux.fr>
Link: https://orgmode.org/list/877czca7oj.fsf@u-bordeaux.fr
2022-12-02 13:59:24 +08:00
Kyle Meyer d122c2b5b4 ox-md: Tweak a defcustom type for compatibility with Emacs<28
* lisp/ox-md.el (org-md-toplevel-hlevel): Change the type from natnum
to integer, which is less accurate but compatible with all Emacs
versions that Org supports.

This is a follow-up to the recent port of 4b2f5425d.
2022-12-01 17:26:01 -05:00
Eli Zaretskii 3159ea296f Backport commit 8b3baadf6 from Emacs
* lisp/org-clock.el (org-x11idle-exists-p): Don't try to
invoke "command x11idle" on MS-Windows and MS-DOS.  This fixes a
hang during byte-compilation of Org.

Fix compilation of Org 9.6 on MS-Windows
8b3baadf671b7b3d5058808c4655eca8bd46015e
Eli Zaretskii
Thu Dec 1 14:40:47 2022 +0200
2022-12-01 17:25:59 -05:00
Mattias Engdegård 9b856c273f Backport commit 4b2f5425d from Emacs
* lisp/ob-clojure.el
(ob-clojure-babashka-command, ob-clojure-nbb-command):
Account for the possibility of nil (commands absent).
* lisp/org.el (org-safe-remote-resources):
* lisp/ox-md.el (org-md-toplevel-hlevel):
Fix incorrect or invalid types.

Fix types in various defcustom declarations
4b2f5425d7af1a6f992ad8ce0a4452a2e778815a
Mattias Engdegård
Thu Dec 1 13:03:19 2022 +0100

[km] The natnum change will be adjusted in an upcoming commit because
     natnum not available until Emacs 28.
2022-12-01 17:25:58 -05:00
Stefan Kangas c8ad9e4b28 Backport commit 8617edfff from Emacs
; Fix typos
8617edfffd07eb80561b4de6a37c5b0b5f442e07
Stefan Kangas
Wed Nov 30 16:59:41 2022 +0100
2022-11-30 17:19:12 -05:00
Mattias Engdegård 7ba099a3fd Backport commit c3466099c from Emacs
* lisp/org-element.el (org-element--get-node-properties):
Escape literal `+`.
* lisp/org-persist.el (org-persist-load:index):
Replace line-start with string-start when the latter is meant.

Org regexp style fixes
c3466099c5f44c52ec73a1bbbb2b42de6f29ac7f
Mattias Engdegård
Wed Nov 30 13:23:38 2022 +0100
2022-11-30 08:55:24 -05:00
Kyle Meyer a4d38e3965 ORG-NEWS: Fix location of some v9.6 entries
Three entries describe changes made in the 9.6 release, not 9.5.  The
associated commits are 226119124 (ob-core.el/babel: Special handling
for attachment links in src block, 2022-06-14), 7f3a6cf6e
(org-capture: Add template hook properties, 2022-10-07), and b4e437f96
(ob-core: Resolve named list references to simple lists, 2022-11-26).
2022-11-29 22:32:30 -05:00
Kyle Meyer 3b79818691 ORG-NEWS: Drop "Version 9.7" heading from bugfix branch 2022-11-29 21:22:05 -05:00
Kyle Meyer 5fd5912fa4 ob-core: Silence byte-compiler warning
* lisp/ob-core.el (org-babel-read-list): Reflow docstring paragraph to
silence "docstring wider than 80 characters" warning.
2022-11-29 21:22:05 -05:00
Bastien b3da427ebb Update version numbers for the 9.6 release 2022-11-29 07:34:50 +01:00
Ihor Radchenko 9276219103
org-export--get-subtree-options: Do not jump to parent subtree
* lisp/ox.el: Never jump to parent heading even when point is at an
existing heading.
* testing/lisp/test-ox.el (test-org-export/get-subtree-options): Fix
test assuming that current subtree may include parent.

Reported-by: Kaushal Modi <kaushal.modi@gmail.com>
Link: https://orgmode.org/list/CAFyQvY3mxi4DRTS+W-AX7bFELVujqH4DODEYPy3hyGRRuMEPSw@mail.gmail.com
2022-11-27 16:48:44 +08:00
Ihor Radchenko eed4708b66
org-babel: Add new :results discard header argument
* lisp/ob-core.el (org-babel-result-cond): Unconditionally return nil
and suppress all the processing for :results discard.
(org-babel-common-header-args-w-values):
(org-babel-sha1-hash): Add the new value to know :results value list.
* doc/org-manual.org (Handling):
* etc/ORG-NEWS (New =:results discard= header argument): Document the
new value.

Reported-by: Daniel Ortmann <daniel.ortmann@oracle.com>
Link: https://orgmode.org/list/87tu2tjary.fsf@localhost
2022-11-27 08:32:51 +08:00
Ihor Radchenko 6db75d5602
* etc/ORG-NEWS: Announce deprecation of python-mode.el (MELPA) support
(=python-mode.el (MELPA)= support in =ob-python.el= is deprecated):
Document that we no longer support third-party python-mode.el package
in favor of the built-in python.el.

Link: https://orgmode.org/list/87r0yk7bx8.fsf@localhost
2022-11-26 18:02:21 +08:00
Ihor Radchenko 9eed8567e8
testing/lisp/test-org-element.el: Uncomment working test
* testing/lisp/test-org-element.el (test-org-element/class):
Uncomment.  Whatever caused the failure in the past is not longer the
problem.  Tests are passing.
2022-11-26 16:05:19 +08:00
Ihor Radchenko b4e437f968
ob-core: Resolve named list references to simple lists
* lisp/ob-core.el (org-babel-read-list): Return a simple list instead
of list of lists.  Document this in the docstring.
* testing/lisp/test-ob-java.el (ob-java/read-return-list):
(ob-java/read-list-return-array):
(ob-java/read-return-list-with-package): Fix tests assuming previous
behavior.
* testing/lisp/test-ob.el (test-ob/simple-variable-resolution): Add
new tests.
* etc/ORG-NEWS (List references in source block variable assignments
are now proper lists): Document the change.

This commit fixes the broken promise in the manual section 16.4
Environment of a Code Block where the named references to lists should
be converted to simple lists consisting of the top-level items.

The inconsistency existed for a while and possibly lurked into some
third-party packages.  So, announcement in NEWS is required.

Reported-by: Alain.Cochard@unistra.fr
Link: https://orgmode.org/list/87pmdqfao4.fsf@localhost
2022-11-26 09:51:36 +08:00
Ihor Radchenko c72d5ee840
org-table-convert-refs-to-rc: Fix failing test
* lisp/org-table.el (org-table-convert-refs-to-an): Leave $0
references (current row) unchanged during conversion.
*
testing/lisp/test-org-table.el (test-org-table/org-table-convert-refs-to-an/2):
Re-enable the failing test.
2022-11-25 14:45:09 +08:00
Rudolf Adamkovič 5337a49f32
org.el: Use long option names when launching dvisvgm
* lisp/org.el (org-preview-latex-process-alist): Use long option names
when launching dvisvgm, optimizing for maintainability, instead of
brevity.  For example, use `--no-fonts' instead of `-n'.
2022-11-25 10:07:00 +08:00
Rudolf Adamkovič 52ebf6b45e
org.el: Compute bounds exactly when converting LaTeX output to SVG
* lisp/org.el (org-preview-latex-process-alist): Call `dvisvgm' with
`-e' (`--exact-bbox') instead of `-b min' (`--bbox=min') to measure
the exact bounds around visual glyphs, as opposed to using font
metrics, to avoid clipping at the edges.

Link: https://orgmode.org/list/m2v8n4w00w.fsf@me.com
2022-11-25 10:06:44 +08:00
Ihor Radchenko 670f68bea2
lisp/org-agenda.el: Obsolete unused org-let' and org-let2'
* lisp/org-agenda.el (org-let):
(org-let2):
* lisp/org-compat.el (org-let):
(org-let2): Move to org-compat and mark for removal.

P.S. Save the kittens!
2022-11-25 09:42:17 +08:00
Ihor Radchenko f7831cc9ac
* testing/lisp/test-org-table.el: Uncomment working test
(test-org-table/org-table-convert-refs-to-rc/3): Uncomment test that
is no longer broken.
2022-11-24 19:42:15 +08:00
Ihor Radchenko d4522dd4df
lisp/org.el: Fix toggling overlays in region
* lisp/org.el (org--inline-image-overlays): New function returning
overlays in region.
(org-toggle-inline-images): Respect BEG and END arguments when
determining presence of overlays.
(org-remove-inline-images): Clear up deleted overlays.

Reported-by: William Denton <wtd@pobox.com>
Link: https://orgmode.org/list/alpine.DEB.2.22.394.2211221559080.61289@shell3.miskatonic.org
2022-11-24 10:11:15 +08:00
Ihor Radchenko 50a3558011
org-manual: Clarify auto-detection of code block result type
* doc/org-manual.org (How to evaluate source code): Link to Results of
evaluation section for details about the inserted code block result.
(Type): Clarify that auto-detecting result type relies on specific
language backend, linking to the relevant manual section.
(Languages): Clarify that Worg is a website.

Reported-by: Alain.Cochard@unistra.fr
Link: https://orgmode.org/list/25461.4423.734070.149776@gargle.gargle.HOWL
2022-11-24 09:53:39 +08:00
Ihor Radchenko 1cdac8ef6a
* lisp/ob-eval.el (org-babel--get-shell-file-name): Update fixme 2022-11-24 09:49:09 +08:00
Kyle Meyer 28f220d1da org-manual: Deleting trailing space to pass Emacs's pre-commit check 2022-11-23 15:45:00 -05:00