emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Tim Cross <theophilusx@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: How to get shell source blocks to read my profile?
Date: Tue, 16 Mar 2021 06:53:11 +1100	[thread overview]
Message-ID: <87czw02mws.fsf@gmail.com> (raw)
In-Reply-To: <CA+pajWLeRt=adkVz_QiQ1p=8t-mxfHjSQmSH+newsf+9a8Y-ZQ@mail.gmail.com>


George Mauer <gmauer@gmail.com> writes:

> Thanks a lot! The interactive/non-interactive was indeed the core issue. Extra frustrating because it seems like supplying `--rcfile` does nothing if you
> *do* use `-c` but *don't* use `-i`...ah ad-hoc cli design.
>

It certainly can seem rather ad hoc. However, it actually makes sense on
some levels. If you use -c your telling the shell to execute a command
and then exit. By definition, this is non-interactive. This is covered
in the manual.

Where it becomes confusing is when your mixing in different options as
some override others. So, provided you include -i with -c, it will be
forced into interactive i.e. -i overrides the non-interactive status
added with -c. If you add -s, telling the shell to read input from
stdin, you also override non-interactive status.

The other possible solution to your situation is to ensure
Emacs runs inside an environment which has all your exported variables
i.e. inside your login shell environment. There are a few ways to do
this, but probably the easiest is to create a script which opens a login
shell, then calls Emacs (may need to use open - not sure) and Emacs will
inherit your environment. Advantage is that processes you then spawn
from within Emacs will also inherit that environment. You then add this
script as the executable in the dock rather than calling Emacs directly.

One thing to watch out for is that if your also using oh-my-zsh, it
setups up some aliases with the name emacs which actually call
emacsclient. This can be confusing as it means running just 'emacs' in
the shell will run the alias and not actually run Emacs directly. Things
can be even more confusing as there are also multiple ways to install
Emacs on the mac and they are all slightly different with respect to how
they setup things.

What I find hardest with writing shell stuff is that I simply don't seem
to do it much anymore. My brain cache is just too small and when I find
it necessary to write a shell script again, all that knowledge has been
flushed! Once upon a time, many moons ago, I could write shell scripts
that used sed, awk, cut, uniq etc without even needing to look at the
man pages. These days, I have to check the bash man page just to
remember what the expr operators are!

--
Tim Cross


  reply	other threads:[~2021-03-15 20:25 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 [this message]
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
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=87czw02mws.fsf@gmail.com \
    --to=theophilusx@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).