]> git.eshelyaron.com Git - emacs.git/commitdiff
Try and fix the more obvious sources of bug#30635
authorStefan Monnier <monnier@iro.umontreal.ca>
Thu, 22 Mar 2018 22:18:26 +0000 (18:18 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Thu, 22 Mar 2018 22:18:26 +0000 (18:18 -0400)
* lisp/files.el (dir-locals-read-from-dir): Handle the easy cases
without loading `map`.

* lisp/emacs-lisp/bytecomp.el: Don't require cl-lib at run-time.
(byte-compile-and-folded): Avoid cl-every.

lisp/emacs-lisp/bytecomp.el
lisp/files.el

index b3ea9300b01f31ded7a850e54995b3aa31717de6..07476f1ac9634dc29fab4b5314fa895426d14337 100644 (file)
 (require 'backquote)
 (require 'macroexp)
 (require 'cconv)
-(require 'cl-lib)
-
-;; During bootstrap, cl-loaddefs.el is not created yet, so loading cl-lib
-;; doesn't setup autoloads for things like cl-every, which is why we have to
-;; require cl-extra as well (bug#18804).
-(or (fboundp 'cl-every)
-    (require 'cl-extra))
-
-(or (fboundp 'defsubst)
-    ;; This really ought to be loaded already!
-    (load "byte-run"))
+;; Refrain from using cl-lib at run-time here, since it otherwise prevents
+;; us from emitting warnings when compiling files which use cl-lib without
+;; requiring it! (bug#30635)
+(eval-when-compile (require 'cl-lib))
 
 ;; The feature of compiling in a specific target Emacs version
 ;; has been turned off because compile time options are a bad idea.
@@ -3582,7 +3575,8 @@ These implicitly `and' together a bunch of two-arg bytecodes."
     (cond
      ((< l 3) (byte-compile-form `(progn ,(nth 1 form) t)))
      ((= l 3) (byte-compile-two-args form))
-     ((cl-every #'macroexp-copyable-p (nthcdr 2 form))
+     ;; Don't use `cl-every' here (see comment where we require cl-lib).
+     ((not (memq nil (mapcar #'macroexp-copyable-p (nthcdr 2 form))))
       (byte-compile-form `(and (,(car form) ,(nth 1 form) ,(nth 2 form))
                               (,(car form) ,@(nthcdr 2 form)))))
      (t (byte-compile-normal-call form)))))
index 8ec2bde5880516f8c09209c67704bb8763d03b1a..46a105a36f0729fa99801936fb2a17848dcb18a1 100644 (file)
@@ -4018,7 +4018,6 @@ DIR is the absolute name of a directory which must contain at
 least one dir-local file (which is a file holding variables to
 apply).
 Return the new class name, which is a symbol named DIR."
-  (require 'map)
   (let* ((class-name (intern dir))
          (files (dir-locals--all-files dir))
          (read-circle nil)
@@ -4033,12 +4032,19 @@ Return the new class name, which is a symbol named DIR."
            (setq latest file-time)))
         (with-temp-buffer
           (insert-file-contents file)
-          (condition-case-unless-debug nil
-              (setq variables
+          (let ((newvars
+                 (condition-case-unless-debug nil
+                     (read (current-buffer))
+                   (end-of-file nil))))
+            (setq variables
+                  ;; Try and avoid loading `map' since that also loads cl-lib
+                  ;; which then might hamper bytecomp warnings (bug#30635).
+                  (if (not (and newvars variables))
+                      (or newvars variables)
+                    (require 'map)
                     (map-merge-with 'list (lambda (a b) (map-merge 'list a b))
                                     variables
-                                    (read (current-buffer))))
-            (end-of-file nil))))
+                                    newvars))))))
       (setq success latest))
     (dir-locals-set-class-variables class-name variables)
     (dir-locals-set-directory-class dir class-name success)