emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: /lib/cpp not found in c-mode


From: Stefan Monnier
Subject: Re: /lib/cpp not found in c-mode
Date: Sun, 08 May 2005 13:31:20 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

> Done.  I preferred to use locate-file instead of executable-find,
> since the latter would load another package.

Actually, looking at the definition of executable-find, I'm surprised it
doesn't use locate-file.  The patch below should fix it so that
executable-find uses the same code used by `call-process'.
The new code is nothing else than a call to locate-file and I'd argue
that Eli's change from executable-find to locate-file is a bad idea and
instead we should simply move executable-find from executable.el to
subr.el.


        Stefan


--- orig/lisp/progmodes/executable.el
+++ mod/lisp/progmodes/executable.el
@@ -165,25 +165,7 @@
 (defun executable-find (command)
   "Search for COMMAND in `exec-path' and return the absolute file name.
 Return nil if COMMAND is not found anywhere in `exec-path'."
-  (let ((list exec-path)
-       file)
-    (while list
-      (setq list
-           (if (and (setq file (expand-file-name command (car list)))
-                    (let ((suffixes exec-suffixes)
-                          candidate)
-                      (while suffixes
-                        (setq candidate (concat file (car suffixes)))
-                        (if (and (file-executable-p candidate)
-                                 (not (file-directory-p candidate)))
-                            (setq suffixes nil)
-                          (setq suffixes (cdr suffixes))
-                          (setq candidate nil)))
-                      (setq file candidate)))
-               nil
-             (setq file nil)
-             (cdr list))))
-    file))
+  (locate-file command exec-path exec-suffixes 1))
 
 (defun executable-chmod ()
   "This gets called after saving a file to assure that it be executable.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]