From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#61436: Emacs Freezing With Java Files Date: Wed, 17 Apr 2024 18:50:33 +0000 Message-ID: References: <8734yew8yr.fsf@sappc2.fritz.box> <878r7voc6k.fsf@lidells.se> <87il6yzid4.fsf@lidells.se> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14999"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Hank Greenburg , Mats Lidell , acm@muc.de, Eli Zaretskii , Jens Schmidt , 61436@debbugs.gnu.org To: rswgnu@gmail.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Apr 17 20:51:15 2024 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 1rxANG-0003c2-UH for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 17 Apr 2024 20:51:15 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rxAMu-0008Ug-5p; Wed, 17 Apr 2024 14:50:52 -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 1rxAMs-0008US-GM for bug-gnu-emacs@gnu.org; Wed, 17 Apr 2024 14:50:50 -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 1rxAMs-00088E-8Y for bug-gnu-emacs@gnu.org; Wed, 17 Apr 2024 14:50:50 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rxAN4-0006Y9-ND for bug-gnu-emacs@gnu.org; Wed, 17 Apr 2024 14:51:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 17 Apr 2024 18:51: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.171337986125159 (code B ref 61436); Wed, 17 Apr 2024 18:51:02 +0000 Original-Received: (at 61436) by debbugs.gnu.org; 17 Apr 2024 18:51:01 +0000 Original-Received: from localhost ([127.0.0.1]:47497 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rxAN0-0006XF-7F for submit@debbugs.gnu.org; Wed, 17 Apr 2024 14:51:00 -0400 Original-Received: from mail.muc.de ([193.149.48.3]:18038) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rxAMv-0006Vx-5X for 61436@debbugs.gnu.org; Wed, 17 Apr 2024 14:50:56 -0400 Original-Received: (qmail 74374 invoked by uid 3782); 17 Apr 2024 20:50:34 +0200 Original-Received: from muc.de (pd953ac81.dip0.t-ipconnect.de [217.83.172.129]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Wed, 17 Apr 2024 20:50:33 +0200 Original-Received: (qmail 9774 invoked by uid 1000); 17 Apr 2024 18:50:33 -0000 Content-Disposition: inline In-Reply-To: X-Submission-Agent: TMDA/1.3.x (Ph3nix) X-Primary-Address: acm@muc.de 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:283519 Archived-At: Hello again, Bob. On Wed, Apr 17, 2024 at 13:06:50 +0000, Alan Mackenzie wrote: > On Tue, Apr 16, 2024 at 21:35:59 -0400, Robert Weiner wrote: > > Hi Alan: > > I just re-read this whole thread and realized you resolved the problem > > for the Java defun-prompt-regexp but not the C++ > > defun-prompt-regexp in Hyperbole's hui-select.el:L404 (probably were > > just tired after all of that). > > Today, someone else reported that the C++ regexp was hanging their > > Emacs. Do you think you could pick this back up and rework the C++ > > regexp as you did the Java one? It would be a big help; otherwise, I > > think we'll just have to disable that functionality in Hyperbole. > > Best regards, > > Bob > > On Sun, Oct 22, 2023 at 1:18â¯PM Mats Lidell > > <[1]mats.lidell@lidells.se> wrote: > Yes, I'll happily finish off that C++ regexp. I made considerable > progress with it back in October, getting smething basically working but > with some rough edges. One problem is that the regexp was ~1600 > characters long. I don't know if this might make the program slow - > possibly not. > I've found the .el file I was working in, and located my notes from > October. It's going to take longer than a day or two, but hopefully > less than a week or two. It was rather easier than I'd anticipated. There is my first attempt below. It should find most C++ defun starts, but not all. In particlar it won't recognise one with nested parens or nested template delimiters; regexps cannot handle arbitrary nesting,and it didn't seem worth the trouble to code in a small bounded degree of nesting, though this surely could be done if I'm wrong, here. The regexp is not small. At the latest count it was 2,223 characters long. I hope this won't affect performance too much. Please try out this regexp, and let me know how well it's working. Thanks! > [ .... ] (defconst c++-defun-prompt-regexp (let* ((space* "[ \t\n\r\f]*") (space+ "[ \t\n\r\f]+") (ad-hoc-requires-clause (concat "\\(?:requires" space* "[][()<> \t\n\r\f_$a-zA-Z0-9&|\"'+=.,*:~-]+" space* "\\)?")) (id (concat "[_$~a-zA-Z][_$a-zA-Z0-9]*") ;; (concat "\\(\\(~" space* "\\)?" "\\([_$a-zA-Z][_$a-zA-Z0-9]*\\)\\)") ) (template-brackets "\\(?:<[^;{}]*>\\)") (id-<> (concat id "\\(?:" space* template-brackets "\\)?")) (id-:: (concat id-<> "\\(?:" space* "::" space* id-<> "\\)*")) (paren-exp "([^{};]*)") (template-exp\? (concat "\\(?:template" space* template-brackets space* "\\)?")) (type-prefix-modifier* (concat "\\(?:\\(?:" "\\(?:\\" space* "\\(?:[][a-z_+*/%^?&|!~<>,:=-]+" "\\|()\\|\"\"" "\\)" space* "\\)")) (name-exp ; matches foo or (* foo), etc. (concat "\\(?:(" space* "[*&]+" space* id-:: space* "[][()]*" ")" "\\|\\(?:[*&]+" space* "\\)?" id-:: "\\)" space*)) (type-suffix-modifier* (concat "\\(?:" (regexp-opt '("auto" "const" "noexcept" "requires" "throw" "volatile") 'words) space+ "\\)*")) (post-paren-modifier* (concat "\\(?:" (regexp-opt '("const" "final" "override" "mutable") 'words) space* "\\)*"))) (concat template-exp\? "\\(?:" ad-hoc-requires-clause "\\)?" type-exp type-mid-modifier* "\\(?:" operator-exp "\\|" name-exp "\\)" type-suffix-modifier* paren-exp space* "\\(?:->" space* type-exp "\\)?" post-paren-modifier* "{")) -- Alan Mackenzie (Nuremberg, Germany).