find-original-source: don't treat (def . x) as a definition

And fail at printing it later.

Fixes lp#2143114
This commit is contained in:
Stas Boukarev 2026-03-03 14:26:39 +03:00
parent 2558856f78
commit 4d0dee1796
2 changed files with 11 additions and 2 deletions

View file

@ -215,9 +215,14 @@
(when (atom form)
(return))
(let ((head (first form)))
(when (symbolp head)
(when (and (symbolp head)
(listp (cdr form)))
(let ((name (symbol-name head)))
(when (and (>= (length name) 3) (string= name "DEF" :end1 3))
(when (and (>= (length name) 3)
(string= name "DEF" :end1 3)
;; A common name that clearly isn't a definition
(not (and (>= (length name) 7)
(string= name "DEFAULT" :end1 7))))
(context (source-form-context form))))))
(when (null current)
(return))

View file

@ -361,3 +361,7 @@
(lambda ()
```(progn . ,,,(progn (progn (setq x 1)))))
(1 1 1 1 2 1 1 1 2)))
(with-test (:name :def-error-context-printing)
(let ((*error-output* (make-broadcast-stream)))
(compile nil '(lambda () `(def . ,(print x))))))