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: Steven Harris
Subject: Re: How to get shell source blocks to read my profile?
Date: Tue, 16 Mar 2021 11:52:47 +1100

Well on my mac Emacs is launched by Ruby.  I remember having to allow ruby to do that two years ago when I set this up.

But thanks for sharing your expertise.  I've been a unixy admin for 20 years and didn't know a lot of that.

Cheers

Steven.

On Tue, 16 Mar 2021 at 07:34, Tim Cross <theophilusx@gmail.com> wrote:

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 via email to

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