Subject: Re: bug#68074: eshell sudo/doas does not work for aliases
From: Jim Porter <[email-masked]>
To: Alfonso Sanchez-Beato <[email-masked]>, Stefan Kangas <[email-masked]>
Cc: [email-masked]
Date: Sat, 27 Jan 2024 12:24:46 -0800
List-Id: <debbugs-submit.debbugs.gnu.org>

On 1/27/2024 12:46 AM, Alfonso Sanchez-Beato via Bug reports for GNU 
Emacs, the Swiss army knife of text editors wrote:
> 
>   En sábado, 27 de enero de 2024, 01:19:32 GMT, Jim Porter <[email-masked]> escribió:
>> ... actually, this is a more-complete patch. I'm not 100% sure about
>> this part though:
>>
>>    ',(car args)
>>
>> That (usually) creates something like (quote "command"), but it's safer

I thought about this some more and the extraneous quoting is fine in my 
opinion. Eshell already does that quite a bit in 'eshell-do-eval', so 
what's one more case?

> This last patch works nicely, thanks a lot! It works also in cases where my patch was not, like:
> 
> $ eshell/sudo VAR=val <alias> ...

Wait, that works?! (After trying it out locally, so it does!)

Looking at the code, I see why now: 'eshell-named-command' calls 
'eshell-prepare-command-hook', and that hook is where we handle local 
variables. However, I truly didn't expect that; I thought the local 
variable handling occurred in an earlier phase. The more you know...

Anyway, since this works even better than I'd expected, I've now merged 
my patch to the master branch as 3c680968e49. Closing this bug now.