Mercurial > emacs
comparison lisp/progmodes/executable.el @ 62236:8cffa2d0ef26
(executable-find): Move to files.el.
| author | Stefan Monnier <monnier@iro.umontreal.ca> |
|---|---|
| date | Wed, 11 May 2005 16:42:15 +0000 |
| parents | 2e6b67f7b5c9 |
| children | 56910476003b 62afea0771d8 |
comparison
equal
deleted
inserted
replaced
| 62235:cd487105a05a | 62236:8cffa2d0ef26 |
|---|---|
| 158 "-maxdepth" | 158 "-maxdepth" |
| 159 "1") | 159 "1") |
| 160 (goto-char (point-min)) | 160 (goto-char (point-min)) |
| 161 (if (search-forward file nil t) | 161 (if (search-forward file nil t) |
| 162 t)))) | 162 t)))) |
| 163 | |
| 164 ;;;###autoload | |
| 165 (defun executable-find (command) | |
| 166 "Search for COMMAND in `exec-path' and return the absolute file name. | |
| 167 Return nil if COMMAND is not found anywhere in `exec-path'." | |
| 168 (let ((list exec-path) | |
| 169 file) | |
| 170 (while list | |
| 171 (setq list | |
| 172 (if (and (setq file (expand-file-name command (car list))) | |
| 173 (let ((suffixes exec-suffixes) | |
| 174 candidate) | |
| 175 (while suffixes | |
| 176 (setq candidate (concat file (car suffixes))) | |
| 177 (if (and (file-executable-p candidate) | |
| 178 (not (file-directory-p candidate))) | |
| 179 (setq suffixes nil) | |
| 180 (setq suffixes (cdr suffixes)) | |
| 181 (setq candidate nil))) | |
| 182 (setq file candidate))) | |
| 183 nil | |
| 184 (setq file nil) | |
| 185 (cdr list)))) | |
| 186 file)) | |
| 187 | 163 |
| 188 (defun executable-chmod () | 164 (defun executable-chmod () |
| 189 "This gets called after saving a file to assure that it be executable. | 165 "This gets called after saving a file to assure that it be executable. |
| 190 You can set the absolute or relative mode in variable `executable-chmod' for | 166 You can set the absolute or relative mode in variable `executable-chmod' for |
| 191 non-executable files." | 167 non-executable files." |
| 299 (set-file-modes (buffer-file-name) | 275 (set-file-modes (buffer-file-name) |
| 300 (logior current-mode add-mode)))))) | 276 (logior current-mode add-mode)))))) |
| 301 | 277 |
| 302 (provide 'executable) | 278 (provide 'executable) |
| 303 | 279 |
| 304 ;;; arch-tag: 58458d1c-d9db-45ec-942b-8bbb1d5e319d | 280 ;; arch-tag: 58458d1c-d9db-45ec-942b-8bbb1d5e319d |
| 305 ;;; executable.el ends here | 281 ;;; executable.el ends here |
