all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Xah Lee <xahlee@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: setevn PATH vs exec-path [was Re: Flyspell error]
Date: Tue, 4 Aug 2009 15:06:35 -0700 (PDT)	[thread overview]
Message-ID: <1e28e3b6-5be0-4d3e-a290-1d18d6812ed2@u16g2000pru.googlegroups.com> (raw)
In-Reply-To: 74580316-83d3-4fca-910c-f8faa0935195@t11g2000prh.googlegroups.com

spent some time to study the diff between (setenv "PATH" ...) vs (setq
exec-path ...).

Their docs are here:

• System Environment - GNU Emacs Lisp Reference Manual
  http://xahlee.org/elisp/System-Environment.html
  (info "(elisp) System Environment")

• Subprocess Creation - GNU Emacs Lisp Reference Manual
  http://xahlee.org/elisp/Subprocess-Creation.html
  (info "(elisp) Subprocess Creation")


in summary:

“setenv” is for setting OS env vars within emacs. Unixes and Windows
both have env vars. Env vars are global info available to processes
(apps). A process is free to use the info in env var. Some env var are
important as they contain system info such as Windows WINDIR that
contains OS path, and PATH in both Windows and unixes that specify
program paths. Many are config items such as HOME dir in unix and
Windows, and “locale” in unixes. When a process launchs, it inherits
(have access) to all the env vars where the process is launched.

emacs uses the system's env var just like other apps, but more
importantly, emacs shells are interfaces to OS's shells, so as a sys
admin or programer who uses emacs, you want to be able to config
system's env vars as seen in shell within emacs when emacs startup a
shell. (this is done with emacs commands “setenv” and “getenv”, which
are wrappers that manipulate emacs's process-environment var.)

Emacs's “exec-path” var is actually the var emacs uses to locate
external programs. Here's a quote: «Emacs initializes exec-path when
it starts up, based on the value of the environment variable PATH.»

So, the system's PATH env var and emacs exec-path needs not to be the
same, and ideally their values probably shouldn't be identical if one
is a control freak, since they serve different purposes.

The value for exec-path is important to emacs in locating programs,
while the PATH system env var is more important in using emacs as a
shell.

so, judging from all i know, getting aspell to work in emacs means
exec-path should contain the path to aspell. Since emacs set exec-path
to system's PATH env var when it starts, thus setting aspell path in
OS's PATH env var should work too.

Ok. Great to have studied this at least a bit now.

btw, on Windows emacsW23, it has cmd-shell. Is this particular to
emacsW23 or is it in GNU Emacs's Windows branch?

  Xah
∑ http://xahlee.org/

  parent reply	other threads:[~2009-08-04 22:06 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-01  0:06 Flyspell error sam jesse
2009-08-01  7:29 ` Eli Zaretskii
2009-08-01  8:53   ` sam jesse
2009-08-01 10:01     ` Eli Zaretskii
     [not found]     ` <mailman.3634.1249120899.2239.help-gnu-emacs@gnu.org>
2009-08-01 10:13       ` Richard Riley
     [not found]   ` <mailman.3635.1249129213.2239.help-gnu-emacs@gnu.org>
2009-08-01 21:58     ` Xah Lee
2009-08-02  7:10       ` sam jesse
     [not found]       ` <mailman.3687.1249222316.2239.help-gnu-emacs@gnu.org>
2009-08-02 20:02         ` Xah Lee
2009-08-02 20:28           ` Richard Riley
2009-08-03  0:08             ` Xah Lee
2009-08-03  0:10               ` Xah Lee
2009-08-03 20:51                 ` sam jesse
2009-08-03 20:54                   ` sam jesse
2009-08-03 22:21                   ` Xah Lee
2009-08-03 23:12                     ` sam jesse
     [not found]                   ` <mailman.3801.1249343719.2239.help-gnu-emacs@gnu.org>
2009-08-04  2:17                     ` Xah Lee
2009-08-04  4:44                       ` sam jesse
2009-08-04 17:34                         ` suvayu ali
2009-08-04 18:10                         ` Eli Zaretskii
     [not found]                         ` <mailman.3862.1249407393.2239.help-gnu-emacs@gnu.org>
2009-08-04 18:57                           ` Xah Lee
     [not found]                         ` <mailman.3868.1249409494.2239.help-gnu-emacs@gnu.org>
2009-08-04 19:02                           ` Xah Lee
2009-08-04 21:29                             ` sam jesse
2009-08-04 22:06                             ` Xah Lee [this message]
2009-08-05  5:52                               ` setevn PATH vs exec-path [was Re: Flyspell error] Lennart Borgman
     [not found]                               ` <mailman.3919.1249451575.2239.help-gnu-emacs@gnu.org>
2009-08-05 12:40                                 ` Xah Lee
2009-08-05 17:14                               ` Eli Zaretskii
2009-08-05 17:25                                 ` Drew Adams
     [not found]                               ` <mailman.3953.1249492495.2239.help-gnu-emacs@gnu.org>
2009-08-05 23:51                                 ` Xah Lee
2009-08-07  9:30                                   ` Eli Zaretskii
     [not found]                                   ` <mailman.4107.1249637430.2239.help-gnu-emacs@gnu.org>
2009-08-07 11:43                                     ` Xah Lee
     [not found]                             ` <mailman.3916.1249445924.2239.help-gnu-emacs@gnu.org>
2009-08-05  7:03                               ` Flyspell error Xah Lee
2009-08-05  7:07                               ` Anselm Helbig
2009-08-05 17:46                                 ` sam jesse
2009-08-06  7:48                                   ` sam jesse
2009-08-02 21:21           ` Lennart Borgman

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

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

  git send-email \
    --in-reply-to=1e28e3b6-5be0-4d3e-a290-1d18d6812ed2@u16g2000pru.googlegroups.com \
    --to=xahlee@gmail.com \
    --cc=help-gnu-emacs@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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.