Subject: Re: bug#20525: 25.0.50; edebug doesn't cooperate with when-let

From: Artur Malabarba <[email-masked]>
Date: Thu, 7 May 2015 21:16:10 +0100

Fixed by setting the debug spec to ([&or (&rest (symbolp form))
(symbolp form)] form body)

3a33ac8 * lisp/emacs-lisp/subr-x.el (if-let): Fix debug spec

2015-05-07 16:33 GMT+01:00 Aaron Ecay <[email-masked]>:
>
> Edebug does not play well with the single-binding form of the when-let
> macro.  This is with git rev 08431a20c55 (and seems to have been the
> case on master for several months, possibly since the introduction of
> the when-let macro).
>
> Steps to reproduce in emacs -Q:
>
> Evaluate in scratch buffer:
>
> (require 'subr-x)
> (setq debug-on-error t)
>
> Then write:
>
> (defun awe-test ()
>   (when-let ((foo t))
>     foo))
>
> Put point inside the defun and C-u C-M-x.  All works fine.
>
> Remove the outer set of parentheses on the binding, as the when-let
> docstring says is possible (“In the special case you only want to bind a
> single value, BINDINGS can just be a plain tuple.”):
>
> (defun awe-test ()
>   (when-let (foo t)
>     foo))
>
> C-u C-M-x leads to the backtrace reproduced below.
>
> Thanks,
> Aaron
>
> Debugger entered--Lisp error: (invalid-read-syntax "Failed matching" (&rest (symbolp form)))
>   signal(invalid-read-syntax ("Failed matching" (&rest (symbolp form))))
>   edebug-syntax-error("Failed matching" (&rest (symbolp form)))
>   apply(edebug-syntax-error ("Failed matching" (&rest (symbolp form))))
>   edebug-no-match(((foo t) (243 . 246) (247 . 248) . 249) "Failed matching" (&rest (symbolp form)))
>   edebug-match-sublist(((foo t) (243 . 246) (247 . 248) . 249) (&rest (symbolp form)))
>   edebug-match-list((((foo t) foo) (242 (243 . 246) (247 . 248) . 249) (254 . 257) . 258) (&rest (symbolp form)))
>   edebug-match-one-spec((((foo t) foo) (242 (243 . 246) (247 . 248) . 249) (254 . 257) . 258) (&rest (symbolp form)))
>   edebug-match-specs((((foo t) foo) (242 (243 . 246) (247 . 248) . 249) (254 . 257) . 258) ((&rest (symbolp form)) form body) edebug-match-specs)
>   edebug-match-sublist((((foo t) foo) (242 (243 . 246) (247 . 248) . 249) (254 . 257) . 258) ((&rest (symbolp form)) form body))
>   edebug-list-form((((foo t) foo) (242 (243 . 246) (247 . 248) . 249) (254 . 257) . 258))
>   edebug-form((((when-let (foo t) foo)) (232 (233 . 241) (242 (243 . 246) (247 . 248) . 249) (254 . 257) . 258) . 259))
>   edebug-match-form((((when-let (foo t) foo)) (232 (233 . 241) (242 (243 . 246) (247 . 248) . 249) (254 . 257) . 258) . 259))
>   edebug-match-symbol((((when-let (foo t) foo)) (232 (233 . 241) (242 (243 . 246) (247 . 248) . 249) (254 . 257) . 258) . 259) form)
>   edebug-match-one-spec((((when-let (foo t) foo)) (232 (233 . 241) (242 (243 . 246) (247 . 248) . 249) (254 . 257) . 258) . 259) form)
>   edebug-match-specs((((when-let (foo t) foo)) (232 (233 . 241) (242 (243 . 246) (247 . 248) . 249) (254 . 257) . 258) . 259) (form) edebug-&rest-wrapper)
>   edebug-&optional-wrapper((((when-let (foo t) foo)) (232 (233 . 241) (242 (243 . 246) (247 . 248) . 249) (254 . 257) . 258) . 259) (form) edebug-&rest-wrapper)
>   edebug-&rest-wrapper((((when-let (foo t) foo)) (232 (233 . 241) (242 (243 . 246) (247 . 248) . 249) (254 . 257) . 258) . 259) (form) edebug-&rest-wrapper)
>   edebug-match-&rest((((when-let (foo t) foo)) (232 (233 . 241) (242 (243 . 246) (247 . 248) . 249) (254 . 257) . 258) . 259) (form))
>   edebug-match-specs((((when-let (foo t) foo)) (232 (233 . 241) (242 (243 . 246) (247 . 248) . 249) (254 . 257) . 258) . 259) (&rest form) edebug-match-specs)
>   edebug-match((((when-let (foo t) foo)) (232 (233 . 241) (242 (243 . 246) (247 . 248) . 249) (254 . 257) . 258) . 259) (&rest form))
>   edebug-match-def-body((((when-let (foo t) foo)) (232 (233 . 241) (242 (243 . 246) (247 . 248) . 249) (254 . 257) . 258) . 259))
>   edebug-match-symbol((((when-let (foo t) foo)) (232 (233 . 241) (242 (243 . 246) (247 . 248) . 249) (254 . 257) . 258) . 259) def-body)
>   edebug-match-one-spec((((when-let (foo t) foo)) (232 (233 . 241) (242 (243 . 246) (247 . 248) . 249) (254 . 257) . 258) . 259) def-body)
>   edebug-match-specs((((when-let (foo t) foo)) (232 (233 . 241) (242 (243 . 246) (247 . 248) . 249) (254 . 257) . 258) . 259) (def-body) edebug-match-specs)
>   edebug-match-specs((((when-let (foo t) foo)) (232 (233 . 241) (242 (243 . 246) (247 . 248) . 249) (254 . 257) . 258) . 259) ([&optional ("interactive" interactive)] def-body) edebug-match-specs)
>   edebug-match-specs((((when-let (foo t) foo)) (232 (233 . 241) (242 (243 . 246) (247 . 248) . 249) (254 . 257) . 258) . 259) ([&optional stringp] [&optional ("interactive" interactive)] def-body) edebug-match-specs)
>   edebug-match-specs((((when-let (foo t) foo)) (232 (233 . 241) (242 (243 . 246) (247 . 248) . 249) (254 . 257) . 258) . 259) (lambda-list [&optional stringp] [&optional ("interactive" interactive)] def-body) edebug-match-specs)
>   edebug-match-specs((((when-let (foo t) foo)) (232 (233 . 241) (242 (243 . 246) (247 . 248) . 249) (254 . 257) . 258) . 259) (name lambda-list [&optional stringp] [&optional ("interactive" interactive)] def-body) edebug-match-specs)
>   edebug-match-specs((((when-let (foo t) foo)) (232 (233 . 241) (242 (243 . 246) (247 . 248) . 249) (254 . 257) . 258) . 259) ("defun" name lambda-list [&optional stringp] [&optional ("interactive" interactive)] def-body) edebug-match-specs)
>   edebug-match-sublist((((when-let (foo t) foo)) (232 (233 . 241) (242 (243 . 246) (247 . 248) . 249) (254 . 257) . 258) . 259) ("defun" name lambda-list [&optional stringp] [&optional ("interactive" interactive)] def-body))
>   edebug-match-list((((defun awe-test nil (when-let (foo t) foo))) (211 (212 . 217) (218 . 226) (227 . 229) (232 (233 . 241) (242 (243 . 246) (247 . 248) . 249) (254 . 257) . 258) . 259)) ("defun" name lambda-list [&optional stringp] [&optional ("interactive" interactive)] def-body))
>   edebug-match-one-spec((((defun awe-test nil (when-let (foo t) foo))) (211 (212 . 217) (218 . 226) (227 . 229) (232 (233 . 241) (242 (243 . 246) (247 . 248) . 249) (254 . 257) . 258) . 259)) ("defun" name lambda-list [&optional stringp] [&optional ("interactive" interactive)] def-body))
>   edebug-match-specs((((defun awe-test nil (when-let (foo t) foo))) (211 (212 . 217) (218 . 226) (227 . 229) (232 (233 . 241) (242 (243 . 246) (247 . 248) . 249) (254 . 257) . 258) . 259)) (("defun" name lambda-list [&optional stringp] [&optional ("interactive" interactive)] def-body)) edebug-match-specs)
>   edebug-match((((defun awe-test nil (when-let (foo t) foo))) (211 (212 . 217) (218 . 226) (227 . 229) (232 (233 . 241) (242 (243 . 246) (247 . 248) . 249) (254 . 257) . 258) . 259)) (("defun" name lambda-list [&optional stringp] [&optional ("interactive" interactive)] def-body)))
>   edebug-make-form-wrapper((((defun awe-test nil (when-let (foo t) foo))) (211 (212 . 217) (218 . 226) (227 . 229) (232 (233 . 241) (242 (243 . 246) (247 . 248) . 249) (254 . 257) . 258) . 259)) 211 258 (("defun" name lambda-list [&optional stringp] [&optional ("interactive" interactive)] def-body)))
>   edebug-read-and-maybe-wrap-form1()
>   edebug-read-and-maybe-wrap-form()
>   edebug-read-top-level-form()
>   edebug-eval-defun((4))
>   apply(edebug-eval-defun (4))
>   eval-defun((4))
>   funcall-interactively(eval-defun (4))
>   call-interactively(eval-defun nil nil)
>   command-execute(eval-defun)
>
> In GNU Emacs 25.0.50.2 (x86_64-unknown-linux-gnu, GTK+ Version 3.16.2)
>  of 2015-05-03 on haize
> Windowing system distributor `The X.Org Foundation', version 11.0.11701000
> Configured using:
>  `configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
>  --localstatedir=/var --mandir=/usr/share/man
>  --pdfdir=/usr/share/doc/emacs/pdf --with-sound=alsa --without-gconf
>  --with-x-toolkit=gtk3 --with-xft 'CFLAGS=-march=x86-64 -mtune=generic
>  -O2 -pipe -fstack-protector --param=ssp-buffer-size=4'
>  CPPFLAGS=-D_FORTIFY_SOURCE=2
>  LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro'
>
> Configured features:
> XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY
> ACL GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
>
> Important settings:
>   value of $LC_COLLATE: C
>   value of $LANG: en_US.UTF-8
>   locale-coding-system: utf-8-unix
>
>
>
> --
> Aaron Ecay
>
>
>