unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* exec-path question
@ 2011-02-26  3:51 Ben Key
  2011-02-26  9:47 ` Chad Brown
  2011-02-26  9:48 ` Mark Tran
  0 siblings, 2 replies; 6+ messages in thread
From: Ben Key @ 2011-02-26  3:51 UTC (permalink / raw)
  To: Emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1877 bytes --]

Hello,

I have a question about the exec-path variable.  I am using the Nextstep
build of Emacs on Mac OS X 10.6.6.  In both Emacs 23.2 and Emacs 24.0, the
"/usr/local/bin" directory is not included in the list, even though it is
included in my PATH environment variable.  In Emacs 23.2, the exec-path
variable has the value ("/usr/bin" "/bin" "/usr/sbin" "/sbin"
"/Applications/Emacs.app/Contents/MacOS/bin").  In Emacs 24, the exec-path
variable has the value ("/usr/bin" "/bin" "/usr/sbin" "/sbin"
"/Applications/Emacs24.app/Contents/MacOS/bin").  In Emacs 24 the following
additional information is provided.

Original value was ("/usr/bin" "/bin" "/usr/sbin" "/sbin" "/usr/local/bin"
"/usr/X11/bin" "/Users/bkey/src/emacs/trunk/lib-src"
"/Users/bkey/src/emacs/trunk/nextstep/Emacs.app/Contents/MacOS//libexec/emacs/24.0.50/x86_64-apple-darwin10.6.0")

It looks like, at least in Emacs 24, the "/usr/local/bin" directory is
initially included in the exec-path but is latter removed for some reason.

In both versions of Emacs, the  "/usr/local/bin" directory is included in
the path if I run Emacs from the command line using the full path to the
Emacs executable.  It is also included in the path if am debugging Emacs
using GDB so I at a loss as to how best to discover the cause of the
problem.  I only get the problem if I start Emacs using the icon in the
Applications menu, which is my preferred method of starting Emacs.

I need the "/usr/local/bin" directory to be included in my exec-path because
I wish to use the ispell function and my hunspell executable is located
there.  I know I can simply modify my .emacs file to add the
"/usr/local/bin" directory to the exec-path, but I should not have to do
that.  Emacs should not be removing this directory from the exec-path.

Does anyone have any idea how I should go about tracking down the cause of
this problem?

