From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ergus via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#70794: 30.0.50; Add Rust compilation regex Date: Mon, 3 Jun 2024 16:41:42 +0200 Message-ID: References: <16667D6C-F897-4A85-8C7A-0FA2E803FAA6@gmail.com> Reply-To: Ergus Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19854"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 70794@debbugs.gnu.org, Eli Zaretskii To: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jun 03 16:43:13 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 1sE8u0-00051g-Ac for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 03 Jun 2024 16:43:12 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sE8tg-0004pW-8h; Mon, 03 Jun 2024 10:42: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 1sE8te-0004pL-CD for bug-gnu-emacs@gnu.org; Mon, 03 Jun 2024 10:42: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 1sE8td-0007Kn-Qf for bug-gnu-emacs@gnu.org; Mon, 03 Jun 2024 10:42:50 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sE8tq-00068y-ED for bug-gnu-emacs@gnu.org; Mon, 03 Jun 2024 10:43:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ergus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 03 Jun 2024 14:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70794 X-GNU-PR-Package: emacs Original-Received: via spool by 70794-submit@debbugs.gnu.org id=B70794.171742573123547 (code B ref 70794); Mon, 03 Jun 2024 14:43:02 +0000 Original-Received: (at 70794) by debbugs.gnu.org; 3 Jun 2024 14:42:11 +0000 Original-Received: from localhost ([127.0.0.1]:42166 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sE8t0-00067j-Ke for submit@debbugs.gnu.org; Mon, 03 Jun 2024 10:42:11 -0400 Original-Received: from sonic304-9.consmr.mail.bf2.yahoo.com ([74.6.128.32]:42250) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sE8sv-000679-Cc for 70794@debbugs.gnu.org; Mon, 03 Jun 2024 10:42:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1717425706; bh=LqeSL4Cyd+AE/3eKu8wZW8drFcemGfU8f7ZzN3d+l4A=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From:Subject:Reply-To; b=B9xtY7u7zlAoSwIApygFD/irgcicPUHGdbBfpxcHT9Z1XiWFgFFhS+oAaBiwWYbp80ASwZ+gxeBNrgsOcZJ5xLD6bLyO/QzNmYdVsUottt+WkOTULTxAy2oghF0j34VUM1SQs+OjOMlgPnsnAexB5kVOv+WW/VoWqBE4ZqwmPgRTc8oG/vB7rUzFsKu24QnVKhEZKMLQDPuTZ7SIoeae3XGXFo/1yCTFYnCz3OlZdVuFamtpxqVWfZqrcxvcHgRcOEwGqmQ3Pwlm0exfHaI1HBESg2AIBGYsoROgQONpbmDvKRq/dm6TZ4GWmQVjCpNDb0RKN16lhcolTG0S9WZ/BQ== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1717425706; bh=S9rIsi4zwZeNFBTvs0FcknEQmhYgki6MiXdbk1XppTq=; h=X-Sonic-MF:Date:From:To:Subject:From:Subject; b=TDNcSf6u+Ks0K4X06sepnHWUyXWbnvkz/ZpQ8TuZe21aL52gWjRMuwpR4IheIrUPpKi2emcSPiIKaYnHAgKJyoWagqYnrZCZID7S8PAnC96j8xkshrVe9xVHqOHvlfh++ISs2yXFGZCCQWLWdGTt0FkP5gH1reYm3Lun5W0KL+QvraNhQAlJeB/g6WNYULIb8/E6jwF6isYa7HW+JtTXJW7InHcJnsiIUyqeUQhFoCBiT0Dy5ks/pKKvqmVTyZxLdU8xnU09PJcgjZU47bQrC9ZR4nOqHXlwGb5WDBk+Tgm35zkxypDkZmDrXvORuevLIzjifzYRiXdy4XnpYV/n1A== X-YMail-OSG: qopc81IVM1lqWuWM21lK.TWSOI5mTBJg0uiLS9V_Z89LyTPSkEybPSCWokRt9Ya MOAK629gwLWXAJwLeW8YQO_rBnrYucQFCejx0OCus2TkWDolF1TIBKgUuaU7nwlZkjRNiIsVwVUi .AGbRblo3dxaaJTA7UOjkWmo916x8.iy6u0M6VoWiDlD6p_rkCj2qYJUkm4XfKn0w39_I04Eqp8Q IR1XymBcNcz.wfzYY712S8QdLc4Jc8XifK38q_DQF.O.Mmln267psARuai9sDpM9YWNWVIsWrn6R azNPHurVhPAuQU7sYwRCWFfQ33qOu04G6RltMaS4dnav1Ah4QObuJqnPmEyVp4AVlmgTXgEnyPhb j6NlwbeTUlxnD3EaZjZIMOx2MXNrtHs2bJCo8smAxm77KF_E2vY.6b86MIF4mEUchE6EpeqtPaNh TTzLK3X46pqO7.zdEzF7hEPGI9DChjKZsKDjm6MSEwUqedx04DQc6T_rpUmAmgqHt6Uc44e7xrEy 33wnwB80DfBxIVAbUtuoik_7AbakagV9zMrEAWeluaHWUwVS8fk4NNsj9odN36rN6IFzyYVe8CSt KU014_3MTxfvvjRliXA7a4Odf8LFfOAFvY3XBoHYu6bvcl0pgt3dcvQG5p6zrv4n3VJtzLmq.jiX Y83cZzOQm9i5jZt_yB2KVFKc4PN84M7X1ADHzVKkZjbxHs3.RapETuhfMy2K2TmWAKg3VJPEbrCx zM.HlWIyXVr7L3A6WWaPRgE0YYnKdLjh8q60i4DqZXZV5xSMFLQznQ9me_cqZ3QOoULfBU87Es7C eUyYjjLsQtGwf4xYAK5GC201qEFdrbj3PJMSd1zVvS X-Sonic-MF: X-Sonic-ID: 98ae122f-9704-441f-b758-2be3bafca6cd Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic304.consmr.mail.bf2.yahoo.com with HTTP; Mon, 3 Jun 2024 14:41:46 +0000 Original-Received: by hermes--production-ir2-7b99fc9bb6-24wkz (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID a7689670f10cb2a290a17411c2812904; Mon, 03 Jun 2024 14:41:44 +0000 (UTC) Content-Disposition: inline In-Reply-To: <16667D6C-F897-4A85-8C7A-0FA2E803FAA6@gmail.com> X-Mailer: WebService/1.1.22407 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.aol 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:286446 Archived-At: Hi Mattias: Thanks for your interest on this. As I said in my first message I just proposed what I have locally, but I didn't intent to insert the regex there as it was. On Fri, May 31, 2024 at 07:15:52PM GMT, Mattias Engdeg�rd wrote: >Ergus, thank you for your contribution! Some questions, if you don't mind: > >* There aren't any tests. If you care anything at all about your pattern working, and keep working, you should add some. > >We'll help you out, of course, but it's probably best if you give it a go yourself first so that we know exactly what you want to match. Take a look at compile-tests.el, `compile-tests--test-regexps-data`. You will also need to increase the expected counts at the end of `compile-test-error-regexps`. > Actually Eli added this commit with the poor information I provided in my mails because I don't have time to do it myself these days. Sorry for not being more specific. I actually expected someone else more "rusty" to provide more complete information (I actually does not use rust with emacs very often) >* The regexp doesn't match the variant with error code inside square brackets, the > >error[E0425]: cannot find function `ruun` in module `broot::cli` > >kind of message. Surely you intended it to? > You are right, Checking my local version I have a \\(\\[.+\\]\\)? before the : in my pattern, not sure when I added that since my first mail. >Here is your regexp again, translated to rx and with line numbers for >ease of discussion: I don't really understand the rx notatio :/ but I will try > >1 (rx (| (group-n 4 "error") (group-n 5 "warning")) >2 ":" >3 (+? (not (in "\x00"))) >4 "--> " >5 (group-n 1 (+ (not (in ":")))) >6 ":" >7 (group-n 2 (+ digit)) >8 ":" >9 (group-n 3 (+ digit))) > >* (Line 1): From the examples it appears that the messages start at the >beginning of a line. We very much prefer to anchor matches for reasons >of performance and to avoid collisions with other patterns. How about >we add a line-start anchor at the very beginning? > It is ok. Probaly you may want to add also a line-end >* (Line 3): This is an open-ended expression which will merrily match >just about anything including newlines. This can become very >expensive. And where does that NUL come from? > The NUL is actually negated to match anything up to the --> >In the examples you supplied, the message is on the first line, and the " --> " on the start of the second. Can we rely on that? If not, what can we rely on? > I think yes; that's at least what I tried to match. If you have a better/more efficient alternative fell free to change it. >* (Line 5): This excludes Windows file names which can include colon or do cargo messages have a special notation for those? In any case, it's usually a good idea to exclude newline as well to prevent a runaway repetition. > In this case I think not, because the filename is always relative in cargo and on MSWindows the colon comes after the drive in absolute paths right? But I could be wrong. >* Both the rust-mode and rustic packages appear to include regexps that match the same messages. How do they compare to yours? > You can take those indeed. I think they must be pretty much equivalent and probably more complete because they probably match the "note:" case which I preferred to ignore as emacs does not have an equivalent for that. IIRC they just don't use numeric capture groups, which I like a bit more t avoid weird errors, but at the end the regex is pretty simple, any alternative is fine. >What is the effect of someone using those modes with your regexp in Emacs? > > IIUC the packages pushes the entries in front of compilation-error-regexp-alist-alist, so in principle their regexp will match first and the loop stops. So, the main changes you propose are something like: "^\\(?:\\(?4:error\\)\\|\\(?5:warning\\)\\)\\(?:\\[.+\\]\\)?:[^\0]+?--> \\(?1:[^:]+\\):\\(?2:[[:digit:]]+\\):\\(?3:[[:digit:]]+\\)"