Subject: bug#72759: 31.0.50; Emacs hangs with open-paren-in-column-0-is-defun-start set to nil

From: Eli Zaretskii <[email-masked]>
Date: Thu, 22 Aug 2024 15:12:41 +0300

> From: Eshel Yaron <[email-masked]>
> Cc: [email-masked]
> Date: Thu, 22 Aug 2024 13:31:16 +0200
> 
> Eli Zaretskii <[email-masked]> writes:
> 
> >> Date: Thu, 22 Aug 2024 12:07:38 +0200
> >> From:  Eshel Yaron via "Bug reports for GNU Emacs,
> >>  the Swiss army knife of text editors" <[email-masked]>
> >> 
> >> 
> >> 1. emacs -Q
> >> 2. (setq open-paren-in-column-0-is-defun-start nil)
> >> 3. Insert " (foo"
> >> 4. M-x flymake-mode
> >> 5. Emacs hangs
> >> 
> >> I can reproduce this with Emacs 29 and later.
> >
> > Thanks.  Could you show the Lisp backtrace from the hang (assuming it
> > hangs in Lisp code)?
> 
> Sure, see the backtrace below.  It appears that the hang is in
> checkdoc-next-docstring, namely this loop...
> 
> --8<---------------cut here---------------start------------->8---
> (while (and (not (setq found (checkdoc--next-docstring)))
>                 (beginning-of-defun -1)))
> --8<---------------cut here---------------end--------------->8---
> 
> ...never terminates, because beginning-of-defun behaves differently with
> open-paren-in-column-0-is-defun-start set to nil.

Would it make sense to have checkdoc-next-docstring bind
open-paren-in-column-0-is-defun-start to a non-nil value?