[-- Attachment #2: Type: text/html, Size: 2320 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: exec-path question
  2011-02-26  3:51 exec-path question Ben Key
@ 2011-02-26  9:47 ` Chad Brown
  2011-02-26  9:48 ` Mark Tran
  1 sibling, 0 replies; 6+ messages in thread
From: Chad Brown @ 2011-02-26  9:47 UTC (permalink / raw)
  To: Ben Key; +Cc: Emacs-devel

[-- Attachment #1: Type: text/plain, Size: 657 bytes --]

I'm guessing that you're having the typical macosx problem, where you expect the system Dock to recognize your $PATH, but it doesn't.  You can get some background on this here:

	http://developer.apple.com/library/mac/#documentation/MacOSX/Conceptual/BPRuntimeConfig/Articles/EnvironmentVars.html#//apple_ref/doc/uid/20002093-BCIJIJBH

The ``Original Value'' is emacs telling you what was used when emacs was built (dumped), not some value it had when you started the executable that was later changed.


On Feb 25, 2011, at 7:51 PM, Ben Key wrote:

> Hello,
> 
> I have a question about the exec-path variable...

I hope that helps,
*Chad


[-- Attachment #2: Type: text/html, Size: 1436 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: exec-path question
  2011-02-26  3:51 exec-path question Ben Key
  2011-02-26  9:47 ` Chad Brown
@ 2011-02-26  9:48 ` Mark Tran
  2011-02-27  4:11   ` Ben Key
  2011-02-27  8:50   ` Harald Hanche-Olsen
  1 sibling, 2 replies; 6+ messages in thread
From: Mark Tran @ 2011-02-26  9:48 UTC (permalink / raw)
  To: Ben Key; +Cc: Emacs-devel

[-- Attachment #1: Type: text/plain, Size: 2484 bytes --]

Applications in OS X are not launched by your shell and therefore do not
inherit it's environment variables. They're started through launchd.

If you want Emacs.app to inherit environment variables then you can set user
session environment variables in ~/.MacOSX/environment.plist.

More information at:

http://developer.apple.com/library/mac/#documentation/MacOSX/Conceptual/BPRuntimeConfig/Articles/EnvironmentVars.html
http://www.emacswiki.org/emacs/MacOSTweaks#toc13

On Fri, Feb 25, 2011 at 7:51 PM, Ben Key <bkey76@gmail.com> wrote:

> Hello,
>
> I have a question about the exec-path variable.  I am using the Nextstep
> build of Emacs on Mac OS X 10.6.6.  In both Emacs 23.2 and Emacs 24.0, the
> "/usr/local/bin" directory is not included in the list, even though it is
> included in my PATH environment variable.  In Emacs 23.2, the exec-path
> variable has the value ("/usr/bin" "/bin" "/usr/sbin" "/sbin"
> "/Applications/Emacs.app/Contents/MacOS/bin").  In Emacs 24, the exec-path
> variable has the value ("/usr/bin" "/bin" "/usr/sbin" "/sbin"
> "/Applications/Emacs24.app/Contents/MacOS/bin").  In Emacs 24 the following
> additional information is provided.
>
> Original value was ("/usr/bin" "/bin" "/usr/sbin" "/sbin" "/usr/local/bin"
> "/usr/X11/bin" "/Users/bkey/src/emacs/trunk/lib-src"
> "/Users/bkey/src/emacs/trunk/nextstep/Emacs.app/Contents/MacOS//libexec/emacs/24.0.50/x86_64-apple-darwin10.6.0")
>
> It looks like, at least in Emacs 24, the "/usr/local/bin" directory is
> initially included in the exec-path but is latter removed for some reason.
>
> In both versions of Emacs, the  "/usr/local/bin" directory is included in
> the path if I run Emacs from the command line using the full path to the
> Emacs executable.  It is also included in the path if am debugging Emacs
> using GDB so I at a loss as to how best to discover the cause of the
> problem.  I only get the problem if I start Emacs using the icon in the
> Applications menu, which is my preferred method of starting Emacs.
>
> I need the "/usr/local/bin" directory to be included in my exec-path
> because I wish to use the ispell function and my hunspell executable is
> located there.  I know I can simply modify my .emacs file to add the
> "/usr/local/bin" directory to the exec-path, but I should not have to do
> that.  Emacs should not be removing this directory from the exec-path.
>
> Does anyone have any idea how I should go about tracking down the cause of
> this problem?
>
>

[-- Attachment #2: Type: text/html, Size: 3406 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: exec-path question
  2011-02-26  9:48 ` Mark Tran
@ 2011-02-27  4:11   ` Ben Key
  2011-02-27  8:50   ` Harald Hanche-Olsen
  1 sibling, 0 replies; 6+ messages in thread
From: Ben Key @ 2011-02-27  4:11 UTC (permalink / raw)
  To: Mark Tran, chadpbrown; +Cc: Emacs-devel

[-- Attachment #1: Type: text/plain, Size: 93 bytes --]

Hello,

I would like to thank Chad Brown and Mark Tran for their assistance with
this issue.

[-- Attachment #2: Type: text/html, Size: 129 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: exec-path question
  2011-02-26  9:48 ` Mark Tran
  2011-02-27  4:11   ` Ben Key
@ 2011-02-27  8:50   ` Harald Hanche-Olsen
  2011-02-28 16:16     ` Harald Hanche-Olsen
  1 sibling, 1 reply; 6+ messages in thread
From: Harald Hanche-Olsen @ 2011-02-27  8:50 UTC (permalink / raw)
  To: emacs-devel

[Mark Tran <mark.tran@gmail.com> (2011-02-26 09:48:34 UTC)]

> Applications in OS X are not launched by your shell and therefore do not
> inherit it's environment variables. They're started through launchd.
> 
> If you want Emacs.app to inherit environment variables then you can set user
> session environment variables in ~/.MacOSX/environment.plist.

An alternative, as far as the PATH and MANPATH variables goes, is to
set these from the contents of /etc/paths and /etc/paths.d/* (for
PATH) and /etc/manpaths and /etc/manpaths.d/* (for MANPATH).

I think it could be argued that emacs on the mac should do this by
default.

See also the code in /etc/profile and the path_helper manual page.

- Harald



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: exec-path question
  2011-02-27  8:50   ` Harald Hanche-Olsen
@ 2011-02-28 16:16     ` Harald Hanche-Olsen
  0 siblings, 0 replies; 6+ messages in thread
From: Harald Hanche-Olsen @ 2011-02-28 16:16 UTC (permalink / raw)
  To: emacs-devel

[Harald Hanche-Olsen <hanche@math.ntnu.no> (2011-02-27 08:50:30 UTC)]

> An alternative, as far as the PATH and MANPATH variables goes, is to
> set these from the contents of /etc/paths and /etc/paths.d/* (for
> PATH) and /etc/manpaths and /etc/manpaths.d/* (for MANPATH).
> 
> I think it could be argued that emacs on the mac should do this by
> default.

I suggest code somewhat like this, perhaps to be added to mac-setup.el:

(let ((path-helper
       (lambda (p pd)
	 (with-temp-buffer
	   (mapc (lambda (filename)
		   (insert-file-contents filename)
		   (goto-char (point-max))
		   (unless (bolp) (insert "\n")))
		 (cons p (directory-files pd t "[^.]")))
	   (let (res)
	     (goto-char (point-min))
	     (while (< (point) (point-max))
	       (setq res (cons (buffer-substring
				(point) (progn (end-of-line) (point)))
			       res))
	       (forward-char 1))
	     (nreverse res))))))
  (setq exec-path (funcall path-helper "/etc/paths" "/etc/paths.d"))
  (setenv "PATH" (mapconcat #'identity exec-path ":"))
  (setenv "MANPATH"
	  (mapconcat #'identity
		     (funcall path-helper "/etc/manpaths" "/etc/manpaths.d")
		     ":")))

- Harald



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-02-28 16:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-26  3:51 exec-path question Ben Key
2011-02-26  9:47 ` Chad Brown
2011-02-26  9:48 ` Mark Tran
2011-02-27  4:11   ` Ben Key
2011-02-27  8:50   ` Harald Hanche-Olsen
2011-02-28 16:16     ` Harald Hanche-Olsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.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).