unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* carbon emacs on OS X 10.3 (Panther): how to fix environment?
@ 2004-01-12 15:45 Rob Dickens
  2004-01-12 19:04 ` Benjamin Riefenstahl
  2004-01-12 21:17 ` John Wiegley
  0 siblings, 2 replies; 6+ messages in thread
From: Rob Dickens @ 2004-01-12 15:45 UTC (permalink / raw)


Dear emacs-devel list,

I understand that launching emacs from the Terminal commandline will 
give me the correct **environment variables**. Is anyone working on a 
fix so that it can be launched from the dock?

However, even launching from the commandline doesn't give me the 
correct **groups**. Does anyone have a fix for that?

Regards,

Rob
--
http://www.lafros.com

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

* Re: carbon emacs on OS X 10.3 (Panther): how to fix environment?
  2004-01-12 15:45 carbon emacs on OS X 10.3 (Panther): how to fix environment? Rob Dickens
@ 2004-01-12 19:04 ` Benjamin Riefenstahl
  2004-01-12 20:00   ` Rob Dickens
  2004-01-12 21:17 ` John Wiegley
  1 sibling, 1 reply; 6+ messages in thread
From: Benjamin Riefenstahl @ 2004-01-12 19:04 UTC (permalink / raw)
  Cc: Rob Dickens

Hi Rob,


Rob Dickens <rob.dickens@lafros.com> writes:
> I understand that launching emacs from the Terminal commandline will
> give me the correct **environment variables**. Is anyone working on
> a fix so that it can be launched from the dock?

I think the problem is not fixable by Emacs, it's a generic conceptual
Mac OS X issue.  When you launch Emacs from the Dock, no command-line
shell is ever involved, so none of the command-line shell init files
is ever evaluated.

You can set environment variables for the Finder and the Dock in
~/.MacOSX/environment.plist, see
<http://developer.apple.com/qa/qa2001/qa1067.html>.  These will than
be inherited by Emacs.  These settings are static, this file is not
using any kind of scripting language.

I would assume that you can write an AppleScript to do more dynamic
stuff.  The script would talk to the Finder and/or Dock.  You would
than add that AppleScript to your Startup Items (see the "Accounts"
System Preferences).

You can also set environment variables in your ~/.emacs using the
(setenv) function.  This will than of course only affect packages that
get loaded afterwards.

> However, even launching from the commandline doesn't give me the
> correct **groups**. Does anyone have a fix for that?

Can you expand?  I don't quite understand what you mean here.


benny

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

* Re: carbon emacs on OS X 10.3 (Panther): how to fix environment?
  2004-01-12 19:04 ` Benjamin Riefenstahl
@ 2004-01-12 20:00   ` Rob Dickens
  2004-01-13 11:35     ` Benjamin Riefenstahl
  0 siblings, 1 reply; 6+ messages in thread
From: Rob Dickens @ 2004-01-12 20:00 UTC (permalink / raw)
  Cc: Benjamin Riefenstahl

On 12 Jan 2004, at 19:04, Benjamin Riefenstahl wrote:

> You can set environment variables for the Finder and the Dock in
> ~/.MacOSX/environment.plist

> You can also set environment variables in your ~/.emacs using the
> (setenv) function.
>

Benny,

Thanks a lot! These things I didn't know about.

>> However, even launching from the commandline doesn't give me the
>> correct **groups**. Does anyone have a fix for that?
>
> Can you expand?  I don't quite understand what you mean here.

By 'groups' I mean the list of groups returned by the /usr/bin/groups 
command. The list returned when running this from a sub-emacs shell 
didn't match that returned on the Terminal commandline.

I now realise you're not meant to use /usr/bin/open to launch emacs 
from the commandline! Doing it the prescribed way--running 
.../emacs/mac/Emacs.app/Contents/MacOS/Emacs--I DO NOW SEE THE CORRECT 
GROUPS.

Cheers,

Rob (appreciative user of emacs on the mac)
--
http://www.lafros.com

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

