]> git.eshelyaron.com Git - emacs.git/commitdiff
* Add a warning for missing write privilege
authorAndrea Corallo <akrl@sdf.org>
Sun, 3 May 2020 12:37:38 +0000 (13:37 +0100)
committerAndrea Corallo <akrl@sdf.org>
Sun, 3 May 2020 12:37:38 +0000 (13:37 +0100)
* lisp/emacs-lisp/comp.el (native-compile-async): Check for write
privilege and raise a warning in case.

lisp/emacs-lisp/comp.el

index f027bad65cffac56bed14c0cb385d1696c611107..bd4c25a1f57d5c8787da472f8a53821be039411e 100644 (file)
@@ -2344,7 +2344,16 @@ queued with LOAD %"
                      file load (cdr entry))
         ;; Make sure we are not already compiling `file' (bug#40838).
         (unless (gethash file comp-async-compilations)
-          (setf comp-files-queue (append comp-files-queue `((,file . ,load)))))))
+          (let ((out-dir (comp-output-directory file))
+                (out-filename (comp-output-filename file)))
+            (if (or (file-writable-p out-filename)
+                    (and (not (file-exists-p out-dir))
+                         (file-writable-p (substring out-dir 0 -1))))
+                (setf comp-files-queue
+                      (append comp-files-queue `((,file . ,load))))
+              (display-warning 'comp
+                               (format "No write access for %s skipping."
+                                       out-filename)))))))
     (when (zerop (comp-async-runnings))
       (comp-run-async-workers)
       (message "Compilation started."))))