unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Patrick Mahan <plmahan@gmail.com>
To: "Rudolf Adamkovič" <salutis@me.com>
Cc: Help Gnu Emacs <help-gnu-emacs@gnu.org>
Subject: Re: PWD is not seen by my emacs installation
Date: Wed, 30 Aug 2023 16:43:51 -0700	[thread overview]
Message-ID: <CAFDHx1LSafikmccCAwO_xDFhC4LRR7ckc+q+v8EpGeZAdQcdLA@mail.gmail.com> (raw)
In-Reply-To: <m2wmxc2mgb.fsf@me.com>

Thanks for sharing.

Patrick

On Wed, Aug 30, 2023 at 3:30 PM Rudolf Adamkovič <salutis@me.com> wrote:

> Patrick Mahan <plmahan@gmail.com> writes:
>
> > Hardware -
> >
> >    Macbook Pro 14" (Apple M1 Pro)
> >    Mac OS 13.1 (Ventura)
>
> I am on the same system, with the same
> problem, and I solved it as follows...
>
> From my literate configuration file:
>
> [...]
>
> Copy the =$PATH=, =$MANPATH=, and =LC_ALL=
> variables from the interactive login shell to
> Emacs.  This is necessary on macOS, as its
> GUI starts programs within a minimal
> environment.
>
> In practice, this fixes various problems,
> such as the =*compilation*= buffer not
> finding =emacs=, =fortune= not finding
> =strfile=, =geiser-mode= not finding =guile=,
> =emacs= not finding =gcc= for native
> compilation, as well as, spurious =locale=
> warnings.
>
> #+BEGIN_SRC emacs-lisp :eval no :tangle ~/.emacs
> (when (eq window-system 'ns)
>   (defun shell-get-environment-variable+ (variable)
>     "Return the value of VARIABLE from login shell."
>     (shell-command-to-string
>      (format "$SHELL --login -c 'echo -n $%s'" variable)))
>   ;;
>   ;; Set the path variable.
>   (let* ((path "PATH")
>          (path-value (shell-get-environment-variable+ path)))
>     (setenv path path-value)
>     (setq exec-path (split-string path-value path-separator)))
>   ;;
>   ;; Set the locale.
>   (let* ((variable "LC_ALL")
>          (variable-value (shell-get-environment-variable+ variable)))
>     (setenv variable variable-value)))
> #+END_SRC
>
> P.S. 1: My code launches the login shell
> twice instead of once, which is something to
> improve.
>
> P.S. 2: It would be useful to have a command
> that does this in vanilla Emacs.
>
> Rudy
> --
> "Programming reliably -- must be an activity
> of an undeniably mathematical nature […] You
> see, mathematics is about thinking, and doing
> mathematics is always trying to think as well
> as possible."  -- Edsger W. Dijkstra, 1981
>
> Rudolf Adamkovič <salutis@me.com> [he/him]
> Studenohorská 25
> 84103 Bratislava
> Slovakia
>


  reply	other threads:[~2023-08-30 23:43 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-08  1:58 PWD is not seen by my emacs installation Patrick Mahan
2023-08-08 12:44 ` tpeplt
     [not found]   ` <CAFDHx1Jk=jtHhLdThFUeFpfa=yGTXoKYuu0bADYAN-j-7FjSHw@mail.gmail.com>
2023-08-09  0:59     ` tpeplt
2023-08-08 19:07 ` stefan-husmann
2023-08-08 21:21   ` Patrick Mahan
2023-08-09  5:37     ` Rudolf Schlatte
2023-08-09 20:21       ` Patrick Mahan
2023-08-22  1:14         ` David Masterson
2023-08-22  4:24           ` Patrick Mahan
2023-08-30 22:29 ` Rudolf Adamkovič
2023-08-30 23:43   ` Patrick Mahan [this message]
2023-09-03 15:27   ` Rudolf Schlatte

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.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=CAFDHx1LSafikmccCAwO_xDFhC4LRR7ckc+q+v8EpGeZAdQcdLA@mail.gmail.com \
    --to=plmahan@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=salutis@me.com \
    /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.
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).