fix(lib): find-subling-file-search: wrong-number-of-args error

I backported `find-sibling-file` from Emacs 29+ in 198fe82, but it
passes a third argument (REGEXP) to `file-expand-wildcards` which wasn't
introduced until 29, so users on 28 or earlier would see a
wrong-number-of-arguments error (see #7795).

Rather than backport the entire `file-expand-wildcards`
function (risking other edge cases), I've advised its usage in
`find-sibling-file-search` to behave as it would in 29+ with a non-nil
REGEXP argument.

Amend: 198fe82b6d49
Fix: #7795
This commit is contained in:
Henrik Lissner 2024-04-04 13:00:12 -04:00 committed by Yann Esposito (Yogsototh)
parent 36c24be6d4
commit a37d801a48
Signed by untrusted user who does not match committer: yogsototh
GPG key ID: 7B19A4C650D59646

View file

@ -594,7 +594,12 @@ see), and if nil, defaults to `find-sibling-rules'."
(nconc (nconc
results results
(mapcar #'expand-file-name (mapcar #'expand-file-name
(file-expand-wildcards expansion nil t))))))))) ;; `file-expand-wildcards' has a new REGEXP
;; argument in 29+ that is needed here. This swap
;; makes it behave as if REGEXP == t.
(letf! (defun wildcard-to-regexp (wildcard)
(concat "\\`" wildcard "\\'"))
(file-expand-wildcards expansion nil))))))))))
;; Delete the file itself (in case it matched), and remove ;; Delete the file itself (in case it matched), and remove
;; duplicates, in case we have several expansions and some match ;; duplicates, in case we have several expansions and some match
;; the same subsets of files. ;; the same subsets of files.