From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jens Schmidt via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#61436: Emacs Freezing With Java Files Date: Wed, 11 Oct 2023 21:38:26 +0200 Message-ID: <87r0m1t0el.fsf@sappc2.fritz.box> References: <83cz6fiefb.fsf@gnu.org> <835yc6hl0c.fsf@gnu.org> <87bkd7fsp4.fsf@sappc2.fritz.box> <87il7ew5wx.fsf@sappc2.fritz.box> <87il7dbosk.fsf@lidells.se> Reply-To: Jens Schmidt Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20343"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) Cc: Robert Weiner , Hank Greenburg , Mats Lidell , Eli Zaretskii , rswgnu@gmail.com, 61436@debbugs.gnu.org To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Oct 11 21:40:09 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qqf3x-00057E-Kh for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 11 Oct 2023 21:40:09 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qqf3W-0001D0-GR; Wed, 11 Oct 2023 15:39:42 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qqf3U-0001Ca-V8 for bug-gnu-emacs@gnu.org; Wed, 11 Oct 2023 15:39:40 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qqf3U-0007Pw-NR for bug-gnu-emacs@gnu.org; Wed, 11 Oct 2023 15:39:40 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qqf3q-0002zN-53 for bug-gnu-emacs@gnu.org; Wed, 11 Oct 2023 15:40:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jens Schmidt Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 11 Oct 2023 19:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61436 X-GNU-PR-Package: emacs Original-Received: via spool by 61436-submit@debbugs.gnu.org id=B61436.169705316711436 (code B ref 61436); Wed, 11 Oct 2023 19:40:02 +0000 Original-Received: (at 61436) by debbugs.gnu.org; 11 Oct 2023 19:39:27 +0000 Original-Received: from localhost ([127.0.0.1]:40094 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qqf3H-0002yN-5h for submit@debbugs.gnu.org; Wed, 11 Oct 2023 15:39:27 -0400 Original-Received: from mr6.vodafonemail.de ([145.253.228.166]:35496) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qqf3B-0002y5-HI for 61436@debbugs.gnu.org; Wed, 11 Oct 2023 15:39:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vodafonemail.de; s=vfde-mb-mr2-21dec; t=1697053133; bh=ACIu1WSOmcH0W1FZKR4ENmd1hiBf6Jpf8s4A6Ou8x0Q=; h=From:To:Subject:References:Date:In-Reply-To:Message-ID:User-Agent: Content-Type:From; b=Yi/C3S8h8Ibyowoz4q+FMbMl8ZeH7oNxOUn6yoCQG+On2CPXUHgq7RUWYUzivau3X 2x3lU+UizlRgi5J0O/K6rSA2LpBQ7y6HoESkAcgpfgftXQYluHPhjyoP5YI4WqICbl 61ki01kn9njZ36m2sIYJ8eANKCc001muhug6SA5M= Original-Received: from smtp.vodafone.de (unknown [10.0.0.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by mr6.vodafonemail.de (Postfix) with ESMTPS id 4S5NP92jDBz1xsb; Wed, 11 Oct 2023 19:38:53 +0000 (UTC) Original-Received: from sappc2 (port-92-194-230-114.dynamic.as20676.net [92.194.230.114]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp.vodafone.de (Postfix) with ESMTPSA id 4S5NNk3fvgzHnHf; Wed, 11 Oct 2023 19:38:27 +0000 (UTC) In-Reply-To: (Robert Weiner's message of "Wed, 11 Oct 2023 06:17:50 -0400") X-purgate-type: clean X-purgate: clean X-purgate-size: 3977 X-purgate-ID: 155817::1697053129-BE7FD94E-0D39D584/0/0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:272267 Archived-At: Hi Alan, could you please have a look as well? This seems to be related to cc-mode/java-mode. New, complete reproducer at the very bottom of this mail. Thanks! Hi Robert & Mats, Robert Weiner writes: > Jens wrote: > >> That always freezes Emacs (29 and master) even before it has a chance to >> display P1.java. The freeze happens in function >> `c-get-fallback-scan-pos', where the while loop inf-loops, BUT: >> >> If you uncomment the line setting `hkey-init' to nil in init.el and >> repeat: No freeze. > > As you note above, the infinite loop is coming from a Lisp function in > Emacs core, not from Hyperbole. A Hyperbole setting may help you to > see a state reached in that function that you otherwise would not, but > it is not a Hyperbole bug; it is an unhandled state outside of > Hyperbole. Well, yes and no. The next closest culprit seems to be this hook addition from function `hui-select-initialize': ;; These hooks let you select C++ and Java methods and classes by ;; double-clicking on the first character of a definition or on its ;; opening or closing brace. This is all necessary since some ;; programmers don't put their function braces in the first column. (var:add-and-run-hook 'java-mode-hook (lambda () (setq defun-prompt-regexp "^[ \t]*\\(\\(\\(public\\|protected\\|private\\|const\\|abstract\\|sync= hronized\\|final\\|static\\|threadsafe\\|transient\\|native\\|volatile\\)\\= s-+\\)*\\(\\(\\([[a-zA-Z][][_$.a-zA-Z0-9]*[][_$.a-zA-Z0-9]+\\|[[a-zA-Z]\\)\= \s-*\\)\\s-+\\)\\)?\\(\\([[a-zA-Z][][_$.a-zA-Z0-9]*\\s-+\\)\\s-*\\)?\\([_a-= zA-Z][^][ \t:;.,{}()=3D]*\\|\\([_$a-zA-Z][_$.a-zA-Z0-9]*\\)\\)\\s-*\\(([^)= ;{}]*)\\)?\\([] \t]*\\)\\(\\s-*\\\\s-*\\(\\([_$a-zA-Z][_$.a-zA-Z0= -9]*\\)[, \t\n\r\f]*\\)+\\)?\\s-*"))) I (very generally) think that Emacs does not have to grok every regexp in every context, but I leave that concrete case for Alan and/or others to decide. > On Wed, Oct 11, 2023 at 3:29=E2=80=AFAM Mats Lidell wrote: > > Thanks for the report. Actually, not mine. I'm just the messenger who did some root-cause analysis. > Note: I don't know what P1.java means here. I have picked a java file > at random that I had on my machine that is large. Is P1.java a > specific file that has been shared earlier? The OP has provided that, see below. > Hyperbole has its own tracker. > > https://debbugs.gnu.org/cgi/pkgreport.cgi?package=3Dhyperbole Ok, thanks. As soon as we know whose bug this is we could forward or not. Now for the next reproducer (Hyperbole no longer required, but still present through its regexp :-): - Save the following to ~/tmp/init.el: ------------------------- snip ------------------------- (add-hook 'java-mode-hook (lambda () (setq defun-prompt-regexp "^[ \t]*\\(\\(\\(public\\|protected\\|private\\|const\\|abstract\\|synchr= onized\\|final\\|static\\|threadsafe\\|transient\\|native\\|volatile\\)\\s-= +\\)*\\(\\(\\([[a-zA-Z][][_$.a-zA-Z0-9]*[][_$.a-zA-Z0-9]+\\|[[a-zA-Z]\\)\\s= -*\\)\\s-+\\)\\)?\\(\\([[a-zA-Z][][_$.a-zA-Z0-9]*\\s-+\\)\\s-*\\)?\\([_a-zA= -Z][^][ \t:;.,{}()=3D]*\\|\\([_$a-zA-Z][_$.a-zA-Z0-9]*\\)\\)\\s-*\\(([^);{= }]*)\\)?\\([] \t]*\\)\\(\\s-*\\\\s-*\\(\\([_$a-zA-Z][_$.a-zA-Z0-9= ]*\\)[, \t\n\r\f]*\\)+\\)?\\s-*"))) ------------------------- snip ------------------------- - Save attachment P1.java from the initial message https://yhetil.org/emacs-bugs/ZPOcahP9yPJ-kLcgipM3-l0jatXJSQWKPfObrlOkIB3= dagud85x2DGXGhPpQn1QNqNksVmPIRc1intyW_Cx1Z9ou2vBZ5QLDpLTi_VFVYyg=3D@protonm= ail.com/ to ~/tmp/P1.java. - Start Emacs as ./src/emacs -Q -l ~/tmp/init.el +181 ~/tmp/P1.java That always freezes Emacs (29 and master) even before it has a chance to display P1.java. The freeze happens in function `c-get-fallback-scan-pos', where the while loop inf-loops.