emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Dokos <ndokos@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: How to get shell source blocks to read my profile?
Date: Tue, 16 Mar 2021 12:49:14 -0400	[thread overview]
Message-ID: <87zgz36o39.fsf@alphaville.usersys.redhat.com> (raw)
In-Reply-To: CA+pajWKMB36iFd38O+d_uDPsiH73WfbrRy7N7qh9wXP-MM1S=A@mail.gmail.com

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	other threads:[~2021-03-16 16:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-14 21:30 How to get shell source blocks to read my profile? George Mauer
2021-03-14 21:51 ` Tim Cross
2021-03-15  2:35   ` George Mauer
2021-03-15  3:02     ` Tim Cross
2021-03-15 17:49       ` George Mauer
2021-03-15 19:53         ` Tim Cross
2021-03-16  0:52           ` Steven Harris
2021-03-16 12:20         ` Maxim Nikulin
2021-03-16 13:21           ` George Mauer
2021-03-16 16:49             ` Nick Dokos [this message]
2021-03-16 20:32             ` Tim Cross
2021-03-18 14:59             ` Maxim Nikulin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zgz36o39.fsf@alphaville.usersys.redhat.com \
    --to=ndokos@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).