Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tags: warn if citre-locate-tag fails to find regexp within search-limit #175

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

joeyjyliu
Copy link

It'd be nice to warn the user the attempt to locate the tag by regexp has failed probably due to the search limit; otherwise it's quite confusing to have the buffer ending up with:

  • the point on the first occurrence of the name (a hit on the name only within the search-limit). It could be among some random comment text.
  • the point in the beginning of the buffer (no hit at all on the name only within the search-limit).

@AmaiKinono
Copy link
Member

Thanks for the PR!

It would be nice to warn the user, but there are 2 problems in the current implementation.

First, the search fails because of an outdated tags file / global database. We should guide the user to regenerate it, rather than to increate citre-tag-pattern-search-limit.

And, sometimes citre-locate-tag is called on a list of tags. For example, in citre-xref--get-linum, citre-imenu--make-index-item, which is called iteratively on a list of tags. In a bad situation, this means there will be a lot of messaging.

A better way is to let citre-locate-tag return an extra status, telling us if search by pattern fails. Then its caller could decide what to do based on that. This may be some boring repetitive work, so I can do it if you are not willing to.

An extra tip: You could break a string like this:

(message "Regexp not found but the buffer size is larger than \
citre-tag-pattern-search-limit; Consider increasing it")

@joeyjyliu
Copy link
Author

Thanks for the comments! Please feel free to implement the way you feel most suitable. My use case is limited (only ctags and one ctags file) so I'm probably not the best person to implement a general enhancement here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants