emacs-orgmode
[Top][All Lists]
Advanced

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

Re: How to get shell source blocks to read my profile?


From: Nick Dokos
Subject: Re: How to get shell source blocks to read my profile?
Date: Tue, 16 Mar 2021 12:49:14 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

George Mauer <gmauer@gmail.com> writes:

> I understand why you say that maxim but testing that this worked was the 
> first thing I did
> and it does work. I was surprised as well. I haven't debugged all the way 
> into the eval
> functions to see why this works but my guess is that the authors were pretty 
> smart about
> figuring out which executable to invoke.
>

Starting with `emacs -q' I evaluate

    (setq shell-file-name "bash -i")

in the *scratch* buffer and then do `M-x shell'. I get

    apply: Searching for program: No such file or directory, bash -i


If I do

    (setq shell-file-name "/bin/bash -i")

I get

    emacs: /bin/bash -i: No such file or directory

    Process shell exited abnormally with code 127

The trouble is that `shell-file-name' may be used much more widely than you 
expect.

> As for the problem I'm trying to solve, there isn't one exactly. This is more 
> me hacking on
> something I don't fully understand because it regularly trips me up.
>
> I do still wonder what would be the disadvantage of just configuring it to do 
> --login by
> default and doing all configuration in profile scripts. It would be 
> unconventional yes, but
> it would also make dynamic scoping of environment variable effectively opt-in 
> via
> --noprofile rather than opt-out (which imo is how it should be). I would 
> assume that uses
> extra resources or risks improperly handling crashed processes, but I can't 
> find anything to
> that effect in the docs
>
> On Tue, Mar 16, 2021, 07:32 Maxim Nikulin <manikulin@gmail.com> wrote:
>
>     On 16/03/2021 00:49, George Mauer wrote:
>     >    shell-file-name: "/bin/zsh -i"
>    
>     I am afraid, you should be prepared to face some problem accidentally.
>     The value of this variable is used to execute the specified file
>     ("zsh -i" in the "/bin" directory, I do not think, you have such file),
>     not as a part of shell command. shell-file-name in namely file name to
>     be executed with shell-command-switch as first argument (separate
>     arguments, not merged into a string) to run shell commands (next 
> argument).
>    
>     Environment variables could be set on OS level, inside emacs
>     https://www.gnu.org/software/emacs/manual/html_node/emacs/Environment.html
>     , etc. It is hard to suggest something since you have not described the
>     problem you are trying to solve. Tim in details explained why you
>     attempt to solve it did not work, but the problem (or the goal) is still
>     unknown.
>

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




reply via email to

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