{"action":"created","issue":{"url":"https://api.github.com/repos/magnars/dash.el/issues/142","labels_url":"https://api.github.com/repos/magnars/dash.el/issues/142/labels{/name}","comments_url":"https://api.github.com/repos/magnars/dash.el/issues/142/comments","events_url":"https://api.github.com/repos/magnars/dash.el/issues/142/events","html_url":"https://github.com/magnars/dash.el/issues/142","id":82758024,"number":142,"title":"Nested `when-let`s break edebug","user":{"login":"cpitclaudel","id":8181630,"avatar_url":"https://avatars.githubusercontent.com/u/8181630?v=3","gravatar_id":"","url":"https://api.github.com/users/cpitclaudel","html_url":"https://github.com/cpitclaudel","followers_url":"https://api.github.com/users/cpitclaudel/followers","following_url":"https://api.github.com/users/cpitclaudel/following{/other_user}","gists_url":"https://api.github.com/users/cpitclaudel/gists{/gist_id}","starred_url":"https://api.github.com/users/cpitclaudel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cpitclaudel/subscriptions","organizations_url":"https://api.github.com/users/cpitclaudel/orgs","repos_url":"https://api.github.com/users/cpitclaudel/repos","events_url":"https://api.github.com/users/cpitclaudel/events{/privacy}","received_events_url":"https://api.github.com/users/cpitclaudel/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-05-30T09:06:20Z","updated_at":"2015-05-30T09:24:14Z","closed_at":null,"body":"Pressing <kbd>C-u C-M-x</kdb> on the following definition causes the error shown below:\r\n\r\n```elisp\r\n(defun nested-when-lets ()\r\n  (-when-let ((a (-when-let ((b 1)) 2))) 3))\r\n```\r\n\r\nThe error does not occur if using the standard `when-let` in Emacs 25.0.\r\n\r\n```\r\nDebugger entered--Lisp error: (invalid-read-syntax \"Expected form\")\r\n  signal(invalid-read-syntax (\"Expected form\"))\r\n  edebug-syntax-error(\"Expected form\")\r\n  apply(edebug-syntax-error \"Expected form\")\r\n  edebug-no-match((nil . 11016) \"Expected form\")\r\n  apply(edebug-no-match (nil . 11016) \"Expected form\")\r\n  edebug-top-element-required((nil . 11016) \"Expected form\")\r\n  edebug-form((nil . 11016))\r\n  edebug-match-form((nil . 11016))\r\n  edebug-match-symbol((nil . 11016) form)\r\n  edebug-match-one-spec((nil . 11016) form)\r\n  edebug-match-specs((nil . 11016) (form) edebug-match-specs)\r\n  edebug-match-specs((nil . 11016) (sexp form) edebug-match-specs)\r\n  edebug-match-sublist((nil . 11016) (sexp form))\r\n  edebug-match-list(((((b 1)) 2) (11009 (11010 (11011 . 11012) (11013 . 11014) . 11015) . 11016) (11017 . 11018) . 11019) (sexp form))\r\n  edebug-match-one-spec(((((b 1)) 2) (11009 (11010 (11011 . 11012) (11013 . 11014) . 11015) . 11016) (11017 . 11018) . 11019) (sexp form))\r\n  edebug-match-specs(((((b 1)) 2) (11009 (11010 (11011 . 11012) (11013 . 11014) . 11015) . 11016) (11017 . 11018) . 11019) ((sexp form) body) edebug-match-specs)\r\n  edebug-match-sublist(((((b 1)) 2) (11009 (11010 (11011 . 11012) (11013 . 11014) . 11015) . 11016) (11017 . 11018) . 11019) ((sexp form) body))\r\n  edebug-list-form(((((b 1)) 2) (11009 (11010 (11011 . 11012) (11013 . 11014) . 11015) . 11016) (11017 . 11018) . 11019))\r\n  edebug-form((((-when-let ((b 1)) 2)) (10998 (10999 . 11008) (11009 (11010 (11011 . 11012) (11013 . 11014) . 11015) . 11016) (11017 . 11018) . 11019) . 11020))\r\n  edebug-match-form((((-when-let ((b 1)) 2)) (10998 (10999 . 11008) (11009 (11010 (11011 . 11012) (11013 . 11014) . 11015) . 11016) (11017 . 11018) . 11019) . 11020))\r\n  edebug-match-symbol((((-when-let ((b 1)) 2)) (10998 (10999 . 11008) (11009 (11010 (11011 . 11012) (11013 . 11014) . 11015) . 11016) (11017 . 11018) . 11019) . 11020) form)\r\n  edebug-match-one-spec((((-when-let ((b 1)) 2)) (10998 (10999 . 11008) (11009 (11010 (11011 . 11012) (11013 . 11014) . 11015) . 11016) (11017 . 11018) . 11019) . 11020) form)\r\n  edebug-match-specs((((-when-let ((b 1)) 2)) (10998 (10999 . 11008) (11009 (11010 (11011 . 11012) (11013 . 11014) . 11015) . 11016) (11017 . 11018) . 11019) . 11020) (form) edebug-match-specs)\r\n  edebug-match-specs((((-when-let ((b 1)) 2)) (10998 (10999 . 11008) (11009 (11010 (11011 . 11012) (11013 . 11014) . 11015) . 11016) (11017 . 11018) . 11019) . 11020) (sexp form) edebug-match-specs)\r\n  edebug-match-sublist((((-when-let ((b 1)) 2)) (10998 (10999 . 11008) (11009 (11010 (11011 . 11012) (11013 . 11014) . 11015) . 11016) (11017 . 11018) . 11019) . 11020) (sexp form))\r\n  edebug-match-list((((a (-when-let ((b 1)) 2))) (10995 (10996 . 10997) (10998 (10999 . 11008) (11009 (11010 (11011 . 11012) (11013 . 11014) . 11015) . 11016) (11017 . 11018) . 11019) . 11020) . 11021) (sexp form))\r\n  edebug-match-one-spec((((a (-when-let ((b 1)) 2))) (10995 (10996 . 10997) (10998 (10999 . 11008) (11009 (11010 (11011 . 11012) (11013 . 11014) . 11015) . 11016) (11017 . 11018) . 11019) . 11020) . 11021) (sexp form))\r\n  edebug-match-specs((((a (-when-let ((b 1)) 2))) (10995 (10996 . 10997) (10998 (10999 . 11008) (11009 (11010 (11011 . 11012) (11013 . 11014) . 11015) . 11016) (11017 . 11018) . 11019) . 11020) . 11021) ((sexp form)) edebug-&rest-wrapper)\r\n  edebug-&optional-wrapper((((a (-when-let ((b 1)) 2))) (10995 (10996 . 10997) (10998 (10999 . 11008) (11009 (11010 (11011 . 11012) (11013 . 11014) . 11015) . 11016) (11017 . 11018) . 11019) . 11020) . 11021) ((sexp form)) edebug-&rest-wrapper)\r\n  edebug-&rest-wrapper((((a (-when-let ((b 1)) 2))) (10995 (10996 . 10997) (10998 (10999 . 11008) (11009 (11010 (11011 . 11012) (11013 . 11014) . 11015) . 11016) (11017 . 11018) . 11019) . 11020) . 11021) ((sexp form)) edebug-&rest-wrapper)\r\n  edebug-match-&rest((((a (-when-let ((b 1)) 2))) (10995 (10996 . 10997) (10998 (10999 . 11008) (11009 (11010 (11011 . 11012) (11013 . 11014) . 11015) . 11016) (11017 . 11018) . 11019) . 11020) . 11021) ((sexp form)))\r\n  edebug-match-specs((((a (-when-let ((b 1)) 2))) (10995 (10996 . 10997) (10998 (10999 . 11008) (11009 (11010 (11011 . 11012) (11013 . 11014) . 11015) . 11016) (11017 . 11018) . 11019) . 11020) . 11021) (&rest (sexp form)) edebug-match-specs)\r\n  edebug-match-sublist((((a (-when-let ((b 1)) 2))) (10995 (10996 . 10997) (10998 (10999 . 11008) (11009 (11010 (11011 . 11012) (11013 . 11014) . 11015) . 11016) (11017 . 11018) . 11019) . 11020) . 11021) (&rest (sexp form)))\r\n  edebug-match-list(((((a (-when-let ((b 1)) 2)))) (10994 (10995 (10996 . 10997) (10998 (10999 . 11008) (11009 (11010 (11011 . 11012) (11013 . 11014) . 11015) . 11016) (11017 . 11018) . 11019) . 11020) . 11021) . 11022) (&rest (sexp form)))\r\n  edebug-match-one-spec(((((a (-when-let ((b 1)) 2)))) (10994 (10995 (10996 . 10997) (10998 (10999 . 11008) (11009 (11010 (11011 . 11012) (11013 . 11014) . 11015) . 11016) (11017 . 11018) . 11019) . 11020) . 11021) . 11022) (&rest (sexp form)))\r\n  edebug-match-specs(((((a (-when-let ((b 1)) 2)))) (10994 (10995 (10996 . 10997) (10998 (10999 . 11008) (11009 (11010 (11011 . 11012) (11013 . 11014) . 11015) . 11016) (11017 . 11018) . 11019) . 11020) . 11021) . 11022) ((&rest (sexp form)) body) edebug-match-specs)\r\n  edebug-match-sublist(((((a (-when-let ((b 1)) 2)))) (10994 (10995 (10996 . 10997) (10998 (10999 . 11008) (11009 (11010 (11011 . 11012) (11013 . 11014) . 11015) . 11016) (11017 . 11018) . 11019) . 11020) . 11021) . 11022) ((&rest (sexp form)) body))\r\n  edebug-list-form(((((a (-when-let ((b 1)) 2)))) (10994 (10995 (10996 . 10997) (10998 (10999 . 11008) (11009 (11010 (11011 . 11012) (11013 . 11014) . 11015) . 11016) (11017 . 11018) . 11019) . 11020) . 11021) . 11022))\r\n  edebug-form((((-when-let* ((a (-when-let ((b 1)) 2))))) (10982 (10983 . 10993) (10994 (10995 (10996 . 10997) (10998 (10999 . 11008) (11009 (11010 (11011 . 11012) (11013 . 11014) . 11015) . 11016) (11017 . 11018) . 11019) . 11020) . 11021) . 11022) . 11023))\r\n  edebug-match-form((((-when-let* ((a (-when-let ((b 1)) 2))))) (10982 (10983 . 10993) (10994 (10995 (10996 . 10997) (10998 (10999 . 11008) (11009 (11010 (11011 . 11012) (11013 . 11014) . 11015) . 11016) (11017 . 11018) . 11019) . 11020) . 11021) . 11022) . 11023))\r\n  edebug-match-symbol((((-when-let* ((a (-when-let ((b 1)) 2))))) (10982 (10983 . 10993) (10994 (10995 (10996 . 10997) (10998 (10999 . 11008) (11009 (11010 (11011 . 11012) (11013 . 11014) . 11015) . 11016) (11017 . 11018) . 11019) . 11020) . 11021) . 11022) . 11023) form)\r\n  edebug-match-one-spec((((-when-let* ((a (-when-let ((b 1)) 2))))) (10982 (10983 . 10993) (10994 (10995 (10996 . 10997) (10998 (10999 . 11008) (11009 (11010 (11011 . 11012) (11013 . 11014) . 11015) . 11016) (11017 . 11018) . 11019) . 11020) . 11021) . 11022) . 11023) form)\r\n  edebug-match-specs((((-when-let* ((a (-when-let ((b 1)) 2))))) (10982 (10983 . 10993) (10994 (10995 (10996 . 10997) (10998 (10999 . 11008) (11009 (11010 (11011 . 11012) (11013 . 11014) . 11015) . 11016) (11017 . 11018) . 11019) . 11020) . 11021) . 11022) . 11023) (form) edebug-&rest-wrapper)\r\n  edebug-&optional-wrapper((((-when-let* ((a (-when-let ((b 1)) 2))))) (10982 (10983 . 10993) (10994 (10995 (10996 . 10997) (10998 (10999 . 11008) (11009 (11010 (11011 . 11012) (11013 . 11014) . 11015) . 11016) (11017 . 11018) . 11019) . 11020) . 11021) . 11022) . 11023) (form) edebug-&rest-wrapper)\r\n  edebug-&rest-wrapper((((-when-let* ((a (-when-let ((b 1)) 2))))) (10982 (10983 . 10993) (10994 (10995 (10996 . 10997) (10998 (10999 . 11008) (11009 (11010 (11011 . 11012) (11013 . 11014) . 11015) . 11016) (11017 . 11018) . 11019) . 11020) . 11021) . 11022) . 11023) (form) edebug-&rest-wrapper)\r\n  edebug-match-&rest((((-when-let* ((a (-when-let ((b 1)) 2))))) (10982 (10983 . 10993) (10994 (10995 (10996 . 10997) (10998 (10999 . 11008) (11009 (11010 (11011 . 11012) (11013 . 11014) . 11015) . 11016) (11017 . 11018) . 11019) . 11020) . 11021) . 11022) . 11023) (form))\r\n  edebug-match-specs((((-when-let* ((a (-when-let ((b 1)) 2))))) (10982 (10983 . 10993) (10994 (10995 (10996 . 10997) (10998 (10999 . 11008) (11009 (11010 (11011 . 11012) (11013 . 11014) . 11015) . 11016) (11017 . 11018) . 11019) . 11020) . 11021) . 11022) . 11023) (&rest form) edebug-match-specs)\r\n  edebug-match((((-when-let* ((a (-when-let ((b 1)) 2))))) (10982 (10983 . 10993) (10994 (10995 (10996 . 10997) (10998 (10999 . 11008) (11009 (11010 (11011 . 11012) (11013 . 11014) . 11015) . 11016) (11017 . 11018) . 11019) . 11020) . 11021) . 11022) . 11023) (&rest form))\r\n  edebug-match-def-body((((-when-let* ((a (-when-let ((b 1)) 2))))) (10982 (10983 . 10993) (10994 (10995 (10996 . 10997) (10998 (10999 . 11008) (11009 (11010 (11011 . 11012) (11013 . 11014) . 11015) . 11016) (11017 . 11018) . 11019) . 11020) . 11021) . 11022) . 11023))\r\n  edebug-match-symbol((((-when-let* ((a (-when-let ((b 1)) 2))))) (10982 (10983 . 10993) (10994 (10995 (10996 . 10997) (10998 (10999 . 11008) (11009 (11010 (11011 . 11012) (11013 . 11014) . 11015) . 11016) (11017 . 11018) . 11019) . 11020) . 11021) . 11022) . 11023) def-body)\r\n  edebug-match-one-spec((((-when-let* ((a (-when-let ((b 1)) 2))))) (10982 (10983 . 10993) (10994 (10995 (10996 . 10997) (10998 (10999 . 11008) (11009 (11010 (11011 . 11012) (11013 . 11014) . 11015) . 11016) (11017 . 11018) . 11019) . 11020) . 11021) . 11022) . 11023) def-body)\r\n  edebug-match-specs((((-when-let* ((a (-when-let ((b 1)) 2))))) (10982 (10983 . 10993) (10994 (10995 (10996 . 10997) (10998 (10999 . 11008) (11009 (11010 (11011 . 11012) (11013 . 11014) . 11015) . 11016) (11017 . 11018) . 11019) . 11020) . 11021) . 11022) . 11023) (def-body) edebug-match-specs)\r\n  edebug-match-specs((((-when-let* ((a (-when-let ((b 1)) 2))))) (10982 (10983 . 10993) (10994 (10995 (10996 . 10997) (10998 (10999 . 11008) (11009 (11010 (11011 . 11012) (11013 . 11014) . 11015) . 11016) (11017 . 11018) . 11019) . 11020) . 11021) . 11022) . 11023) ([&optional (\"interactive\" interactive)] def-body) edebug-match-specs)\r\n  edebug-match-specs((((-when-let* ((a (-when-let ((b 1)) 2))))) (10982 (10983 . 10993) (10994 (10995 (10996 . 10997) (10998 (10999 . 11008) (11009 (11010 (11011 . 11012) (11013 . 11014) . 11015) . 11016) (11017 . 11018) . 11019) . 11020) . 11021) . 11022) . 11023) ([&optional stringp] [&optional (\"interactive\" interactive)] def-body) edebug-match-specs)\r\n  edebug-match-specs((((-when-let* ((a (-when-let ((b 1)) 2))))) (10982 (10983 . 10993) (10994 (10995 (10996 . 10997) (10998 (10999 . 11008) (11009 (11010 (11011 . 11012) (11013 . 11014) . 11015) . 11016) (11017 . 11018) . 11019) . 11020) . 11021) . 11022) . 11023) (lambda-list [&optional stringp] [&optional (\"interactive\" interactive)] def-body) edebug-match-specs)\r\n  edebug-match-specs((((-when-let* ((a (-when-let ((b 1)) 2))))) (10982 (10983 . 10993) (10994 (10995 (10996 . 10997) (10998 (10999 . 11008) (11009 (11010 (11011 . 11012) (11013 . 11014) . 11015) . 11016) (11017 . 11018) . 11019) . 11020) . 11021) . 11022) . 11023) (name lambda-list [&optional stringp] [&optional (\"interactive\" interactive)] def-body) edebug-match-specs)\r\n  edebug-match-specs((((-when-let* ((a (-when-let ((b 1)) 2))))) (10982 (10983 . 10993) (10994 (10995 (10996 . 10997) (10998 (10999 . 11008) (11009 (11010 (11011 . 11012) (11013 . 11014) . 11015) . 11016) (11017 . 11018) . 11019) . 11020) . 11021) . 11022) . 11023) (\"defun\" name lambda-list [&optional stringp] [&optional (\"interactive\" interactive)] def-body) edebug-match-specs)\r\n  edebug-match-sublist((((-when-let* ((a (-when-let ((b 1)) 2))))) (10982 (10983 . 10993) (10994 (10995 (10996 . 10997) (10998 (10999 . 11008) (11009 (11010 (11011 . 11012) (11013 . 11014) . 11015) . 11016) (11017 . 11018) . 11019) . 11020) . 11021) . 11022) . 11023) (\"defun\" name lambda-list [&optional stringp] [&optional (\"interactive\" interactive)] def-body))\r\n  edebug-match-list((((defun nested-when-lets nil (-when-let* ((a (-when-let (...) 2)))))) (10953 (10954 . 10959) (10960 . 10976) (10977 . 10979) (10982 (10983 . 10993) (10994 (10995 (10996 . 10997) (10998 (10999 . 11008) (11009 (11010 ... ... . 11015) . 11016) (11017 . 11018) . 11019) . 11020) . 11021) . 11022) . 11023)) (\"defun\" name lambda-list [&optional stringp] [&optional (\"interactive\" interactive)] def-body))\r\n  edebug-match-one-spec((((defun nested-when-lets nil (-when-let* ((a (-when-let (...) 2)))))) (10953 (10954 . 10959) (10960 . 10976) (10977 . 10979) (10982 (10983 . 10993) (10994 (10995 (10996 . 10997) (10998 (10999 . 11008) (11009 (11010 ... ... . 11015) . 11016) (11017 . 11018) . 11019) . 11020) . 11021) . 11022) . 11023)) (\"defun\" name lambda-list [&optional stringp] [&optional (\"interactive\" interactive)] def-body))\r\n  edebug-match-specs((((defun nested-when-lets nil (-when-let* ((a (-when-let (...) 2)))))) (10953 (10954 . 10959) (10960 . 10976) (10977 . 10979) (10982 (10983 . 10993) (10994 (10995 (10996 . 10997) (10998 (10999 . 11008) (11009 (11010 ... ... . 11015) . 11016) (11017 . 11018) . 11019) . 11020) . 11021) . 11022) . 11023)) ((\"defun\" name lambda-list [&optional stringp] [&optional (\"interactive\" interactive)] def-body)) edebug-match-specs)\r\n  edebug-match((((defun nested-when-lets nil (-when-let* ((a (-when-let (...) 2)))))) (10953 (10954 . 10959) (10960 . 10976) (10977 . 10979) (10982 (10983 . 10993) (10994 (10995 (10996 . 10997) (10998 (10999 . 11008) (11009 (11010 ... ... . 11015) . 11016) (11017 . 11018) . 11019) . 11020) . 11021) . 11022) . 11023)) ((\"defun\" name lambda-list [&optional stringp] [&optional (\"interactive\" interactive)] def-body)))\r\n  edebug-make-form-wrapper((((defun nested-when-lets nil (-when-let* ((a (-when-let (...) 2)))))) (10953 (10954 . 10959) (10960 . 10976) (10977 . 10979) (10982 (10983 . 10993) (10994 (10995 (10996 . 10997) (10998 (10999 . 11008) (11009 (11010 ... ... . 11015) . 11016) (11017 . 11018) . 11019) . 11020) . 11021) . 11022) . 11023)) 10953 11022 ((\"defun\" name lambda-list [&optional stringp] [&optional (\"interactive\" interactive)] def-body)))\r\n  edebug-read-and-maybe-wrap-form1()\r\n  edebug-read-and-maybe-wrap-form()\r\n  edebug-read-top-level-form()\r\n  edebug-eval-defun((4))\r\n  apply(edebug-eval-defun (4))\r\n  eval-defun((4))\r\n  funcall-interactively(eval-defun (4))\r\n  #<subr call-interactively>(eval-defun nil nil)\r\n  ad-Advice-call-interactively(#<subr call-interactively> eval-defun nil nil)\r\n  apply(ad-Advice-call-interactively #<subr call-interactively> (eval-defun nil nil))\r\n  call-interactively(eval-defun nil nil)\r\n  command-execute(eval-defun)\r\n```\r\n\r\nThanks!"},"comment":{"url":"https://api.github.com/repos/magnars/dash.el/issues/comments/107016390","html_url":"https://github.com/magnars/dash.el/issues/142#issuecomment-107016390","issue_url":"https://api.github.com/repos/magnars/dash.el/issues/142","id":107016390,"user":{"login":"cpitclaudel","id":8181630,"avatar_url":"https://avatars.githubusercontent.com/u/8181630?v=3","gravatar_id":"","url":"https://api.github.com/users/cpitclaudel","html_url":"https://github.com/cpitclaudel","followers_url":"https://api.github.com/users/cpitclaudel/followers","following_url":"https://api.github.com/users/cpitclaudel/following{/other_user}","gists_url":"https://api.github.com/users/cpitclaudel/gists{/gist_id}","starred_url":"https://api.github.com/users/cpitclaudel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cpitclaudel/subscriptions","organizations_url":"https://api.github.com/users/cpitclaudel/orgs","repos_url":"https://api.github.com/users/cpitclaudel/repos","events_url":"https://api.github.com/users/cpitclaudel/events{/privacy}","received_events_url":"https://api.github.com/users/cpitclaudel/received_events","type":"User","site_admin":false},"created_at":"2015-05-30T09:24:14Z","updated_at":"2015-05-30T09:24:14Z","body":"Ah, I see! Is there a reason to deviate from the plain Emacs one?\r\n\r\n```\r\n(defmacro when-let (bindings &rest body)\r\n  \"Process BINDINGS and if all values are non-nil eval BODY.\r\nArgument BINDINGS is a list of tuples whose car is a symbol to be\r\nbound and (optionally) used in BODY, and its cadr is a sexp to be\r\nevalled to set symbol's value.  In the special case you only want\r\nto bind a single value, BINDINGS can just be a plain tuple.\"\r\n  (declare (indent 1) (debug if-let))\r\n  (list 'if-let bindings (macroexp-progn body)))\r\n``` \r\n\r\nA small note: I initially found the docs a bit confusing; I wasn't entirely sure after reading them that if the first form in `-when-let*` is nil, the others wouldn't be evalled.\r\n\r\nThanks for the quick answer!"}}