From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#47408: Etags support for Mercury [v0.3] Date: Sun, 28 Mar 2021 19:22:15 +0300 Message-ID: <83o8f3meo8.fsf@gnu.org> References: <5ba2fec3-3f61-fb7e-35eb-7188fa6064a4@gmail.com> <834kgvo220.fsf@gnu.org> <97f573da-ec63-7362-13c2-ca28a6634480@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35600"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 47408@debbugs.gnu.org To: fabrice nicol Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Mar 28 18:23:27 2021 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 1lQYCE-0009A3-Lj for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 28 Mar 2021 18:23:26 +0200 Original-Received: from localhost ([::1]:54340 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lQYCD-0006MZ-Id for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 28 Mar 2021 12:23:25 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60120) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lQYBs-0006Lj-EL for bug-gnu-emacs@gnu.org; Sun, 28 Mar 2021 12:23:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:35320) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lQYBq-0005vP-GA for bug-gnu-emacs@gnu.org; Sun, 28 Mar 2021 12:23:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lQYBq-0000nh-C7 for bug-gnu-emacs@gnu.org; Sun, 28 Mar 2021 12:23:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 28 Mar 2021 16:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47408 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 47408-submit@debbugs.gnu.org id=B47408.16169485343007 (code B ref 47408); Sun, 28 Mar 2021 16:23:02 +0000 Original-Received: (at 47408) by debbugs.gnu.org; 28 Mar 2021 16:22:14 +0000 Original-Received: from localhost ([127.0.0.1]:46866 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lQYB4-0000mQ-0w for submit@debbugs.gnu.org; Sun, 28 Mar 2021 12:22:14 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:38754) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lQYB2-0000ly-6L for 47408@debbugs.gnu.org; Sun, 28 Mar 2021 12:22:12 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:55002) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lQYAx-0005XY-0N; Sun, 28 Mar 2021 12:22:07 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:4948 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1lQYAw-0002nN-EK; Sun, 28 Mar 2021 12:22:06 -0400 In-Reply-To: <97f573da-ec63-7362-13c2-ca28a6634480@gmail.com> (message from fabrice nicol on Sun, 28 Mar 2021 17:49:20 +0200) 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" Xref: news.gmane.io gmane.emacs.bugs:203188 Archived-At: > From: fabrice nicol > Date: Sun, 28 Mar 2021 17:49:20 +0200 > > I left this couple of options in (following Francesco Potorti only for long options --declarations/--no-defines), > for two reasons: > > 1. The ambiguity between Objective C and Mercury > > Both languages having the same file extension .m, it was necessary to add in a heuristic test function, in the > absence of explicit language identification input from command line. > > Yet all heuristics may fail in rare cases. Tests show a fairly low failure rate on the Mercury compiler source > code. Less than 0.5 % of .m files are not identified as Mercury files by the test (this should have been > documented somewhere). File concerned by test failure are some Mercury test files and documentary test > files with only (or almost only) comments and blank lines. > > While this could be improved by tweaking the heuristic test, it would make it more complex, bug-prone and > ultimately hard to maintain. > > So -m/-M are useful to deal with these rare files, as they do not rely on the heuristic test function at all but on > their own semantics, which explicitly identifies Mercury. > > The only alternative I see is to explicitly warn users about adding '-l mercury' to command line when using > long options (in etags.1 and possibly other docs). I think "-l mercury" is indeed the way to tell etags this is a Mercury source. We never had language-specific options in etags, and I don't see a serious enough reason to introduce them now. I do find it unfortunate that Mercury uses the same extension as ObjC, but that's water under the bridge. Of course, if the heuristic test could be improved to make it err less, it would also be good. > diff --git a/lisp/speedbar.el b/lisp/speedbar.el > index 12e57b1108..63f3cd6ca1 100644 > --- a/lisp/speedbar.el > +++ b/lisp/speedbar.el > @@ -3534,6 +3534,8 @@ speedbar-fetch-etags-parse-list > speedbar-parse-c-or-c++tag) > ("^\\.emacs$\\|.\\(el\\|l\\|lsp\\)\\'" . > "def[^i]+\\s-+\\(\\(\\w\\|[-_]\\)+\\)\\s-*\C-?") > + ("^\\.m$\\'" . > + "\\(^:-\\)?\\s-*\\(\\(pred\\|func\\|type\\|instance\\|typeclass\\)+\\s+\\([a-z]+[a-zA-Z0-9_]*\\)+\\)\\s-*(?^?") > ; ("\\.\\([fF]\\|for\\|FOR\\|77\\|90\\)\\'" . > ; speedbar-parse-fortran77-tag) > ("\\.tex\\'" . speedbar-parse-tex-string) > > What about ObjC here? or are these keywords good for ObjC as well? > > has the following reply: Objective C .m files are not parsed by speedbar.el in current repository code, so the > added feature does not break anything. Issues will only arise if/when Emacs maintainers for Objective C > support decide on adding this file format to the speedbar parser. It would be premature (and out-of-place) > for me to settle this on my own. Should this move happen, the heuristics used in etags.c (function > test_objc_is_mercury) could then be ported to elisp code. OK, so please add there a comment to say that .m is also Objective C, but Speedbar doesn't support it yet. Thanks.