+;;;###autoload
+(defun batch-byte-compile-one-file ()
+ "Run `byte-compile-file' on a single file remaining on the command line.
+Use this from the command line, with `-batch';
+it won't work in an interactive Emacs."
+ ;; command-line-args-left is what is left of the command line (from
+ ;; startup.el)
+ (defvar command-line-args-left) ;Avoid 'free variable' warning
+ (if (not noninteractive)
+ (error "`batch-byte-compile-one-file' is to be used only with -batch"))
+ (let (error
+ (file-to-process (car command-line-args-left)))
+ (setq command-line-args-left (cdr command-line-args-left))
+ (if (file-directory-p (expand-file-name file-to-process))
+ (let ((files (directory-files file-to-process))
+ source dest)
+ (while files
+ (if (and (string-match emacs-lisp-file-regexp (car files))
+ (not (auto-save-file-name-p (car files)))
+ (setq source (expand-file-name
+ (car files)
+ file-to-process))
+ (setq dest (byte-compile-dest-file source))
+ (file-exists-p dest)
+ (file-newer-than-file-p source dest))
+ (if (null (batch-byte-compile-1 source))
+ (setq error t)))
+ (setq files (cdr files)))
+ (null error))
+ (batch-byte-compile-1 file-to-process))))
+