I've recently started facing some issues where all org files refuse to
load with the error message:
```
Debugger entered--Lisp error: (wrong-number-of-arguments #<subr
org-persist--find-index> 2)
```
I think the culprit is the use of cl-set-difference with
org-persist--find-index as the :test function.
Since the :test function (like `equal`) is expected to take two
objects to compare and the org-persist--find-index takes a single
argument

Usually when `(org-file-newer-than-p index-file
org-persist--index-age)` is nil the merge process is not triggered and
things work well. But if that is not the case the merge function which
internally calls cl-set-difference fails.

This change seems to be recently introduced in 4ec1087 on May 3rd, 2025.

Below is a slightly truncated stack trace with the problem for reference:

Debugger entered--Lisp error: (wrong-number-of-arguments #<subr
org-persist--find-index> 2)
  org-persist--find-index((:container ((elisp
org-element--headline-cache) (elisp org-element--cache) (version
"2.3")) :persist-file "5b/d55ed1-5fc6-4c2b-b8d1-1e1304c31d6c"
:associated (:hash "bb3c382e6416906a58dc46c0cb0195e3" :file
"<truncated_file_path.org>" :inode 44140230) :expiry 30 :last-access
1750758041.756506 :last-access-hr "2025-06-24T15:10:41+0530")
(:container ((elisp org-element--headline-cache) (elisp
org-element--cache) (version "2.3")) :persist-file
"2c/607334-0dd4-4ab2-9ace-91e170323826" :associated (:hash
"29bf71fc6b5b1e3f110228522eec69a4" :file "<truncated_file_2_path.org>"
:inode 67197588) :expiry 30 :last-access 1751084016.835267
:last-access-hr "2025-06-28T09:43:36+0530"))
  cl-member(...)
  cl-set-difference((... ... ... ... ... ... ... ... ... ... ... ...
... ... ...) (... ... ... ... ... ... ... ... ... ... ... ... ... ...
...) :test org-persist--find-index)
  org-persist--merge-index((... ... ... ... ... ... ... ... ... ...
... ... ... ... ...) (... ... ... ... ... ... ... ... ... ... ... ...
... ... ...))
  org-persist--merge-index-with-disk()
  org-persist-register(((elisp org-element--cache) (version "2.3"))
#<buffer test.org>)
  org-element-cache-reset()
  org-mode()
  #<subr set-auto-mode-0>(org-mode nil)
  apply(#<subr set-auto-mode-0> (org-mode nil))
  set-auto-mode-0(org-mode nil)
  set-auto-mode--apply-alist(... nil nil)
  #<subr set-auto-mode>()
  so-long--set-auto-mode(#<subr set-auto-mode>)
  apply(so-long--set-auto-mode #<subr set-auto-mode> nil)
  set-auto-mode()
  normal-mode(t)
  after-find-file(nil t)
  find-file-noselect-1(#<buffer test.org>
"<truncated_file_3_path.org>" nil nil "<truncated_file_3_path.org>"
(64374425 16777231))
  find-file-noselect("<truncated_file_3_path.org>" nil nil t)
  find-file("<truncated_file_3_path.org>" t)
  funcall-interactively(find-file "<truncated_file_3_path.org>" t)
  command-execute(find-file)



-- 
Regards,
Umar Ahmad

Reply via email to