[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [Axiom-developer] Check for item in PATH in Emacs?
From: |
Page, Bill |
Subject: |
RE: [Axiom-developer] Check for item in PATH in Emacs? |
Date: |
Wed, 3 May 2006 22:08:50 -0400 |
On Tuesday, May 02, 2006 11:13 PM C Y wrote:
>
> Does anybody know of a way to check for, say, "axiom" in the
> PATH on a particular system from Emacs? Trying to run something
> via comint seems to result in an error which stops everything.
> I'm trying to first run "axiom" if it's available (it turns out
> graphics do work when run from the Emacs buffer) and if it isn't
> available fall back to "AXIOMsys". I know I could do some hackery
> with running "which axiom" on Linux but I'm hoping for something
> more straightforward and portable.
>
I'm no emacs hacker, but it looks like some code in emacs esh-ext
might do what you want. See:
http://www.cgl.uwaterloo.ca/~mmwasile/data/elisp/eshell-2.4.2/esh-ext.el
...
(defun eshell-search-path (name)
"Search the environment path for NAME."
(if (file-name-absolute-p name)
name
(let ((list (parse-colon-path (getenv "PATH")))
suffixes n1 n2 file)
(while list
(setq n1 (concat (car list) name))
(setq suffixes eshell-binary-suffixes)
(while suffixes
(setq n2 (concat n1 (car suffixes)))
(if (and (or (file-executable-p n2)
(and eshell-force-execution
(file-readable-p n2)))
(not (file-directory-p n2)))
(setq file n2 suffixes nil list nil))
(setq suffixes (cdr suffixes)))
(setq list (cdr list)))
file)))
...
Regards,
Bill Page.