emacs-devel
[Top][All Lists]
Advanced

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

Re: TAGS completion with (setq-local completion-ignore-case t)


From: Eli Zaretskii
Subject: Re: TAGS completion with (setq-local completion-ignore-case t)
Date: Sat, 09 Mar 2024 16:36:32 +0200

> Date: Sat, 09 Mar 2024 16:26:35 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: emacs-devel@gnu.org
> 
> > Setting tags-case-fold-search to t (buffer-local or not) doesn't seem to
> > have any effect when completion-ignore-case is also set to t.
> > 
> >   emacs -Q --eval "(progn \
> >                      (pop-to-buffer (get-buffer-create \"test\")) \
> >                      (setq-local completion-ignore-case t) \
> >                      (setq-local tags-case-fold-search t) \
> 
> Don't use setq-local, use setq.  Or let-bind it, like this:
> 
>   (progn
>     (pop-to-buffer (get-buffer-create "test"))
>     (let ((tags-case-fold-search t))
>       (insert "is")
>       (complete-tag)
>       (complete-tag)))
> 
> > I would still need to set completion-ignore-case to t because that is
> > still relevant for other capf backends for the buffer (but not for all
> > buffers).
> 
> That's fine, and should not interfere.

Actually, I take that back: you are well advised NOT to give
completion-ignore-case buffer-local bindings.  That's because many
Emacs commands let-bind that variable to produce the desired behavior,
and let-binding of a buffer-local variable can have strange effects
when the code inside the let-binding switches to a different buffer
(as etags commands do, because they switch to the TAGS buffer).

Why exactly do you need to have a buffer-local value of
completion-ignore-case?  This is not a user option, and is meant to be
either set globally or let-bound for specific code.

> > It also pretty strange that setting completion-ignore-case to t has done
> > the opposite of what it advertises.

That's the effect of what I describe above, I think.



reply via email to

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