Fix false positive warnings in 'elisp-flymake-checkdoc' when narrowed

* lisp/progmodes/elisp-mode.el (elisp-flymake-checkdoc): Temporarily
widen the buffer before calling 'checkdoc-current-buffer'.  This
prevents checkdoc from reporting missing file-level structural
elements when the user has narrowed the buffer.  (Bug#81258)
This commit is contained in:
James Cherti 2026-06-17 11:37:27 -04:00 committed by Eli Zaretskii
parent 58e4dc3c53
commit d365328e6d

View file

@ -2618,11 +2618,12 @@ Calls REPORT-FN directly."
(generate-new-buffer " *checkdoc-temp*")))
(unwind-protect
(save-excursion
;; checkdoc-current-buffer can error if there are
;; unbalanced parens, for example, but this shouldn't
;; disable the backend (bug#29176).
(ignore-errors
(checkdoc-current-buffer t)))
(without-restriction
;; checkdoc-current-buffer can error if there are
;; unbalanced parens, for example, but this shouldn't
;; disable the backend (bug#29176).
(ignore-errors
(checkdoc-current-buffer t))))
(kill-buffer checkdoc-diagnostic-buffer)))
(funcall report-fn
(cl-loop for (text start end _unfixable) in