comparison lisp/vc.el @ 22534:442d61eaab83

(vc-binary-suffixes): New variable. (vc-find-binary): Append every suffix from vc-binary-suffixes when looking for executable files.
author Eli Zaretskii <eliz@gnu.org>
date Sun, 21 Jun 1998 14:29:07 +0000
parents 115ca3d4f9c4
children c015f24cda4c
comparison
equal deleted inserted replaced
22533:6eae236a4f01 22534:442d61eaab83
3 ;; Copyright (C) 1992, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc. 3 ;; Copyright (C) 1992, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
4 4
5 ;; Author: Eric S. Raymond <esr@snark.thyrsus.com> 5 ;; Author: Eric S. Raymond <esr@snark.thyrsus.com>
6 ;; Maintainer: Andre Spiegel <spiegel@inf.fu-berlin.de> 6 ;; Maintainer: Andre Spiegel <spiegel@inf.fu-berlin.de>
7 7
8 ;; $Id: vc.el,v 1.231 1998/06/12 11:13:37 spiegel Exp rms $ 8 ;; $Id: vc.el,v 1.232 1998/06/16 16:38:47 rms Exp eliz $
9 9
10 ;; This file is part of GNU Emacs. 10 ;; This file is part of GNU Emacs.
11 11
12 ;; GNU Emacs is free software; you can redistribute it and/or modify 12 ;; GNU Emacs is free software; you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by 13 ;; it under the terms of the GNU General Public License as published by
504 (error "Buffer %s is not associated with a file" (buffer-name)) 504 (error "Buffer %s is not associated with a file" (buffer-name))
505 (if (not (vc-backend (buffer-file-name))) 505 (if (not (vc-backend (buffer-file-name)))
506 (error "File %s is not under version control" (buffer-file-name)))))) 506 (error "File %s is not under version control" (buffer-file-name))))))
507 507
508 (defvar vc-binary-assoc nil) 508 (defvar vc-binary-assoc nil)
509 509 (defvar vc-binary-suffixes
510 (if (memq system-type '(ms-dos windows-nt))
511 '(".exe" ".com" ".bat" ".cmd" ".btm" "")
512 '("")))
510 (defun vc-find-binary (name) 513 (defun vc-find-binary (name)
511 "Look for a command anywhere on the subprocess-command search path." 514 "Look for a command anywhere on the subprocess-command search path."
512 (or (cdr (assoc name vc-binary-assoc)) 515 (or (cdr (assoc name vc-binary-assoc))
513 (catch 'found 516 (catch 'found
514 (mapcar 517 (mapcar
515 (function 518 (function
516 (lambda (s) 519 (lambda (s)
517 (if s 520 (if s
518 (let ((full (concat s "/" name))) 521 (let ((full (concat s "/" name))
519 (if (and (file-executable-p full) 522 (suffixes vc-binary-suffixes)
520 (not (file-directory-p full))) 523 candidate)
521 (progn 524 (while suffixes
522 (setq vc-binary-assoc 525 (setq candidate (concat full (car suffixes)))
523 (cons (cons name full) vc-binary-assoc)) 526 (if (and (file-executable-p candidate)
524 (throw 'found full))))))) 527 (not (file-directory-p candidate)))
528 (progn
529 (setq vc-binary-assoc
530 (cons (cons name candidate) vc-binary-assoc))
531 (throw 'found candidate))
532 (setq suffixes (cdr suffixes))))))))
525 exec-path) 533 exec-path)
526 nil))) 534 nil)))
527 535
528 (defun vc-do-command (buffer okstatus command file last &rest flags) 536 (defun vc-do-command (buffer okstatus command file last &rest flags)
529 "Execute a version-control command, notifying user and checking for errors. 537 "Execute a version-control command, notifying user and checking for errors.