]> git.eshelyaron.com Git - emacs.git/commitdiff
Merge branch 'master' into feature/named-lambdas
authorAlan Mackenzie <acm@muc.de>
Thu, 5 Oct 2023 19:42:13 +0000 (19:42 +0000)
committerAlan Mackenzie <acm@muc.de>
Thu, 5 Oct 2023 19:42:13 +0000 (19:42 +0000)
15 files changed:
1  2 
lisp/emacs-lisp/byte-run.el
lisp/emacs-lisp/bytecomp.el
lisp/emacs-lisp/cl-macs.el
lisp/emacs-lisp/cl-print.el
lisp/emacs-lisp/comp.el
lisp/emacs-lisp/ert.el
lisp/emacs-lisp/macroexp.el
lisp/emacs-lisp/oclosure.el
lisp/help.el
lisp/progmodes/elisp-mode.el
lisp/simple.el
lisp/subr.el
src/data.c
src/lisp.h
test/lisp/emacs-lisp/bytecomp-tests.el

Simple merge
index 30c2480018a615e1da9a6e0f0019eddded5e51b6,72697fb73e19ad17f664635b00a991e529f765f4..2579d691bdc789d8508e24a0a51b759e5a559c3d
@@@ -1798,19 -1753,13 +1753,19 @@@ It is too wide if it has any lines long
           (setq docs (nth 3 form)))
          ('lambda
            (setq kind "")          ; can't be "function", unfortunately
 -          (setq docs (nth 2 form))))
 +          (let* ((definer (and (cadr form) (symbolp (cadr form))))
 +                 (docstring (nth (if definer 3 2) form)))
 +            (setq docs (and (stringp docstring)
 +                            docstring)))))
 +      (when (and (consp name) (eq (car name) 'quote))
 +        (setq name (cadr name)))
 +      (setq name (if name (format " `%s' " name) ""))
        (when (and kind docs (stringp docs))
-         (when (byte-compile--wide-docstring-p docs col)
-           (byte-compile-warn-x
-            name
-            "%s%sdocstring wider than %s characters"
-            kind name col))
+         (let ((col (max byte-compile-docstring-max-column fill-column)))
+           (when (byte-compile--wide-docstring-p docs col)
+             (byte-compile-warn-x
+              name
+              "%sdocstring wider than %s characters" (funcall prefix) col)))
          ;; There's a "naked" ' character before a symbol/list, so it
          ;; should probably be quoted with \=.
          (when (string-match-p (rx (| (in " \t") bol)
Simple merge
Simple merge
Simple merge
Simple merge
index 8e35d1c205ea90f55eb35ae4da93be5f4b268c41,3ef924a5c736c75d54c7bd164c6de98934ccb115..242c71e65ad9e23ed2112b05605a95807b616546
@@@ -329,18 -329,35 +329,45 @@@ Assumes the caller has bound `macroexpa
          ;; I tried it, it broke the bootstrap :-(
          (let ((fn (car-safe form)))
            (pcase form
 +            (`(defalias ,(and `(quote ,def)
 +                              (pred (lambda (e) (and e (symbolp e)))))
 +                . ,_rest)
 +             (let ((defining-symbol def))
 +               (macroexp--all-forms form 2)))
 +            (`(,(or `defvar `defconst)
 +               ,(and def (pred (lambda (e) (and e (symbolp e)))))
 +               . ,(and _rest (pred (not null))))
 +             (let ((defining-symbol def))
 +               (macroexp--all-forms form 2)))
              (`(cond . ,clauses)
-              (macroexp--cons fn (macroexp--all-clauses clauses) form))
+              ;; Check for rubbish clauses at the end before macro-expansion,
+              ;; to avoid nuisance warnings from clauses that become
+              ;; unconditional through that process.
+              ;; FIXME: this strategy is defeated by forced `macroexpand-all',
+              ;; such as in `cl-flet'.  Haven't seen that in the wild, though.
+              (let ((default-tail nil)
+                    (n 0)
+                    (rest clauses))
+                (while rest
+                  (let ((c (car-safe (car rest))))
+                    (when (cond ((consp c) (and (memq (car c) '(quote function))
+                                                (cadr c)))
+                                ((symbolp c) (or (eq c t) (keywordp c)))
+                                (t t))
+                      ;; This is unquestionably a default clause.
+                      (setq default-tail (cdr rest))
+                      (setq clauses (take (1+ n) clauses))  ; trim the tail
+                      (setq rest nil)))
+                  (setq n (1+ n))
+                  (setq rest (cdr rest)))
+                (let ((expanded-form
+                       (macroexp--cons fn (macroexp--all-clauses clauses) form)))
+                  (if default-tail
+                      (macroexp-warn-and-return
+                       (format-message
+                        "Useless clause following default `cond' clause")
+                       expanded-form '(suspicious cond) t default-tail)
+                    expanded-form))))
              (`(condition-case . ,(or `(,err ,body . ,handlers) pcase--dontcare))
               (let ((exp-body (macroexp--expand-all body)))
                 (if handlers
Simple merge
diff --cc lisp/help.el
Simple merge
Simple merge
diff --cc lisp/simple.el
Simple merge
diff --cc lisp/subr.el
Simple merge
diff --cc src/data.c
Simple merge
diff --cc src/lisp.h
Simple merge