* Re: carbon emacs on OS X 10.3 (Panther): how to fix environment?
  2004-01-12 15:45 carbon emacs on OS X 10.3 (Panther): how to fix environment? Rob Dickens
  2004-01-12 19:04 ` Benjamin Riefenstahl
@ 2004-01-12 21:17 ` John Wiegley
  2004-01-13 11:16   ` Benjamin Riefenstahl
  1 sibling, 1 reply; 6+ messages in thread
From: John Wiegley @ 2004-01-12 21:17 UTC (permalink / raw)


Rob Dickens <rob.dickens@lafros.com> writes:

> I understand that launching emacs from the Terminal commandline will
> give me the correct **environment variables**. Is anyone working on
> a fix so that it can be launched from the dock?

I use the following in my .emacs (note: it needs my xml-parse.el
module, http://www.newartisans.com/johnw/Emacs/xml-parse.el):

(when (file-readable-p "~/.MacOSX/environment.plist")
  (with-temp-buffer
    (insert-file-contents "~/.MacOSX/environment.plist")
    (let* ((dict (cdr (assoc "dict" (read-xml)))))
      (while dict
	(when (string= "key" (caar dict))
	  (setenv (car (cdr (car dict)))
		  (car (cdr (cadr dict))))
	  (message "Setting %s=%s" (car (cdr (car dict)))
		   (car (cdr (cadr dict)))))
	(setq dict (cddr dict)))))

  (setq exec-path nil)
  (dolist (path (nreverse (split-string (getenv "PATH") ":")))
    (add-to-list 'exec-path path)))

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

* Re: carbon emacs on OS X 10.3 (Panther): how to fix environment?
  2004-01-12 21:17 ` John Wiegley
@ 2004-01-13 11:16   ` Benjamin Riefenstahl
  0 siblings, 0 replies; 6+ messages in thread
From: Benjamin Riefenstahl @ 2004-01-13 11:16 UTC (permalink / raw)
  Cc: emacs-devel

Hi John,


John Wiegley <johnw@gnu.org> writes:
> (when (file-readable-p "~/.MacOSX/environment.plist")
>   (with-temp-buffer
>     (insert-file-contents "~/.MacOSX/environment.plist")
>     (let* ((dict (cdr (assoc "dict" (read-xml)))))
>       (while dict
> 	(when (string= "key" (caar dict))
> 	  (setenv (car (cdr (car dict)))
> 		  (car (cdr (cadr dict))))
> 	  (message "Setting %s=%s" (car (cdr (car dict)))
> 		   (car (cdr (cadr dict)))))
> 	(setq dict (cddr dict)))))
>
>   (setq exec-path nil)
>   (dolist (path (nreverse (split-string (getenv "PATH") ":")))
>     (add-to-list 'exec-path path)))

??

Why do you need this?  My understanding is that
~/.MacOSX/environment.plist is read by the Finder and that the
variables are inherited automatically by Emacs.

The code should only have an effect, if you log in through SSH, where
the Finder isn't in the loop.  But for that situation you can set the
variables in ~/.cshrc or ~/.bashrc or somewhere similar.

What am I missing?


benny

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

* Re: carbon emacs on OS X 10.3 (Panther): how to fix environment?
  2004-01-12 20:00   ` Rob Dickens
@ 2004-01-13 11:35     ` Benjamin Riefenstahl
  0 siblings, 0 replies; 6+ messages in thread
From: Benjamin Riefenstahl @ 2004-01-13 11:35 UTC (permalink / raw)
  Cc: emacs-devel

Hi Rob,


Rob Dickens <rob.dickens@lafros.com> writes:
> By 'groups' I mean the list of groups returned by the
> /usr/bin/groups command. The list returned when running this from a
> sub-emacs shell didn't match that returned on the Terminal
> commandline.

I can't reproduce that, can you give a step-by-step recipe?

> I now realise you're not meant to use /usr/bin/open to launch emacs
> from the commandline!

The "open" tool should work fine.  If I do

  $ open /Applications/Emacs.app

I get the same Emacs as when I launch it from Finder.  I also get the
same groups.  "open" is basically a packaged AppleScript to ask the
Finder to launch a document, I believe.

> Doing it the prescribed way--running
> .../emacs/mac/Emacs.app/Contents/MacOS/Emacs

Actually I use that method only for debugging, not for normal
startup.  It has some minor problems for everyday use. 


benny

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

end of thread, other threads:[~2004-01-13 11:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-12 15:45 carbon emacs on OS X 10.3 (Panther): how to fix environment? Rob Dickens
2004-01-12 19:04 ` Benjamin Riefenstahl
2004-01-12 20:00   ` Rob Dickens
2004-01-13 11:35     ` Benjamin Riefenstahl
2004-01-12 21:17 ` John Wiegley
2004-01-13 11:16   ` Benjamin Riefenstahl

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).