From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Johan =?UTF-8?Q?Bockg=C3=A5rd?= Newsgroups: gmane.emacs.bugs Subject: bug#21920: 25.0.50; describe-symbols cannot be debugged with Edebug Date: Sun, 15 Nov 2015 17:09:54 +0100 Message-ID: <87ziyfs0q5.fsf@gnu.org> References: <83twoocwqh.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1447704690 16420 80.91.229.3 (16 Nov 2015 20:11:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 16 Nov 2015 20:11:30 +0000 (UTC) Cc: 21920@debbugs.gnu.org, Stefan Monnier To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Nov 16 21:11:14 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZyQ7G-0002Vy-Op for geb-bug-gnu-emacs@m.gmane.org; Mon, 16 Nov 2015 21:11:07 +0100 Original-Received: from localhost ([::1]:48618 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZyQ7F-0005CF-Sa for geb-bug-gnu-emacs@m.gmane.org; Mon, 16 Nov 2015 15:11:05 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38603) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZxzuP-0002PI-KW for bug-gnu-emacs@gnu.org; Sun, 15 Nov 2015 11:12:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZxzuM-0006XM-Bo for bug-gnu-emacs@gnu.org; Sun, 15 Nov 2015 11:12:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:49437) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZxzuM-0006XB-96 for bug-gnu-emacs@gnu.org; Sun, 15 Nov 2015 11:12:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1ZxzuL-0007yx-MW for bug-gnu-emacs@gnu.org; Sun, 15 Nov 2015 11:12:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Johan =?UTF-8?Q?Bockg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 15 Nov 2015 16:12:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21920 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 21920-submit@debbugs.gnu.org id=B21920.144760386330614 (code B ref 21920); Sun, 15 Nov 2015 16:12:01 +0000 Original-Received: (at 21920) by debbugs.gnu.org; 15 Nov 2015 16:11:03 +0000 Original-Received: from localhost ([127.0.0.1]:39145 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZxztO-0007xi-Ac for submit@debbugs.gnu.org; Sun, 15 Nov 2015 11:11:02 -0500 Original-Received: from smtprelay-h31.telenor.se ([213.150.131.4]:41543) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Zxzt3-0007wt-49 for 21920@debbugs.gnu.org; Sun, 15 Nov 2015 11:11:00 -0500 Original-Received: from ipb1.telenor.se (ipb1.telenor.se [195.54.127.164]) by smtprelay-h31.telenor.se (Postfix) with ESMTP id 5D3FDE4AB for <21920@debbugs.gnu.org>; Sun, 15 Nov 2015 17:10:06 +0100 (CET) X-SMTPAUTH-B2: [bocjoh] X-SENDER-IP: [85.229.5.61] X-LISTENER: [smtp.bredband.net] X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2C/BAAOrUhW/z0F5VVeGQEBAg8BAQKDCx8EMGAPgl+7cAENgVsJFwqFbwKBITkUAQEBAQEBAYEKhDUBAQECAQECIDMjBQsLGgIFIQICDwEEFAQBDCQTiCYMAQioG5AEAQEBAQEFAQEBAR+BAYpRhFmCYgwuE4ExBZJng2GFHYUghQ6aIR8BAUKEBT00AYVKAQEB X-IPAS-Result: A2C/BAAOrUhW/z0F5VVeGQEBAg8BAQKDCx8EMGAPgl+7cAENgVsJFwqFbwKBITkUAQEBAQEBAYEKhDUBAQECAQECIDMjBQsLGgIFIQICDwEEFAQBDCQTiCYMAQioG5AEAQEBAQEFAQEBAR+BAYpRhFmCYgwuE4ExBZJng2GFHYUghQ6aIR8BAUKEBT00AYVKAQEB X-IronPort-AV: E=Sophos;i="5.20,297,1444687200"; d="scan'208";a="435640385" Original-Received: from c-3d05e555.04-211-6c6b701.cust.bredbandsbolaget.se (HELO muon.localdomain) ([85.229.5.61]) by ipb1.telenor.se with ESMTP; 15 Nov 2015 17:10:06 +0100 Original-Received: by muon.localdomain (Postfix, from userid 1000) id 4CB5E484203; Sun, 15 Nov 2015 17:09:54 +0100 (CET) Mail-Copies-To: never In-Reply-To: <83twoocwqh.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 14 Nov 2015 19:32:54 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:108757 Archived-At: Eli Zaretskii writes: > M-x load-file RET lisp/help-fns.el > C-x C-f lisp/help-fns.el RET > > Go to the describe-symbol function and type: > > M-x edebug-defun RET > > This signals an error: > > pcase--macroexpand: Unknown edebug-enter pattern: (edebug-enter (quote = describe-symbol) nil (function (lambda nil (edebug-after 0 80 descfn)))) That last part (pcase-QPAT) of the patch in http://lists.gnu.org/archive/html/emacs-devel/2015-10/msg02285.html should fix this. The patch also contains code to step through SYMBOL bindings as was suggested in that thread, i.e. it will make Edebug pause after x and y in (pcase '(0 1) (`(,x 2) 3) (y 4)) This may make pcase a little more easy to understand=E2=80=94which branches= it tried and where it backtracked. On the other hand it may be illogical since it would be a bit like stepping through the ARGS of lambda or destructuring-bind. Finally, here's a second patch that adds full support for stepping of `pred' and `app' patterns. It instruments each ARG (x) of FUN (+) as well as the result of FUN itself (including the hidden argument): (pcase '(1 2) (`(,x ,(pred (+ x))) t)) This completes the edebug support for pcase. diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el index 3ea519c..adac2d9 100644 --- a/lisp/emacs-lisp/pcase.el +++ b/lisp/emacs-lisp/pcase.el @@ -94,12 +94,21 @@ (defun pcase--edebug-match-macro (cursor) specs))))) (edebug-match cursor (cons '&or specs)))) =20 -(def-edebug-spec - pcase-FUN - (&or lambda-expr - ;; Punt on macros/special forms. - (functionp &rest form) - sexp)) +(def-edebug-spec pcase-FUN pcase--edebug-match-fun) +(defun pcase--edebug-match-fun (cursor) + (let ((sexp (edebug-top-element-required cursor "Expected" '(pcase-FUN))= )) + ;; FUN =3D (lambda ...) | (F ...) | F + (if (eq 'lambda (car-safe sexp)) + (list (edebug-match cursor '(lambda-expr))) + (let* ((x (make-symbol "x")) + (f (car (edebug-match cursor '(form)))) + ;; Hack edebug instrumented form. + (g (let ((e (nthcdr 3 f))) + (if (consp (car e)) + (setcdr (last (car e)) (list x)) + (setcar e (cons (car e) (list x)))) + f))) + (list `(lambda (,x) ,g)))))) =20 (def-edebug-spec pcase-PAT