Package: emacs;
Reported by: Eshel Yaron <me <at> eshelyaron.com>
Date: Thu, 22 Aug 2024 10:09:01 UTC
Severity: normal
Found in version 31.0.50
Fixed in version 30.1
Done: Eshel Yaron <me <at> eshelyaron.com>
Bug is archived. No further changes may be made.
Message #11 received at 72759 <at> debbugs.gnu.org (full text, mbox):
From: Eshel Yaron <me <at> eshelyaron.com> To: Eli Zaretskii <eliz <at> gnu.org> Cc: 72759 <at> debbugs.gnu.org Subject: Re: bug#72759: 31.0.50; Emacs hangs with open-paren-in-column-0-is-defun-start set to nil Date: Thu, 22 Aug 2024 13:31:16 +0200
Eli Zaretskii <eliz <at> gnu.org> 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" <bug-gnu-emacs <at> gnu.org> >> >> >> 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. Here's an example backtrace: --8<---------------cut here---------------start------------->8--- Debugger entered--beginning evaluation of function call form: * (save-current-buffer (set-buffer buffer) (set-syntax-table table)) (unwind-protect (progn (set-syntax-table (or syntax-ppss-table (syntax-table))) (let* ((cell (syntax-ppss--data)) (ppss-last (car cell)) (ppss-cache (cdr cell)) (old-ppss (cdr ppss-last)) (old-pos (car ppss-last)) (ppss nil) (pt-min (point-min))) (if (and old-pos (> old-pos pos)) (setq old-pos nil)) (condition-case nil (if (and old-pos (< (- pos old-pos) (let ... ...))) (progn (syntax-ppss--update-stats 0 old-pos pos) (parse-partial-sexp old-pos pos nil nil old-ppss)) (cond ((and ... old-ppss ... ... ...) (syntax-ppss--update-stats 1 pt-min pos) (setq ppss ...)) (t (let ... ... ... ... ... ... ...))) (setq syntax-ppss--updated-cache t) (setq ppss-last (cons pos ppss)) (setcar cell ppss-last) (setcdr cell ppss-cache) ppss) (args-out-of-range (parse-partial-sexp (point-min) pos))))) (save-current-buffer (set-buffer buffer) (set-syntax-table table))) (let ((table (syntax-table)) (buffer (current-buffer))) (unwind-protect (progn (set-syntax-table (or syntax-ppss-table (syntax-table))) (let* ((cell (syntax-ppss--data)) (ppss-last (car cell)) (ppss-cache (cdr cell)) (old-ppss (cdr ppss-last)) (old-pos (car ppss-last)) (ppss nil) (pt-min (point-min))) (if (and old-pos (> old-pos pos)) (setq old-pos nil)) (condition-case nil (if (and old-pos (< ... ...)) (progn (syntax-ppss--update-stats 0 old-pos pos) (parse-partial-sexp old-pos pos nil nil old-ppss)) (cond (... ... ...) (t ...)) (setq syntax-ppss--updated-cache t) (setq ppss-last (cons pos ppss)) (setcar cell ppss-last) (setcdr cell ppss-cache) ppss) (args-out-of-range (parse-partial-sexp (point-min) pos))))) (save-current-buffer (set-buffer buffer) (set-syntax-table table)))) syntax-ppss() beginning-of-defun-raw(-1) beginning-of-defun(-1) (and (not (setq found (checkdoc--next-docstring))) (beginning-of-defun -1)) (while (and (not (setq found (checkdoc--next-docstring))) (beginning-of-defun -1))) (let (found) (while (and (not (setq found (checkdoc--next-docstring))) (beginning-of-defun -1))) found) checkdoc-next-docstring() (and (not wrong) (checkdoc-next-docstring)) (while (and (not wrong) (checkdoc-next-docstring)) (setq msg (checkdoc-this-string-valid take-notes)) (if msg (setq wrong (point)))) (save-excursion (while (and (not wrong) (checkdoc-next-docstring)) (setq msg (checkdoc-this-string-valid take-notes)) (if msg (setq wrong (point))))) (let ((wrong nil) (msg nil) (checkdoc-spellcheck-documentation-flag (car (memq checkdoc-spellcheck-documentation-flag '(buffer t)))) (checkdoc-autofix-flag (if take-notes 'never checkdoc-autofix-flag)) (checkdoc-generate-compile-warnings-flag (or take-notes checkdoc-generate-compile-warnings-flag))) (save-excursion (while (and (not wrong) (checkdoc-next-docstring)) (setq msg (checkdoc-this-string-valid take-notes)) (if msg (setq wrong (point))))) (if wrong (progn (goto-char wrong) (if (not take-notes) (user-error "%s" (checkdoc-error-text msg))))) (checkdoc-show-diagnostics) (if (called-interactively-p 'interactive) (message "No style warnings."))) checkdoc-continue(t) (let ((p (point))) (goto-char (point-min)) (if (and take-notes (called-interactively-p 'interactive)) (checkdoc-start-section "checkdoc-start")) (checkdoc-continue take-notes) (goto-char p) nil) checkdoc-start(t) (or (and buffer-file-name (checkdoc-comments)) (checkdoc-start take-notes) (checkdoc-message-text) (checkdoc-rogue-spaces) (if checkdoc-package-keywords-flag (progn (checkdoc-package-keywords))) (not (called-interactively-p 'interactive)) (if take-notes (checkdoc-show-diagnostics)) (message "Checking buffer for style...Done.")) (let ((checkdoc-spellcheck-documentation-flag (car (memq checkdoc-spellcheck-documentation-flag '(buffer t)))) (checkdoc-autofix-flag (if take-notes 'never checkdoc-autofix-flag)) (checkdoc-generate-compile-warnings-flag (or take-notes checkdoc-generate-compile-warnings-flag))) (if take-notes (checkdoc-start-section "checkdoc-current-buffer")) (or (and buffer-file-name (checkdoc-comments)) (checkdoc-start take-notes) (checkdoc-message-text) (checkdoc-rogue-spaces) (if checkdoc-package-keywords-flag (progn (checkdoc-package-keywords))) (not (called-interactively-p 'interactive)) (if take-notes (checkdoc-show-diagnostics)) (message "Checking buffer for style...Done."))) checkdoc-current-buffer(t) elisp-flymake-checkdoc(#f(compiled-function (&rest args) #<bytecode -0x7c81ca94217587e>)) apply(elisp-flymake-checkdoc #f(compiled-function (&rest args) #<bytecode -0x7c81ca94217587e>) nil) flymake--run-backend(elisp-flymake-checkdoc nil) #f(compiled-function (backend) #<bytecode -0x1832fbc28e51265>)(elisp-flymake-checkdoc) run-hook-wrapped(#f(compiled-function (backend) #<bytecode -0x1832fbc28e51265>) elisp-flymake-checkdoc) flymake-start((on-display) nil) --8<---------------cut here---------------end--------------->8---
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.