Mercurial > emacs
comparison lisp/progmodes/executable.el @ 89909:68c22ea6027c
Sync to HEAD
| author | Kenichi Handa <handa@m17n.org> |
|---|---|
| date | Fri, 16 Apr 2004 12:51:06 +0000 |
| parents | 375f2633d815 |
| children | eac554634bfa |
comparison
equal
deleted
inserted
replaced
| 89908:ee1402f7b568 | 89909:68c22ea6027c |
|---|---|
| 1 ;;; executable.el --- base functionality for executable interpreter scripts -*- byte-compile-dynamic: t -*- | 1 ;;; executable.el --- base functionality for executable interpreter scripts -*- byte-compile-dynamic: t -*- |
| 2 | 2 |
| 3 ;; Copyright (C) 1994, 1995, 1996, 2000, 2003 by Free Software Foundation, Inc. | 3 ;; Copyright (C) 1994, 1995, 1996, 2000, 2003, 2004 by Free Software Foundation, Inc. |
| 4 | 4 |
| 5 ;; Author: Daniel Pfeiffer <occitan@esperanto.org> | 5 ;; Author: Daniel Pfeiffer <occitan@esperanto.org> |
| 6 ;; Keywords: languages, unix | 6 ;; Keywords: languages, unix |
| 7 | 7 |
| 8 ;; This file is part of GNU Emacs. | 8 ;; This file is part of GNU Emacs. |
| 137 "Alist of regexps used to match script errors. | 137 "Alist of regexps used to match script errors. |
| 138 See `compilation-error-regexp-alist'.") | 138 See `compilation-error-regexp-alist'.") |
| 139 | 139 |
| 140 ;; The C function openp slightly modified would do the trick fine | 140 ;; The C function openp slightly modified would do the trick fine |
| 141 (defvaralias 'executable-binary-suffixes 'exec-suffixes) | 141 (defvaralias 'executable-binary-suffixes 'exec-suffixes) |
| 142 | |
| 143 ;;;###autoload | |
| 144 (defun executable-command-find-posix-p (&optional program) | |
| 145 "Check if PROGRAM handles arguments Posix-style. | |
| 146 If PROGRAM is non-nil, use that instead of \"find\"." | |
| 147 ;; Pick file to search from location we know | |
| 148 (let* ((dir (file-truename data-directory)) | |
| 149 (file (car (directory-files dir nil "^[^.]")))) | |
| 150 (with-temp-buffer | |
| 151 (call-process (or program "find") | |
| 152 nil | |
| 153 (current-buffer) | |
| 154 nil | |
| 155 dir | |
| 156 "-name" | |
| 157 file | |
| 158 "-maxdepth" | |
| 159 "1") | |
| 160 (goto-char (point-min)) | |
| 161 (if (search-forward file nil t) | |
| 162 t)))) | |
| 142 | 163 |
| 143 ;;;###autoload | 164 ;;;###autoload |
| 144 (defun executable-find (command) | 165 (defun executable-find (command) |
| 145 "Search for COMMAND in `exec-path' and return the absolute file name. | 166 "Search for COMMAND in `exec-path' and return the absolute file name. |
| 146 Return nil if COMMAND is not found anywhere in `exec-path'." | 167 Return nil if COMMAND is not found anywhere in `exec-path'." |
| 278 (set-file-modes (buffer-file-name) | 299 (set-file-modes (buffer-file-name) |
| 279 (logior current-mode add-mode)))))) | 300 (logior current-mode add-mode)))))) |
| 280 | 301 |
| 281 (provide 'executable) | 302 (provide 'executable) |
| 282 | 303 |
| 304 ;;; arch-tag: 58458d1c-d9db-45ec-942b-8bbb1d5e319d | |
| 283 ;;; executable.el ends here | 305 ;;; executable.el ends here |
