unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Harald Hanche-Olsen <hanche@math.ntnu.no>
To: emacs-devel@gnu.org
Subject: Re: exec-path question
Date: Mon, 28 Feb 2011 17:16:26 +0100 (CET)	[thread overview]
Message-ID: <20110228.171626.1424846180851296370.hanche@math.ntnu.no> (raw)
In-Reply-To: <20110227.095030.1994368869827547171.hanche@math.ntnu.no>

[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



      reply	other threads:[~2011-02-28 16:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

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=20110228.171626.1424846180851296370.hanche@math.ntnu.no \
    --to=hanche@math.ntnu.no \
    --cc=emacs-devel@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 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).