[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ELPA] New package: mctags

From: chen bin
Subject: Re: [ELPA] New package: mctags
Date: Fri, 13 Oct 2017 12:39:54 +1100

On Fri, Oct 13, 2017 at 3:13 AM, Eli Zaretskii <address@hidden> wrote:
>> From: chen bin <address@hidden>
>> Date: Fri, 13 Oct 2017 00:24:17 +1100
>> - If there are multiple matches, you can filter the candidates in candidate 
>> window.
> I think xref-find-definitions, when it uses the etags back-end,
> already supports that, doesn't it?
I've been using xref for some time. As I can see, it just gives your
the list of matches in a buffer. It can't filter further with pattern
or negative pattern or combination of patterns.

For example, I can filter candidates in mctags with
"keyword1\|keyword2 !keyword3" (matching either "keyword1" or
"keyword2" but not keyword3)
>> - the tags file is automatically created in current project.
> Yes, but AFAICT, the package uses a somewhat naïve way of generating
> TAGS, in effect passing all the non-trivial file names to etags.  Some
Good question. For tags creation, mctags now focus on out of box
userexperience (For example, by default, `*.o`, `*.elc` are ignored`).
Extra option could be added to tweak ctags cli in the future. But it's
totally fine if you use mctags only for code navigation and leave TAGS
creation to other solutions.

Please note mctags RESPECTS the existing tags file created by other
solutions. mctags will NOT override existing TAGS created by other
programs (Makefile, for example) without user's confirmation.

> projects might use more sophisticated methods, for example see what
> src/Makefile does in Emacs to tag both the Lisp and the C names of the
> Emacs primitives.
Please note mctags RESPECTS the existing tags file created by other
programs. It's IMPOSSIBLE mctags will override existing TAGS created
by other programs (Makefile, for example) without user's confirmation.

>> - if no match found, fallback to `mctags-grep` to grep in current project. 
>> So you should always found matched
>> string
> But the matches found this way are not necessarily definitions, they
> can be references.
If definition is found, the grep will not be called. One reason I need
this is that the TAGS might not be updated for the latest code change
yet. Please note the UI make user clear that by displaying message "NO
tag found. Now you are seeing grep results" at the top of candidate

>> - Improvement on performance (for example, ripgrep is automatically used as 
>> grep program if installed. GNU
>> grep is fallback grep program)
> Well, finding a tag via etags.el doesn't require Grep at all.
Grep is called if and only if mctags-find-tag fails.  It's a useful
feature when TAGS is not updated yet.

For example, when I'm focusing on coding, I run `M-x find-tag` but no
matches found. I've to stop to ask myself: "What' wrong? Did I forget
to add definition? Or TAGS is not updated yet? Should I wait for ctags
to finish updating? Or should I manually restart ctags process?". I'm
forced out of "Flow" status by a simple "No matches found" message
because too many questions popup. But in mctags, we display "No tag
found" message PLUS the grep results. So I don't need THINK, I just
TAKE ACTION to filter grep results.

In my practice, this is huge productivity boost.
>> - tags file could be automatically updated when user save current file.
> Is this really a good idea?  Updating TAGS means you need also revisit
> it, which could be a problem in some complex setups, when there's more
> than one tag table active at the same time.  OTOH, etags.el is written
> in a way that makes frequent updates of TAGS unnecessary.

Some people might preferring TAGS auto-updating instead of manually
running ctags from time to time. Anyway, TAGS auto updating is not
enabled by default. So it will not conflict with your current
ctags/etags setup. You can safely use `mctags-find-tag` without any
worries on conflicts with other packages. At minimum, we give the
users an extra option to update TAGS. Users have freedom to choose
between these options.

mctags is especially newbie friendly. Open `mctags.el`, `eval-buffer`,
then `M-x mctags-find-tag-at-point`, that's enough. You don't need
even create TAGS file manually.

help me, help you.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]