GNU bug report logs - #70847
29.3; eshell scripts "from anywhere"

Previous Next

Package: emacs;

Reported by: Christopher Howard <christopher <at> librehacker.com>

Date: Thu, 9 May 2024 17:59:01 UTC

Severity: normal

Found in version 29.3

Done: Jim Porter <jporterbugs <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Jim Porter <jporterbugs <at> gmail.com>
To: Christopher Howard <christopher <at> librehacker.com>
Cc: 70847 <at> debbugs.gnu.org
Subject: bug#70847: 29.3; eshell scripts "from anywhere"
Date: Tue, 28 May 2024 17:31:02 -0700
On 5/28/2024 3:49 PM, Christopher Howard wrote:
> (1) Regarding eshell-execute-file:
>   (a) command executes as expected when called as a normal function
>   (b) it would seem highly desireable for this to be an interactive function as well. Though of course you'd have to think through exactly how you wanted to handle ARGS and DESTINATION during an interactive call.

Thanks for trying out the patches.

I've gone back and forth on whether to make this function interactive. 
On the one hand, it could be convenient, but on the other hand, calling 
'eshell-command' interactively should also work: if you type "source 
my-file.esh arg1 arg2..." at the 'eshell-command' prompt, that would do 
more-or-less the same thing as calling 'eshell-execute-file'. You could 
even add "> destination" to the end to redirect the output somewhere, 
e.g. to a buffer.

> (2) I'm having trouble testing the eshell-batch-file functionality. I created a script like so:
> 
> ```
> #!/home/christopher/local/bin/emacs --batch -f eshell-batch-file
> echo bleep
> ```
> 
> When I try to run this, the correct emacs gets launched (the patched one) but emacs also tries to load my local init.el file - the one written for my 29.3 install - which leads to a backtrace as certain things don't load correctly. My understanding was that --batch is supposed to prevent local init files from being loaded.
> 
> I tried adding -Q to the shebang line but that doesn't seem to have an effect.

You'll probably need to use "env -S" in the shebang to split the args. 
Shebangs treat everything after the first word as a single argument, so 
Emacs sees "--batch -f eshell-batch-file" all together.

Something like this should work (I hope):

  #!/usr/bin/env -S /home/christopher/local/bin/emacs --batch -f 
eshell-batch-file




This bug report was last modified 1 year and 51 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.