[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: exec-path question
From: |
Harald Hanche-Olsen |
Subject: |
Re: exec-path question |
Date: |
Mon, 28 Feb 2011 17:16:26 +0100 (CET) |
[Harald Hanche-Olsen <address@hidden> (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