Subject: Re: bug#61436: Emacs Freezing With Java Files

From: Mats Lidell <[email-masked]>
Date: Sun, 22 Oct 2023 00:14:43 +0200

Hi Alan,

Sorry for coming back late to this issue but today I tried to use the
suggested regexp and got into some problems doing that.

> Alan Mackenzie writes:
> Here's the regexp.  Would people please try it out and let me know how
> well it works.  
>
> (defconst java-defun-prompt-regexp
>   (let ((space* "[ \t\n\r\f]*")
>         (space+ "[ \t\n\r\f]+")
>         (modifier*
>          (concat "\\(?:"
>                  (regexp-opt '("abstract" "const" "default" "final" "native"
>                                "private" "protected" "public" "static"
>                                "strictfp" "synchronized" "threadsafe"
>                                "transient" "volatile")
>                              'words)    ; Compatible with XEmacs
>                  space+ "\\)*"))
>         (ids-with-dots "[_$a-zA-Z][_$.a-zA-Z0-9]*")
>         (ids-with-dot-\[\] "[[_$a-zA-Z][][_$.a-zA-Z0-9]*")
>         (paren-exp "([^);{}]*)")
>         (generic-exp "<[^(){};]*>"))
>     (concat "^[ \t]*"
>             modifier*
>             "\\(?:" generic-exp space* "\\)?"
>             ids-with-dot-\[\] space+                ; first part of type
>             "\\(?:" ids-with-dot-\[\] space+ "\\)?" ; optional second part of type.
>             "\\(?:[_a-zA-Z][^][ \t:;.,{}()=<>]*"    ; defun name
>                 "\\|" ids-with-dot*
>             "\\)" space*
>             paren-exp
>             "\\(?:" space* "]\\)*"      ; What's this for?
>             "\\(?:" space* "\\<throws\\>" space* ids-with-dot-\[\]s*
>                   "\\(?:," space* ids-with-dot-\[\]s* "\\)*"
>             "\\)?"
>             space*)))

Can there be some typos in there or missing lines? I get a compiler warning
for space+ being used in the let, should it be a let*? ids-with-dots is
reported as not used. Can it be meant to be ids-with-dot*?
ids-with-dot-\[\]s* is undefined!?

Yours
-- 
%% Mats