Changeset 4030

Show
Ignore:
Timestamp:
2006年02月03日 17時46分43秒 (3 years ago)
Author:
shirai
Message:

* international/mw32script.el
(mw32script-file-executable-p): Add dos-string.
(mw32script-original-executable-find): New variable.
(mw32script-executable-find): New function.
(mw32script-init): Substitute `executable-find' to
`mw32script-executable-find' and tiny fix.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lisp/ChangeLog.Meadow

    r4028 r4030  
     12006-02-03  Hideyuki SHIRAI  <shirai@meadowy.org> 
     2 
     3        * international/mw32script.el 
     4        (mw32script-file-executable-p): Add dos-string. 
     5        (mw32script-original-executable-find): New variable. 
     6        (mw32script-executable-find): New function. 
     7        (mw32script-init): Substitute `executable-find' to 
     8        `mw32script-executable-find' and tiny fix. 
     9 
    1102006-02-03  Masayuki FUJII  <boochang@m4.kcn.ne.jp> 
    211 
  • trunk/lisp/international/mw32script.el

    r4028 r4030  
    3535(defvar mw32script-recursive nil) 
    3636(defvar mw32script-original-file-executable-p nil) 
     37(defvar mw32script-original-executable-find nil) 
    3738;; end --- options 
    3839(defvar mw32script-bufsiz 256) 
     
    174175 
    175176(defun mw32script-file-executable-p (filename) 
     177  "Return t if filename can be executed by you. 
     178For a directory, this means you can access files in that directory. 
     179 
     180Add an analytical capability of the script file to this function by Meadow." 
    176181  (or (funcall mw32script-original-file-executable-p filename) 
    177182      (and (mw32script-resolve-script filename) 
    178183           t))) 
     184 
     185(defun mw32script-executable-find (command) 
     186  "Search for command in `exec-path' and return the absolute file name. 
     187Return nil if command is not found anywhere in `exec-path'. 
     188 
     189Add an analytical capability of the script file to this function by Meadow." 
     190  (catch 'detect 
     191    (let ((paths exec-path) 
     192          (suffixes exec-suffixes) 
     193          cmds names path file) 
     194      (while suffixes 
     195        (setq cmds (cons (concat command (car suffixes)) cmds)) 
     196        (setq suffixes (cdr suffixes))) 
     197      (setq cmds (nreverse cmds)) 
     198      (while (setq path (car paths)) 
     199        (setq paths (cdr paths)) 
     200        (setq names cmds) 
     201        (while names 
     202          (setq file (locate-file-internal (car names) (list path))) 
     203          (when (and file 
     204                     (not (file-directory-p file)) 
     205                     (mw32script-file-executable-p file)) 
     206            (throw 'detect file)) 
     207          (setq names (cdr names))))))) 
    179208 
    180209(defun mw32script-init () 
     
    185214    (function mw32script-argument-editing-function) 'last) 
    186215  (add-to-list 'exec-suffix-list "") 
    187   (if (not mw32script-original-file-executable-p) 
    188       (progn 
    189         (setq mw32script-original-file-executable-p 
    190               (symbol-function 'file-executable-p)) 
    191         (fset 'file-executable-p 
    192               (symbol-function 'mw32script-file-executable-p))))) 
     216  (unless mw32script-original-file-executable-p 
     217    (setq mw32script-original-file-executable-p 
     218          (symbol-function 'file-executable-p)) 
     219    (fset 'file-executable-p 'mw32script-file-executable-p)) 
     220  (unless mw32script-original-executable-find 
     221    (setq mw32script-original-executable-find 
     222          (symbol-function 'executable-find)) 
     223    (fset 'executable-find 'mw32script-executable-find))) 
    193224 
    194225(provide 'mw32script)