From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Robert Weiner Newsgroups: gmane.emacs.bugs Subject: bug#61436: Emacs Freezing With Java Files Date: Mon, 16 Oct 2023 20:10:14 +0100 Message-ID: <787A7578-55E3-4FED-8FA8-1DD0EA47FC65@gmail.com> References: Mime-Version: 1.0 (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="21175"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Robert Weiner , Hank Greenburg , Mats Lidell , 61436-done@debbugs.gnu.org, Eli Zaretskii , Jens Schmidt To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Oct 16 21:12:04 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 1qsT0V-0005G6-P2 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 16 Oct 2023 21:12:03 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsT06-00022E-OV; Mon, 16 Oct 2023 15:11:38 -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 1qsT05-00021C-Hy for bug-gnu-emacs@gnu.org; Mon, 16 Oct 2023 15:11:37 -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 1qsT05-0004HD-9v for bug-gnu-emacs@gnu.org; Mon, 16 Oct 2023 15:11:37 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qsT0T-0007Z9-Uh for bug-gnu-emacs@gnu.org; Mon, 16 Oct 2023 15:12:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Robert Weiner Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 16 Oct 2023 19:12:01 +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-done@debbugs.gnu.org id=D61436.169748346529007 (code D ref 61436); Mon, 16 Oct 2023 19:12:01 +0000 Original-Received: (at 61436-done) by debbugs.gnu.org; 16 Oct 2023 19:11:05 +0000 Original-Received: from localhost ([127.0.0.1]:58029 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qsSzW-0007Xi-L9 for submit@debbugs.gnu.org; Mon, 16 Oct 2023 15:11:05 -0400 Original-Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]:40199) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qsSzQ-0007X7-TB for 61436-done@debbugs.gnu.org; Mon, 16 Oct 2023 15:11:00 -0400 Original-Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-4053e6e8ca7so16443005e9.1 for <61436-done@debbugs.gnu.org>; Mon, 16 Oct 2023 12:10:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697483426; x=1698088226; darn=debbugs.gnu.org; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version :from:content-transfer-encoding:from:to:cc:subject:date:message-id :reply-to; bh=Truq3eY3pji/kkBQ1pXY+2p+Pji1iKi1U6Yjkd0lMIo=; b=cKhIcPWTOhT+6Bd4duY/VgQZeCR/zpTE2hZz9A8ji4rnTnc2rYZ8RZbs/qld0SUoBL RaVaBO+5d9spPYef2K+Sp2JFhy6WVFbvpmuQzwBXMCF3XKhIyFYoamLg7iTrJWtQcBbI GFfM+qeKL9Jh73Kih3ro4e96bfbQTNc//D8ffM7Ci/si5p3HPvCFqQpfe7A4TgKU7Udj LmM2Ab+Wdib9wsVFgOHfyz2rHNpEuutxQeISw+K5sdD3I7xdgMCm04bfAKEoJkpiujqG qw8XaPDEBiD2jdtPF+7bm3QVAxWUi/Aos9NTjeYDy36R3h4/NLzJi578pccQEPcxeEvU qSzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697483426; x=1698088226; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version :from:content-transfer-encoding:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Truq3eY3pji/kkBQ1pXY+2p+Pji1iKi1U6Yjkd0lMIo=; b=tZQXRK+06N0dUs5nu6GxCMlPI6lo4BbrvE+vJNQxSzu8AU6YQK90cprnfskyxWsxd3 +EbNqVkuaXdSaAsocGoUyzsaKCkQjbtXbYJpTLFjM1LhuG2Xw4tnzsnjhfZdaz1pKBJ1 UIw0EWtRU69RW/b/N9ggeOzOK9/nPCbC+Nx9uDPmpMa6sxPKWvOx0DaRz4uvGXUc+1IV vTj5+iaTLZCjbqXiXcctlK49WwDXE9A3nQ5GqoBYaD7Ia+hXtoEoCEF9X50UPCiESxTm bSz0Y9cgRXYMbeRsSyikViShIMYdTn5ugH90akhQsvc9f4JBpCEgzsUs3PRM9vZRrRKM cHdw== X-Gm-Message-State: AOJu0Yx9cfLNp88hjMsbzcRQrLGlhSL1wu0EbEcf8YhWZr+FK2xuAVAQ J14Uw08wULUh1il85//9Zqs= X-Google-Smtp-Source: AGHT+IGfyySBTg97UWKt+ArPJYr+Y4J1YHeWdnHpv6GWd4cFx4QoXELHic1aaPHldYkNbOXdyl0zDA== X-Received: by 2002:adf:b305:0:b0:32d:b9c5:82fd with SMTP id j5-20020adfb305000000b0032db9c582fdmr211825wrd.7.1697483425531; Mon, 16 Oct 2023 12:10:25 -0700 (PDT) Original-Received: from smtpclient.apple ([94.4.55.6]) by smtp.gmail.com with ESMTPSA id u12-20020adff88c000000b0032d9a1f2ec3sm8968044wrp.27.2023.10.16.12.10.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 16 Oct 2023 12:10:25 -0700 (PDT) In-Reply-To: X-Mailer: iPhone Mail (20H30) 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:272581 Archived-At: Nice job, Alan. Thanks, look forward to trying it out. -- Bob > On Oct 16, 2023, at 3:05 PM, Alan Mackenzie wrote: >=20 > =EF=BB=BFHello, Bob. >=20 >> On Sun, Oct 15, 2023 at 06:20:15 -0400, Robert Weiner wrote: >> Hi Alan: >=20 >> Would be great if you can improve those two regexps. The only >> requirement is that they be able to recognize all defuns in the two >> languages as best a regexp can, so that the whole defun can be >> selected based on finding the opening brace regardless of coding >> style. >=20 > So far, I've only looked at the Java regexp. It had some serious > deficiencies, notably: > (i) It used "\\s-" (space syntax) a lot. This fails to mach \n, which in > Java mode has comment-end syntax. > (ii) The bit for the parenthesis expression was in an optional part of > the regexp with the result that it would match "almost anything" rather > than a defun start. >=20 > In the following regexp these faults are fixed. Additionally, I've > included more modifiers (things like private, volatile) which Java seems > to have gathered over the years. I've also attempted to match generic > functions. I don't know how well this will work out. >=20 > Here's the regexp. Would people please try it out and let me know how > well it works. =20 >=20 > (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 o= f type. > "\\(?:[_a-zA-Z][^][ \t:;.,{}()=3D<>]*" ; defun name > "\\|" ids-with-dot* > "\\)" space* > paren-exp > "\\(?:" space* "]\\)*" ; What's this for? > "\\(?:" space* "\\" space* ids-with-dot-\[\]s* > "\\(?:," space* ids-with-dot-\[\]s* "\\)*" > "\\)?" > space*))) >=20 >> Thanks. >=20 >> -- Bob >=20 >>> On Oct 14, 2023, at 8:41 PM, Alan Mackenzie wrote: >=20 > [ .... ] >=20 >>> Mats, I'm willing to work on that regular expression, and also the one >>> for C++. As I mentioned earlier, I've got some tools which work on >>> regexps, in particular pp-regexp, which prints a regexp more readably on= >>> several lines, and fix-re, which rewrites a regexp when it is >>> ill-conditioned in certain ways. >=20 >>> I foresee reverse engineering the regexps into more readable forms built= >>> up by concatenating basic blocks. For example for the java regexp I >>> would define >=20 >>> (defconst id "[a-zA-Z][][_$.a-zA-Z0-9]*") >=20 >>> , and use this id in a largish concat form. >=20 >>> I'm also willing to share pp-regexp and fix-re with you(r team), if that= >>> might help, on the understanding that neither is of release quality. >=20 > --=20 > Alan Mackenzie (Nuremberg, Germany).