Merge branch 'master' into scratch/correct-warning-pos

Merge branch:
commit d29291d665 (HEAD -> master,
origin/master, origin/HEAD)
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Date:   Fri Jan 14 12:26:30 2022 -0500

    (macroexp--expand-all): Fix bug#53227 and bug#46636
This commit is contained in:
Alan Mackenzie 2022-01-14 19:28:07 +00:00
commit d87a34597c
73 changed files with 3248 additions and 311 deletions

View file

@ -697,7 +697,11 @@ Valid keywords and arguments are:
(defmacro easy-mmode-defmap (m bs doc &rest args)
"Define a constant M whose value is the result of `easy-mmode-define-keymap'.
The M, BS, and ARGS arguments are as per that function. DOC is
the constant's documentation."
the constant's documentation.
This macro is deprecated; use `defvar-keymap' instead."
;; FIXME: Declare obsolete in favor of `defvar-keymap'. It is still
;; used for `gud-menu-map' and `gud-minor-mode-map', so fix that first.
(declare (doc-string 3) (indent 1))
`(defconst ,m
(easy-mmode-define-keymap ,bs nil (if (boundp ',m) ,m) ,(cons 'list args))

View file

@ -335,15 +335,20 @@ It should only be stopped when ran from inside `ert--run-test-internal'."
(unless (eql ,value ',default-value)
(list :value ,value))
(unless (eql ,value ',default-value)
(let ((-explainer-
(and (symbolp ',fn-name)
(get ',fn-name 'ert-explainer))))
(when -explainer-
(list :explanation
(apply -explainer- ,args))))))
(when-let ((-explainer-
(ert--get-explainer ',fn-name)))
(list :explanation
(apply -explainer- ,args)))))
value)
,value))))))))
(defun ert--get-explainer (fn-name)
(when (symbolp fn-name)
(cl-loop for fn in (cons fn-name (function-alias-p fn-name))
for explainer = (get fn 'ert-explainer)
when explainer
return explainer)))
(defun ert--expand-should (whole form inner-expander)
"Helper function for the `should' macro and its variants.

View file

@ -71,7 +71,7 @@
(defmacro inline-quote (_exp)
"Similar to backquote, but quotes code and only accepts , and not ,@."
(declare (debug backquote-form))
(declare (debug (backquote-form)))
(error "inline-quote can only be used within define-inline"))
(defmacro inline-const-p (_exp)

View file

@ -382,14 +382,17 @@ Assumes the caller has bound `macroexpand-all-environment'."
(macroexp--all-forms args)
form)
(macroexp--expand-all newform))))
(`(funcall . ,(or `(,exp . ,args) pcase--dontcare))
(`(funcall ,exp . ,args)
(let ((eexp (macroexp--expand-all exp))
(eargs (macroexp--all-forms args)))
;; Rewrite (funcall #'foo bar) to (foo bar), in case `foo'
;; has a compiler-macro, or to unfold it.
(pcase eexp
(`#',f (macroexp--expand-all `(,f . ,eargs)))
((and `#',f
(guard (not (or (special-form-p f) (macrop f))))) ;; bug#46636
(macroexp--expand-all `(,f . ,eargs)))
(_ `(funcall ,eexp . ,eargs)))))
(`(funcall . ,_) form) ;bug#53227
(`(,func . ,_)
(let ((handler (function-get func 'compiler-macro))
(funargs (function-get func 'funarg-positions)))
@ -430,7 +433,6 @@ Assumes the caller has bound `macroexpand-all-environment'."
newform
(macroexp--expand-all newform)))
(macroexp--expand-all newform))))))
(_ form)))
(pop byte-compile-form-stack)))

View file

@ -1299,6 +1299,9 @@ If FUNCTION is non-nil, place point on the entry for FUNCTION (if any)."
(text-property-search-forward 'shortdoc-function function t)
(beginning-of-line)))
;;;###autoload
(defalias 'shortdoc #'shortdoc-display-group)
(defun shortdoc--display-function (data)
(let ((function (pop data))
(start-section (point))