Commit Graph

26050 Commits

Author SHA1 Message Date
Kyle Meyer 2f15b3c528 Merge branch 'km/from-emacs-29' into bugfix 2023-01-01 12:45:33 -05:00
Eli Zaretskii e0815d7545 Backport commit cae528457 from Emacs
; Add 2023 to copyright years.
cae528457cb862dc886a34240c9d4c73035b6659
Eli Zaretskii
Sun Jan 1 05:31:12 2023 -0500
2023-01-01 12:44:47 -05:00
Ihor Radchenko 9cee879b36
org-assert-version: Small refactoring
* lisp/org-macs.el (org-assert-version): Make quoting "'" in the
message more readable.

Thanks to Stefan Monnier <monnier@iro.umontreal.ca> for the
suggestion.
2023-01-01 15:58:19 +03:00
Ihor Radchenko 79e5e42e50
test-ob-octave.el: Remove test clauses causing race condition
* testing/lisp/test-ob-octave.el (ob-octave/graphics-file):
(ob-octave/graphics-file-session):
(ob-octave/graphics-file-space): Do not check the created image file
size.  This tests causes race condition between the test and Octave
writing image to disk.  Also, the correctness of image file is nothing
of Org's business as long as ob-ocatave's Elisp implementation is
concerned.
2023-01-01 15:56:13 +03:00
Kyle Meyer e316377767 Merge branch 'km/from-emacs-29' into bugfix 2022-12-31 18:13:31 -05:00
Stefan Kangas 92a40cf7a1 Backport commit 9292f595a from Emacs
; Fix typos
9292f595a71870eec1ffdfd187b859cc990c2f0b
Stefan Kangas
Sat Dec 31 12:43:32 2022 +0100
2022-12-31 18:11:46 -05:00
Ihor Radchenko 62dc49509c
org-assert-version: Do not display "'" as "’" in the code sample
* lisp/org-macs.el (org-assert-version): Dislpay (straight-use-package
'org) literally in the warning.

Reported-by: Stephen Eglen <sje30@cam.ac.uk>
Link: https://orgmode.org/list/m2edsgq1t8.fsf@cam.ac.uk
2022-12-31 16:10:11 +03:00
Ihor Radchenko 18577a495b
org-persist-register: Fix MISC argument handling
* lisp/org-persist.el (org-persist-register): Document that MISC must
be a plist.
(org-persist--get-collection): Throw an error when MISC is not a
plist.  Fix arglist - MISC is now passed explicitly as a single
object.
(org-persist--storage-version): Bump version to avoid obsolete
malformed containers with improperly included MISC.
2022-12-31 12:39:25 +03:00
Bastien 40e1c6c050 etc/ORG-NEWS: Fix typo 2022-12-30 09:17:19 +01:00
Ihor Radchenko e5c45358ae
test-ob-octave.el: Avoid race condition on slow machines
* testing/lisp/test-ob-octave.el (ob-octave/graphics-file):
(ob-octave/graphics-file-session):
(ob-octave/graphics-file-space): Delay `should' condition waiting for
file contents to be written by octave.  This may be necessary when
octave has not yet written the file contents (on slow machines).
Re-enable tests.

Link: https://orgmode.org/list/87r0wk29dz.fsf@localhost
2022-12-29 12:51:31 +03:00
Ihor Radchenko fc4bbb28f8
org-search-view: Fix searching across inlinetasks
* lisp/org-agenda.el (org-search-view): Consider that
`outline-next-heading' may move to inlinetask.

* testing/examples/agenda-search.org: New test file.

* testing/lisp/test-org-agenda.el (test-org-agenda/org-search-view):
New test.

Reported-by: Alain.Cochard@unistra.fr
Link: https://orgmode.org/list/25514.763.379510.806150@gargle.gargle.HOWL
2022-12-27 13:10:02 +03:00
Ihor Radchenko ecfb55af0a
org-src.el: Apply common faces even when src block language mode is absent
* lisp/org-src.el (org-src-font-lock-fontify-block): Apply
`org-src-block-faces'/`org-block' faces even when no major mode is
available for the src block language.

Reported-by: duskhorn <duskhorn@proton.me>
Link: https://orgmode.org/list/zCjC9UjXEgJk8kuyi8t2K2XzO3fL7pYWynHhoYWAes9eCA1FkomCY9bss4uKZfBg60M4xUisyDqFWKVMOn1r_XzUVE7gr3ci82MEOLjGIMk=@proton.me
2022-12-27 12:47:46 +03:00
Ihor Radchenko de83f548d9
org-persist-write:file: Do not overwrite existing cached file
* lisp/org-persist.el (org-persist-write:file): Do not try to copy on
top of the cached file, when already exists.
2022-12-26 20:07:30 +03:00
Kyle Meyer 8aea340d59 Merge branch 'km/from-emacs-29' into bugfix 2022-12-26 11:00:27 -05:00
Stefan Kangas 14cbbac212 Backport commit 2608e5edc from Emacs
; Fix typos
2608e5edcca5094b61b4ccebcef160cc2bfd7f83
Stefan Kangas
Mon Dec 26 10:42:02 2022 +0100
2022-12-26 10:59:44 -05:00
Ihor Radchenko b11abb409c
org-babel-insert-result: Output strings as is for lists of strings
* lisp/ob-core.el (org-babel-insert-result): Do not use %S format for
lists of strings in :results list output.  This is more consistent
with single string output.

Reported-by: Matt <matt@excalamus.com>
Link: https://orgmode.org/list/1852d9eb52f.c4c534f9581400.7140516675874523594@excalamus.com
2022-12-26 12:24:51 +03:00
Ihor Radchenko 9c79aedec7
org-agenda: Use more machine-friendly date output for csv export
* lisp/org-agenda.el (org-fix-agenda-info): Pad the month and date
numbers with 0, making sure that the date format is always YYYY-MM-DD.

Reported-by: David O'Toole <deeteeoh1138@gmail.com>
Link: https://orgmode.org/list/CAAz1J52e7ha=rtyz=Kn=o-X48XU3oNJYF57xo5hOBnz8_Twdyg@mail.gmail.com
2022-12-26 12:21:13 +03:00
Kyle Meyer 63e073f96e org-persist: Revert space misalignment from recent commit
987fe173a (org-persist: Do better job avoiding security issue
described in `make-temp-name', 2022-12-25) carried along an unrelated
space change.
2022-12-25 11:31:56 -05:00
Ihor Radchenko 718e196830
org-back-to-heading: Fix at inlinetask END
* lisp/org.el (org-back-to-heading): Fix when at inlinetask END.
* testing/lisp/test-org.el (test-org/org-back-to-heading): Add new
test.

Reported-by: Alain.Cochard@unistra.fr
Link: https://orgmode.org/list/25508.20192.899342.932809@gargle.gargle.HOWL
2022-12-25 15:49:28 +03:00
Ihor Radchenko f138810065
org-element: Allow inlinetasks to be commented and archived
* lisp/org-element.el (org-element-inlinetask-parser): Parse
inlinetasks closer to headings.  In particular, recognize COMMENT
keyword and ARCHIVE tag in inlinetasks on parser level.
* testing/lisp/test-org.el (test-org/comment-dwim): Add tests for
inlinetasks and for uncommenting headings.

Reported-by: Alain.Cochard@unistra.fr
Link: https://orgmode.org/list/25508.20192.899342.932809@gargle.gargle.HOWL
2022-12-25 15:32:01 +03:00
hugcis 318807013c
oc-basic.el: Fix wrong type for the editors field when parsing JSON.
* lisp/oc-basic.el (org-cite-basic--parse-json): Make sure
`org-cite-basic--parse-json' produces a string for the editors field.
The function `org-cite-basic--get-author' expects a string for both the
"authors" field and the "editors" field.
The conversion to string was only done for the "authors" field in
`org-cite-basic--parse-json'. This patch fixes the issue by applying the
transformation to both "authors" and "editors".

This points to a more general issue where `org-cite-basic--get-field' is
expected to return nil or a string, but calls
`org-cite-basic--get-entry' that may return an association list.

TINYCHANGE
2022-12-25 14:35:55 +03:00
Ihor Radchenko 7f2f73c414
org-babel-read: Small fix
* lisp/ob-core.el (org-babel-read): Remove redundant `format' call for
code block body.  The body is already a string.  Make the block name
more human readable using %s `format' arg.

Reported-by: Tom Gillespie <tgbugs@gmail.com>
Link: https://orgmode.org/list/CA+G3_PPFHcx6eeKGuvxDcuy3NjSpTnrbye0gHJePtvi2a-5wrg@mail.gmail.com
2022-12-25 13:58:06 +03:00
Ihor Radchenko 987fe173ac
org-persist: Do better job avoiding security issue described in `make-temp-name'
* lisp/org-persist.el: Create `org-persist-directory' early, when we
decide the directory name.  This way, even if third party code gets to
know the directory name in /tmp, it cannot raise file permissions by
creating `org-persist-directory' with loose access rights ahead of us.
Also, create and set `org-persist-directory' before we check if have
have proper access rights to write to it.
(org-persist-write-all): Do better job clearing
`org-persist-directory' if nothing is going to be written inside.
(org-persist-clear-storage-maybe): New function to be called before
exiting Emacs.  It is used to remove the persistent data before
exiting.  Multi-session persistence is not and must not be needed when
calling Emacs with -Q command line argument.  Call the function before
exiting Emacs in `kill-emacs-hook'.

Reported-by: Stefan Monnier <monnier@iro.umontreal.ca>
Link: https://yhetil.org/emacs-devel/jwvwn6kpmir.fsf-monnier+emacs@gnu.org
2022-12-25 12:17:36 +03:00
Ihor Radchenko e2366ac283
* lisp/org-persist.el: Do not litter /tmp when native compiling
Remove the directory created by `make-temp-file' when Emacs is called
with -Q command line argument.  Only use the return value as the
directory to be created when something is actually stored by
org-persist while running Emacs.

Reported-by: William Denton <wtd@pobox.com>
Link: https://orgmode.org/list/alpine.DEB.2.22.394.2212211213480.270543@shell3.miskatonic.org
2022-12-21 21:43:42 +03:00
Tom Gillespie a8c9f11757
Fix missing null check for tangle links during export
* lisp/ob-tangle.el (org-babel-tangle--unbracketed-link): Add the let
bound variable l to the and statement to prevent l from being passed
to `string-match' in the event that it is nil.

When tangling nested noweb blocks during export it is possible for the
results of `org-store-link' to return nil.  This commit ensures that
the value returned for l is only passed to `string-match' when it is
non-nil, avoiding a `wrong-type-argument' (stringp nil) error.

Handling of comments and nesting of babel blocks is known to have
issues.  The bug is from 8a781d35dc
where new code was introduced to obtain the value for bare which was
not present in early code.  I'm guessing that the bug appears now
because `string-match' is called on l (aka link) at a point in time
when it was never previously called and it was thus masked because in
the old version it was impossible to call `string-match' when `link'
was nil because another variable was always nil, masking the issue.
2022-12-21 15:40:27 +03:00
Ihor Radchenko db34a7d837
* lisp/ox-html.el (org-html-link): Fix call to `org-export-get-ordinal'
Pass list of type symbols as third argument following the docstring
spec.

Reported-by: Brian Powell <powellb@hawaii.edu>
Link: https://orgmode.org/list/m2tu1s458q.fsf@hawaii.edu
2022-12-21 15:28:48 +03:00
Ihor Radchenko a29103a786
* testing/lisp/test-ob-octave.el: Disable tests failing on CI only
(ob-octave/graphics-file):
(ob-octave/graphics-file-session):
(ob-octave/graphics-file-space): Disable tests until we figure the
origin of CI failures.  The tests are passing locally.

Link: https://orgmode.org/list/87cz8ifioa.fsf@localhost
2022-12-21 14:53:09 +03:00
Ihor Radchenko 12e10eb0dd
* doc/org-guide.org: Fix typos
(Visibility Cycling): Fix macro.
(Multi-state Workflow): Fix emphasis.
(Timestamps):
(Clocking Work Time):
(The Agenda Dispatcher): Fix heading link.

Reported-by: Cauim de Souza Lima <cauimsouza@gmail.com>
Link: https://orgmode.org/list/CAHFpVgHiZtBQ9U5CzJ1P1jGQVJhTGiP9uVdi9ttcP535urZkUg@mail.gmail.com
2022-12-18 17:41:52 +03:00
Ihor Radchenko 2247998758
ob-core: Fix :results list when result is a table
* lisp/ob-core.el (org-babel-insert-result): Do not treat table lines
in RESULT verbatim.
* testing/lisp/test-ob-shell.el (ob-shell/results-list): Add new test.

Reported-by: Rudolf Adamkovič <salutis@me.com>
Link: https://orgmode.org/list/m2tu1v8gj8.fsf@me.com
2022-12-18 14:18:54 +03:00
Kyle Meyer 47d1299e48 Merge branch 'km/from-emacs-29' into bugfix 2022-12-17 17:03:48 -05:00
Stefan Kangas c8b0a0d1b6 Backport commit a15cd5504 from Emacs
; Don't quote nil in comments
a15cd55044c6bb4d4e9f9aec23b8b5b9cbcb38ac
Stefan Kangas
Thu Dec 15 02:35:00 2022 +0100
2022-12-17 17:01:59 -05:00
Ihor Radchenko 2944a2152d
org-persist: Use temporary index for emacs -Q
* lisp/org-persist.el (org-persist--disable-when-emacs-Q): Rename
`org-persist-disable-when-emacs-Q' to internal variable.  Update the
docstring.
(org-persist-read):
(org-persist-write):
(org-persist-gc): Do not disable persistence.  Persistence is
necessary for remote file caching to work within a single Emacs
session.  Instead, use temporary directory as index for emacs -Q.
2022-12-17 12:39:35 +03:00
Ihor Radchenko aa86ed534f
org-persist-write-all: Do not create index with no containers
* lisp/org-persist.el (org-persist-write-all): Do not create
`org-persist-directory' when index does not contain any data except
index version.

Link: https://orgmode.org/list/875yedw0ib.fsf@localhost
2022-12-17 12:36:51 +03:00
Leo Butler 81f2741bca
prevent error in Octave process, add tests, update test docs
* lisp/ob-octave.el (org-babel-execute:octave):

  -Ensure that the special Octave variable `ans' is bound when
  GFX-FILE is non-nil.  The glue code in
  ORG-BABEL-OCTAVE-WRAPPER-METHOD causes Octave to exit with a
  non-zero exit code when `ans' is not bound.

  -Change format control string to %S from %s.  Ensure the graphics
  filename is quoted.  If it is not, Octave may create a mis-named
  file or fail entirely.

* testing/examples/ob-octave-test.org:

  Update the Graphical tests section:
  -put in the correct headers;
  -add a remark about where to find each test.

* testing/lisp/test-ob-octave.el:

  Add the three tests ob-octave/graphics-file,
  ob-octave/graphics-file-session and ob-octave/graphics-file-space.

  -ob-octave/graphics-file: The first test verifies that the first bug
  identified above is fixed; it also verifies that graphics file
  creation works correctly for scripting.

  -ob-octave/graphics-file-session: The second test verifies graphics
  file creation works correctly for sessions.  The Octave command
  `crash_dumps_octave_core(0)' is included to prevent the creation of
  a core file (`octave-workspace').

  -ob-octave/graphics-file-space: The third test verifies that a
  graphics filename with a space in it is created correctly.

Thanks to Ihor Radchenko for helpful feedback.
Ref: https://list.orgmode.org/8735asbtfe.fsf@localhost/T/#u
2022-12-17 11:20:43 +03:00
Jeremie Juste 662e814bc0
ob-R.el: Restore the handling of org-list in as var
* ob-R.el (org-babel-R-assign-elisp): Use the patch from
ccberry@health.ucsd.edu, to print org-list as a one column table as it
was the case in release_9.5. The break in R is due commit b4e437f96 *
ob-core: Resolve named list references to simple lists.

* test-ob-R.el (ob-R-nested-list): New function to test that org list
with multiple level are handled as expected in R.

see https://list.orgmode.org/87bkofh0ir.fsf@localhost/ for context.
2022-12-14 12:36:38 +03:00
Jeremie Juste fec15dedb9
test-ob-R.el: New function to test for :result output
* test-ob-R.el (ob-session-R-result-output): This test will check if
output is printed to buffer in a session with :results output. This
test is to prevent the bug mentioned in https://list.orgmode.org/877czca7oj.fsf@u-bordeaux.fr/
does not happen again.
2022-12-14 12:36:31 +03:00
TEC 402d2421d9
org-persist: Do not re-download url files on write
* lisp/org-persist.el (org-persist-write:url): Since the url write
function is called as part of `org-persist-write-all', it is worth
adding a check to avoid re-downloading the file if a file already exists
in the expected location.
2022-12-14 12:35:12 +03:00
TEC 6a126e40a7
org-persist: Ensure index instantiated before read
* lisp/org-persist.el (org-persist-read): If the index is empty at the
start of `org-persist-read', load it before continuing.
2022-12-14 12:33:39 +03:00
TEC 88329143c8
org: Use buffer-base-buffer in safe resource fns
* lisp/org.el (org--confirm-resource-safe, org--safe-remote-resource-p):
Replace instances of buffer-file-name
with (buffer-file-name (buffer-base-buffer)) so these functions work in
indirect buffers.
2022-12-14 12:33:15 +03:00
TEC 0db972ad63
ox: Handle failure to localize link
* lisp/ox.el (org-export-link-localise): When no local copy of the link
resource could be fetched, produce a warning message and do nothing
instead of setting the link :path to nil.
2022-12-14 12:31:56 +03:00
Ihor Radchenko 47bcdce19b
doc/org-manual.org: Document `org-hide-drawer-startup'
* doc/org-manual.org (Summary of In-Buffer Settings): Document the new
setting.
2022-12-13 14:13:01 +03:00
Ihor Radchenko 4323a19b15
org-hide-drawer-startup: Add missing variable alias
* lisp/org.el (org-hide-drawer-startup): Make alias to
`org-cycle-hide-drawer-startup'.

Reported-by: Kévin Le Gouguec <kevin.legouguec@gmail.com>
Link: https://orgmode.org/list/877cyvzrcu.fsf@gmail.com
2022-12-13 14:12:18 +03:00
Ihor Radchenko 02909fe371
lisp/test-ox.el: Add tests for `org-export-get-ordinal'
* testing/lisp/test-ox.el (test-org-export/get-ordinal): New test.
2022-12-13 11:49:42 +03:00
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