(when-let*): Warn if body is empty

* lisp/subr.el (when-let*): Warn if body is empty.
* lisp/textmodes/tex-mode.el (xref-backend-references): Fix use of
`when-let*`.
This commit is contained in:
Stefan Monnier 2025-01-25 10:39:12 -05:00
parent 6016967e85
commit 442d04081b
2 changed files with 5 additions and 3 deletions

View file

@ -2650,7 +2650,9 @@ The variable list VARLIST is the same as in `if-let*'.
See also `and-let*'."
(declare (indent 1) (debug if-let*))
(list 'if-let* varlist (macroexp-progn body)))
(let ((res (list 'if-let* varlist (macroexp-progn body))))
(if body res
(macroexp-warn-and-return "Empty body" res 'empty-body))))
(defmacro and-let* (varlist &rest body)
"Bind variables according to VARLIST and conditionally evaluate BODY.

View file

@ -4020,8 +4020,8 @@ There might be text before point."
(ext (file-name-extension fbuf))
(finext (concat "*." ext))
((not (seq-find (lambda (elt) (string-match-p elt finext))
extlist-new)))
((push finext extlist-new)))))
extlist-new))))
(push finext extlist-new)))
(unless (seq-set-equal-p extlist-new extlist)
(setf (alist-get mode semantic-symref-filepattern-alist)
extlist-new))))