bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#61436: Emacs Freezing With Java Files


From: Jens Schmidt
Subject: bug#61436: Emacs Freezing With Java Files
Date: Wed, 11 Oct 2023 21:38:26 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

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 <rsw@gnu.org> 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\\|synchronized\\|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:;.,{}()=]*\\|\\([_$a-zA-Z][_$.a-zA-Z0-9]*\\)\\)\\s-*\\(([^);{}]*)\\)?\\([] 
\t]*\\)\\(\\s-*\\<throws\\>\\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 AM Mats Lidell <mats.lidell@lidells.se> 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=hyperbole

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\\|synchronized\\|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:;.,{}()=]*\\|\\([_$a-zA-Z][_$.a-zA-Z0-9]*\\)\\)\\s-*\\(([^);{}]*)\\)?\\([] 
\t]*\\)\\(\\s-*\\<throws\\>\\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-l0jatXJSQWKPfObrlOkIB3dagud85x2DGXGhPpQn1QNqNksVmPIRc1intyW_Cx1Z9ou2vBZ5QLDpLTi_VFVYyg=@protonmail.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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]