Subject: Re: bug#50470: 27.1; 'company-mode' 'eshell'

From: Stefan Monnier <[email-masked]>
Date: Sun, 19 Mar 2023 21:34:52 -0400

>> Ok, here we are.
>>> -  (when (memq (char-after) eshell-glob-chars-list)
>>> +  (when (and (not (bound-and-true-p eshell-parse-for-completion-p))
>>
>> Can we (cheaply) arrange so that the var is always defined at this
>> point (same for the other uses further down in the patch)?
>> Maybe by moving the `defvar` elsewhere (e.g. next to
>> `eshell-parse-argument-hook`)?
>
> It's a bit ugly, but I'm trying to follow the conventions in Eshell: since
> completion is an optional extension module for Eshell, other modules jump
> through hoops like this to allow the module to be not-loaded.

I definitely don't want to force preloading that module.
But maybe that var could have a meaning that's independent
from completion, thus justifying to move it out of the completion
extension module?

E.g. something like "keep parsing free of side effects"?  This would also
have the benefit of clarifying the actual meaning of this var: defining
a var based on who uses it or how it's used is always a source of
trouble.

> Another way to do this (arguably more Eshell-y) would be:
>
>   (when (and (eshell-using-module 'eshell-cmpl)
>              eshell-parsing-for-completion)

`boundp` is definitely much better.

        Stefan