[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#37820: 25.2; xref using etags incorrect case fold during completion
From: |
Radey Shouman |
Subject: |
bug#37820: 25.2; xref using etags incorrect case fold during completion |
Date: |
Thu, 26 Dec 2019 15:56:07 -0500 |
Dmitry Gutov writes:
> Hi Radey,
>
> sorry for the late reply.
Not at all.
> On 25.10.2019 16:59, Radey Shouman wrote:
> > The only variable I customize is tags-case-fold-search, I leave
> > completion-ignore-case with the default value. I heartily regret
> > even mentioning the latter variable, it is a red herring.
>
> Don't regret it because it's entirely pertinent.
>
> So, do we really have meaningful scenarios where the user will want
> tags-case-fold-search set to t while completion-ignore-case *should*
> remain nil?
No. I believe that completion-ignore-case should always be bound to
the value of tags-case-fold-search when doing a tags completion. If
this is not so then completion is not consistent with the tags search,
which is the bug in question.
> I suppose we could add a new method to xref backends just for that, but
> we shouldn't do that without understanding the use cases. Like, why/how
> other backends would choose to return different values.
>
> > There are at least two reasons to change tags-case-fold-search:
> >
> > 1) Some programming languages are not case sensitive in normal use,
> > eg Common Lisp, Fortran, Cobol, R[45]RS Scheme ... For these languages
> > case-insensitive search should be the default.
>
> How does using one or the other variable help with that distinction?
>From what I could see searching the lisp tree, tags-case-fold-search
is intended for user customization of tags search (and partly carried
over to xref). completion-ignore-case is used for dynamic control of
completion, and is not a sensible variable for user customization.
> When someone uses tags, they often use them with a multitude of
> languages. Whether you employ tags-case-fold-search, or an xref-specific
> variable Eli suggested to add, that would affect all languages anyway,
> right?
Yes. It is possible to mix languages even in a single tags table.
Personal preference also plays a role.
> > 2) For many code bases the rules of CamelCasing are so vague, or their
> > observance so lax, that it's hard to predict what the capitalization
> > of an identifier will be. It's useful in these cases to use
> > completion that is not case sensitive.
>
> We can make completion-ignore-case a safe local variable, so that you
> can set it in dir-locals depending on the code base.
I'm not sure that's useful, because the default value of
completion-ignore-case is hardly ever used. For example, even
if ignoring case for tags searches, one would probably not want to
ignore case when completing input for describe-key.
On the other hand, it might well be useful to make
tags-case-fold-search or any xref replacement a safe local variable.
BTW, how might one find the list of safe local variables?
--