[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: |
C Y |
Subject: |
RE: [Axiom-developer] Check for item in PATH in Emacs? |
Date: |
Thu, 4 May 2006 06:20:13 -0700 (PDT) |
Cool! Thanks Bill. I actually hacked up my own version yesterday
which might be a little simpler for our purposes, but I've yet to test
it on Windows. I'll upload it to the wiki this morning - I THINK this
version should work without trouble on Windows or Linux, but I'll feel
better if it is confirmed ;-).
Cheers,
CY
--- "Page, Bill" <address@hidden> wrote:
> 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.
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com