Open joeyjyliu opened 4 weeks ago
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")
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.
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: