GNU bug report logs -
#47408
Emacs etags support for Mercury [v0.2]
Previous Next
Reported by: fabrice nicol <fabrnicol <at> gmail.com>
Date: Fri, 26 Mar 2021 08:28:02 UTC
Severity: normal
Tags: patch
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
Message #22 received at 47408 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Attached is the new patch that integrates your indications.
Please note two points:
1. Now that -m/-M have been done with, there is no use specifying any
Mercury-specific behavior for --no-defines.
Actually the Mercury community consensus is that all declarations should
be tagged in any case.
So --no-defines is just the default behavior of etags run without any
option and does not need to be used explicitly or specifically documented.
I followed your indications about --declarations. I also added a line to
etags.1 about --language=mercury or --language=objc, should the
heuristic test fail to detect the right language. Note, however, that
removing language-specific options comes at a price. The heuristic test
has now to be more complex. I had errless detection results against my
test base of 4,000 mercury files and 500 Obj.-C files. This looks
satisfactory but I had to tweak the heuristic test function
(test_objc_is_mercury) quite a bit to weed out detection failures.
I added the ChangeLog, the requested test file (array.m) under
test/manual/etags/merc-src and altered the corresponding Makefile
accordingly.
2. I removed by added line to speedbar.el, which in the end did not
prove very useful. It is located in a Xemacs compatibility layer that is
no longer used by most users.
Le 28/03/2021 à 18:22, Eli Zaretskii a écrit :
>> From: fabrice nicol <fabrnicol <at> gmail.com>
>> 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.
[0001-Add-etags-support-for-Mercury-v0.4.patch (text/x-patch, attachment)]
This bug report was last modified 3 years and 338 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.