From: Andrea Corallo Date: Sun, 29 Mar 2020 09:44:11 +0000 (+0100) Subject: * test/src/comp-test-funcs.el (comp-test-big-interactive): New test X-Git-Tag: emacs-28.0.90~2727^2~739 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=3c5e3ca2badeda8637e84586eace6ba619f0110a;p=emacs.git * test/src/comp-test-funcs.el (comp-test-big-interactive): New test --- diff --git a/test/src/comp-test-funcs.el b/test/src/comp-test-funcs.el index 46d324bc42f..67b85753b8a 100644 --- a/test/src/comp-test-funcs.el +++ b/test/src/comp-test-funcs.el @@ -403,6 +403,41 @@ (?< 1) (?> 2)))) +(defun comp-test-big-interactive (filename &optional force arg load) + ;; Check non trivial interactive form using `byte-recompile-file'. + (interactive + (let ((file buffer-file-name) + (file-name nil) + (file-dir nil)) + (and file + (derived-mode-p 'emacs-lisp-mode) + (setq file-name (file-name-nondirectory file) + file-dir (file-name-directory file))) + (list (read-file-name (if current-prefix-arg + "Byte compile file: " + "Byte recompile file: ") + file-dir file-name nil) + current-prefix-arg))) + (let ((dest (byte-compile-dest-file filename)) + ;; Expand now so we get the current buffer's defaults + (filename (expand-file-name filename))) + (if (if (file-exists-p dest) + ;; File was already compiled + ;; Compile if forced to, or filename newer + (or force + (file-newer-than-file-p filename dest)) + (and arg + (or (eq 0 arg) + (y-or-n-p (concat "Compile " + filename "? "))))) + (progn + (if (and noninteractive (not byte-compile-verbose)) + (message "Compiling %s..." filename)) + (byte-compile-file filename load)) + (when load + (load (if (file-exists-p dest) dest filename))) + 'no-byte-compile))) + (provide 'comp-test-funcs) ;;; comp-test-funcs.el ends here