From unknown Mon Jun 23 07:50:52 2025 X-Loop: help-debbugs@gnu.org Subject: bug#22294: 25.0.50; edebug should support jumping into generic methods Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 02 Jan 2016 18:54:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 22294 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 22294@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.14517608117397 (code B ref -1); Sat, 02 Jan 2016 18:54:01 +0000 Received: (at submit) by debbugs.gnu.org; 2 Jan 2016 18:53:31 +0000 Received: from localhost ([127.0.0.1]:35537 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aFRIw-0001vF-Sy for submit@debbugs.gnu.org; Sat, 02 Jan 2016 13:53:31 -0500 Received: from eggs.gnu.org ([208.118.235.92]:59382) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aFRIv-0001v3-Is for submit@debbugs.gnu.org; Sat, 02 Jan 2016 13:53:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aFRIp-0006nn-Ob for submit@debbugs.gnu.org; Sat, 02 Jan 2016 13:53:24 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.4 required=5.0 tests=BAYES_20,BODY_URI_ONLY, FREEMAIL_FROM,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:57664) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aFRIp-0006nj-Ls for submit@debbugs.gnu.org; Sat, 02 Jan 2016 13:53:23 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50353) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aFRIo-0004OO-VP for bug-gnu-emacs@gnu.org; Sat, 02 Jan 2016 13:53:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aFRIk-0006nH-1V for bug-gnu-emacs@gnu.org; Sat, 02 Jan 2016 13:53:22 -0500 Received: from mail-wm0-x232.google.com ([2a00:1450:400c:c09::232]:36878) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aFRIj-0006n4-RN for bug-gnu-emacs@gnu.org; Sat, 02 Jan 2016 13:53:17 -0500 Received: by mail-wm0-x232.google.com with SMTP id f206so164171230wmf.0 for ; Sat, 02 Jan 2016 10:53:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:date:message-id:mime-version:content-type; bh=fK92R8iipE084+9utE7lsgu8DH3ijvNlkZj/t8xuTB0=; b=PtP/8f8aTwRZWZd4rPmj/nZF7n/t4z1fwAyiMw/N8qp93NOH4rBuY4ScjHPpR5LibB Wj1uANgNzmeRC5sj9lyzCnMyKWjWaCe5eJy6PhCSMyG1fit7RG0gtsh0nYb1+3hyhyHx lL9DxswdxcMYlzD6gxK3ZuKI/DMbfMP8CE1gSsUmuqVU8ai235f5XaF8/Y2Q5/RD/kZO 5IQZM0Gqs0y00EoM5r5Cyg5773iMITmpmIasKuy67ucP+5/6jayavZ9Ob+YBMZKhwfwK t5hXyEPpPmStE1Kp6+VDKfuy85Mx7cZZ6Vr2agpOyC19FkT6Ol1sKKarQNVUhUB4VXLN uQVw== X-Received: by 10.28.134.147 with SMTP id i141mr32243107wmd.87.1451760797269; Sat, 02 Jan 2016 10:53:17 -0800 (PST) Received: from axl ([185.105.175.24]) by smtp.gmail.com with ESMTPSA id i196sm58882509wmf.23.2016.01.02.10.53.15 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 02 Jan 2016 10:53:16 -0800 (PST) From: Dmitry Gutov Date: Sat, 02 Jan 2016 20:53:14 +0200 Message-ID: <8637uf24px.fsf@yandex.ru> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -3.8 (---) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.8 (---) This has come up in the discussion of bug#22292. I'd like to add my +1 to the request. From unknown Mon Jun 23 07:50:52 2025 X-Loop: help-debbugs@gnu.org Subject: bug#22294: 25.0.50; edebug should support jumping into generic methods Resent-From: Gemini Lasswell Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 03 Mar 2017 02:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22294 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Dmitry Gutov Cc: 22294@debbugs.gnu.org Received: via spool by 22294-submit@debbugs.gnu.org id=B22294.148850958513499 (code B ref 22294); Fri, 03 Mar 2017 02:54:02 +0000 Received: (at 22294) by debbugs.gnu.org; 3 Mar 2017 02:53:05 +0000 Received: from localhost ([127.0.0.1]:37228 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cjdL6-0003Ve-4E for submit@debbugs.gnu.org; Thu, 02 Mar 2017 21:53:04 -0500 Received: from aibo.runbox.com ([91.220.196.211]:35772) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cjdL4-0003VH-EE for 22294@debbugs.gnu.org; Thu, 02 Mar 2017 21:53:02 -0500 Received: from [10.9.9.211] (helo=mailfront11.runbox.com) by mailtransmit02.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1cjdL3-0006XN-Dj; Fri, 03 Mar 2017 03:53:01 +0100 Received: from c-24-22-244-161.hsd1.wa.comcast.net ([24.22.244.161] helo=rainbow.local) by mailfront11.runbox.com with esmtpsa (uid:179284 ) (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) id 1cjdKu-0004pj-Gs; Fri, 03 Mar 2017 03:52:52 +0100 From: Gemini Lasswell References: <8637uf24px.fsf@yandex.ru> Date: Thu, 02 Mar 2017 18:52:50 -0800 In-Reply-To: <8637uf24px.fsf@yandex.ru> (Dmitry Gutov's message of "Sat, 02 Jan 2016 20:53:14 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (darwin) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Dmitry Gutov writes: > This has come up in the discussion of bug#22292. I'd like to add my +1 > to the request. I've just sent a patch for bug#24753, which fixes an "args out of range" error that happened when asking Edebug to step through generic methods, after more than one with the same name had been instrumented. With the patch in place Edebug is stepping through methods for me. Can you try the patch and see if it also fixes the problems you were having? From unknown Mon Jun 23 07:50:52 2025 X-Loop: help-debbugs@gnu.org Subject: bug#22294: 25.0.50; edebug should support jumping into generic methods Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 11 Apr 2017 10:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22294 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Gemini Lasswell Cc: 22294@debbugs.gnu.org Received: via spool by 22294-submit@debbugs.gnu.org id=B22294.14919082701902 (code B ref 22294); Tue, 11 Apr 2017 10:58:02 +0000 Received: (at 22294) by debbugs.gnu.org; 11 Apr 2017 10:57:50 +0000 Received: from localhost ([127.0.0.1]:42007 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cxtUb-0000Uc-U3 for submit@debbugs.gnu.org; Tue, 11 Apr 2017 06:57:50 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:36090) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cxtUZ-0000UP-DE for 22294@debbugs.gnu.org; Tue, 11 Apr 2017 06:57:48 -0400 Received: by mail-wr0-f194.google.com with SMTP id o21so27489799wrb.3 for <22294@debbugs.gnu.org>; Tue, 11 Apr 2017 03:57:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=lYPv8wwigqqwBBt+y3QKiiRpKwHC/x8LPx4O6/lWkA4=; b=PPZawVlTAepBEJI35lvknRtgxrRyqpD4lmhW4Cx2G+Tx0bsnrgWOaYDje5vDlt6wpc Ltfe8bDMnIMQSO/9QzfsXlmK8PkOM2nUDtErpCxzO+JOxndRelg0aj8q30AI10+Q6sqJ 10T/XRODvAu8hVIuYx6ZRwikvzJfq5cy8PDDgygswZ9rEpAvqLmUp/ThlLMHAmSxDLFt pMdQU43AG9Ot4JCY8rCEXoa52QPTbW/d+lzztPe3j6uqi23tXFOnFy/RzY14L3u2Dsab eviTG9FfS6WTRt6+fHRCcAMBeCWqgbObENcJTaHbFfhYKHq7hjSOr4ttS1xXS0hCYRT7 xP3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=lYPv8wwigqqwBBt+y3QKiiRpKwHC/x8LPx4O6/lWkA4=; b=j8VNDxDhQsDB1RQcAiob8wocQpYChKcR/aygkXbDSWy65TH+p9S7fRurfT4b72Lat6 xv8pBKDrGpnH9XIygOeqYXG7yF4T1MIXhuKkfCtJFhi57+3ZrrkqDWzavRlNUaNrealp 9yi+kkkApsW6BovtGYAOh9PP5dfz6+18KNGL299p6Pcguu3GI1rQuYUQ6GfyC4b2gV84 fj5LrlMIhVfXKas8TX0sx17fi4Ma7JKdxgcsv39dWaJTCJbQxIlHUjqDM89QC8M2iNDe gapbrE7yw6SZRdyE0snOe/CWes5vU1sicTNU+hcW5iQuPvcTThXAKkQv+XeLRbGgQOl5 kgdQ== X-Gm-Message-State: AN3rC/7BwoX2AD7eYPPkaMoNoxwe7LXrv01ZfVJQz7ZoRfPz6rGPEtS4v5w0SpJP4duGeA== X-Received: by 10.223.154.231 with SMTP id a94mr17185092wrc.192.1491908261695; Tue, 11 Apr 2017 03:57:41 -0700 (PDT) Received: from [192.168.1.3] ([185.105.173.156]) by smtp.googlemail.com with ESMTPSA id u36sm16846791wrc.20.2017.04.11.03.57.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Apr 2017 03:57:40 -0700 (PDT) References: <8637uf24px.fsf@yandex.ru> From: Dmitry Gutov Message-ID: <3c954fc5-fda2-1c30-a251-e2f3fecd8534@yandex.ru> Date: Tue, 11 Apr 2017 13:57:39 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: -2.1 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.1 (--) Hi Gemini, On 03.03.2017 04:52, Gemini Lasswell wrote: > I've just sent a patch for bug#24753, which fixes an "args out of range" > error that happened when asking Edebug to step through generic methods, > after more than one with the same name had been instrumented. With the > patch in place Edebug is stepping through methods for me. Can you try > the patch and see if it also fixes the problems you were having? Thanks for pinging me, but the patch does little to the problem I'm seeing. Specifically, edebug-step-in doesn't work to step into a function call that's calling a generic method. Instead, edebug simply quits and the execution of the current command continues. Example: 1. Instrument xref-collect-references. 2. Type M-x xref-find-references. 3. When point reaches the semantic-symref-perform-search call, press 'i'. From unknown Mon Jun 23 07:50:52 2025 X-Loop: help-debbugs@gnu.org Subject: bug#22294: Patch (was: bug#22294: 25.0.50; edebug should support jumping into generic methods) Resent-From: Gemini Lasswell Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 26 Apr 2017 23:13:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22294 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Dmitry Gutov Cc: 22294@debbugs.gnu.org Received: via spool by 22294-submit@debbugs.gnu.org id=B22294.14932483655864 (code B ref 22294); Wed, 26 Apr 2017 23:13:01 +0000 Received: (at 22294) by debbugs.gnu.org; 26 Apr 2017 23:12:45 +0000 Received: from localhost ([127.0.0.1]:42131 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d3W72-0001WW-VV for submit@debbugs.gnu.org; Wed, 26 Apr 2017 19:12:45 -0400 Received: from aibo.runbox.com ([91.220.196.211]:59776) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d3W70-0001WM-BM for 22294@debbugs.gnu.org; Wed, 26 Apr 2017 19:12:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=runbox.com; s=rbselector1; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From; bh=YRBxe4QpiobZI4KTg1AdHcrPcO8dH8T30d85d7tLaxk=; b=ISGi+IawiSVUEtDX/i9jrqy0TI i7wOagf31awgQdxEuxq3NWEgSOhZ0o8J2jhCKjnN2y5bisLNAxgqfChetXczNEmUGsYvFCgGxyuwa r7SrxfR5Bm5+NRjA3GXzPhZnetkFt1s1oLI2s2WT4sYT2TQxtTu/62qa2tJjN+tdkziJjvZTw87KU ap9G3sMv0IbsvnvJS2wHnWQ1gvM5qYXApaHi9Pr3Vnds9n1q6msOmsysbv50J6830Mb0wA/XDyqM6 JSPAkB4WDkRf80aRL+KY+bClQtb5QoPKKILgw08/6IfU8zB0wj3XKLD5t0DURq8Pt2KdcgKs/pTdK WoZnFFfg==; Received: from [10.9.9.211] (helo=mailfront11.runbox.com) by mailtransmit02.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1d3W6y-0004MN-7O; Thu, 27 Apr 2017 01:12:40 +0200 Received: from c-24-22-244-161.hsd1.wa.comcast.net ([24.22.244.161] helo=chinook) by mailfront11.runbox.com with esmtpsa (uid:179284 ) (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) id 1d3W6t-0003eE-6j; Thu, 27 Apr 2017 01:12:35 +0200 From: Gemini Lasswell References: <8637uf24px.fsf@yandex.ru> <3c954fc5-fda2-1c30-a251-e2f3fecd8534@yandex.ru> Date: Wed, 26 Apr 2017 16:12:33 -0700 In-Reply-To: <3c954fc5-fda2-1c30-a251-e2f3fecd8534@yandex.ru> (Dmitry Gutov's message of "Tue, 11 Apr 2017 13:57:39 +0300") Message-ID: <871ssevk4e.fsf_-_@runbox.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --=-=-= Content-Type: text/plain Hi Dmitry, Dmitry Gutov writes: > Thanks for pinging me, but the patch does little to the problem I'm seeing. > > Specifically, edebug-step-in doesn't work to step into a function call > that's calling a generic method. > Thanks for the more specific steps to reproduce your problem. I've had a go at fixing it and have come up with the attached patch. It works by finding and instrumenting all the methods belonging to the generic function you are about to step into, before the call is made. Some limitations: - All the methods get debug instrumentation and temporary breakpoints, not just the one that's about to be executed. But given the potential complexity of method dispatch, it seems that fixing that would require some deep intertwining of Edebug and cl-generic. - If you use edebug-step-in twice on the same generic function it will reinstrument the methods, as opposed to using edebug-step-in twice on a regular function where Edebug can figure out that the function is already instrumented. Fixing that would require some way to include dynamic elements in the :name construct of an Edebug spec so that each method could get a unique deterministic symbol as opposed to an anonymous generated symbol. Or it could be fixed by the "future" described in edebug-form-data's docstring. This automates the steps to reproduce bug#24753, so apply that patch before you try this one. --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=0001-Make-edebug-step-in-work-on-generic-methods-Bug-2229.patch >From 5dcde4877bae34e4b4ab39c5f4f149a1793cffcc Mon Sep 17 00:00:00 2001 From: Gemini Lasswell Date: Wed, 26 Apr 2017 09:25:50 -0700 Subject: [PATCH] Make edebug-step-in work on generic methods (Bug#22294) * lisp/emacs-lisp/edebug.el (edebug--step-in-symbols): New variable. (edebug-make-form-wrapper): Add defined symbols to edebug--step-in-symbols. (edebug-instrument-function): If the function is a generic function, find and instrument all of its methods. Return a list instead of a single symbol. (edebug-instrument-callee): Now returns a list. Update docstring. (edebug-step-in): Handle the list returned by edebug-instrument-callee. * lisp/subr.el (method-files): New function. * test/lisp/subr-tests.el (subr-tests--method-files--finds-methods) (subr-tests--method-files--nonexistent-methods): New tests. --- lisp/emacs-lisp/edebug.el | 49 +++++++++++++++++++++++++++++++++++------------ lisp/subr.el | 19 ++++++++++++++++++ test/lisp/subr-tests.el | 25 ++++++++++++++++++++++++ 3 files changed, 81 insertions(+), 12 deletions(-) diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el index 4116e31d0a..1aa93a91b7 100644 --- a/lisp/emacs-lisp/edebug.el +++ b/lisp/emacs-lisp/edebug.el @@ -1170,6 +1170,8 @@ edebug-def-args (defvar edebug-def-interactive) ; is it an emacs interactive function? (defvar edebug-inside-func) ;; whether code is inside function context. ;; Currently def-form sets this to nil; def-body sets it to t. +(defvar edebug--step-in-symbols nil + "Used by edebug-step-in command to gather list of functions instrumented.") (defun edebug-interactive-p-name () ;; Return a unique symbol for the variable used to store the @@ -1332,6 +1334,7 @@ edebug-make-form-wrapper ;; (message "defining: %s" edebug-def-name) (sit-for 2) (edebug-make-top-form-data-entry form-data-entry) + (push edebug-def-name edebug--step-in-symbols) (message "Edebug: %s" edebug-def-name) ;;(debug edebug-def-name) @@ -3186,19 +3189,38 @@ edebug-step-out ))))) (defun edebug-instrument-function (func) - ;; Func should be a function symbol. - ;; Return the function symbol, or nil if not instrumented. - (let ((func-marker (get func 'edebug))) + "Instrument the function or generic method FUNC. +Return the list of function symbols which were instrumented. +This may be simply (FUNC) for a normal function, or a list of +generated symbols for methods. If a function or method to +instrument cannot be found, signal an error." + (let ((func-marker (get func 'edebug)) + edebug--step-in-symbols) (cond ((and (markerp func-marker) (marker-buffer func-marker)) ;; It is uninstrumented, so instrument it. (with-current-buffer (marker-buffer func-marker) (goto-char func-marker) (edebug-eval-top-level-form) - func)) + edebug--step-in-symbols)) ((consp func-marker) (message "%s is already instrumented." func) - func) + (list func)) + ((get func 'cl--generic) + (let ((method-defs (method-files func))) + (unless method-defs + (error "Could not find any method definitions for %s" func)) + (while method-defs + (let* ((file (caar method-defs)) + (spec (cdar method-defs)) + (loc (find-function-search-for-symbol spec 'cl-defmethod file))) + (unless (cdr loc) + (error "Could not find the definition for %s in its file" spec)) + (with-current-buffer (car loc) + (goto-char (cdr loc)) + (edebug-eval-top-level-form))) + (setq method-defs (cdr method-defs)))) + edebug--step-in-symbols) (t (let ((loc (find-function-noselect func t))) (unless (cdr loc) @@ -3206,13 +3228,16 @@ edebug-instrument-function (with-current-buffer (car loc) (goto-char (cdr loc)) (edebug-eval-top-level-form) - func)))))) + edebug--step-in-symbols)))))) (defun edebug-instrument-callee () "Instrument the definition of the function or macro about to be called. Do this when stopped before the form or it will be too late. One side effect of using this command is that the next time the -function or macro is called, Edebug will be called there as well." +function or macro is called, Edebug will be called there as well. +If the callee is a generic function, Edebug will instrument all +the methods, not just the one which is about to be called. Return +the list of symbols which were instrumented." (interactive) (if (not (looking-at "(")) (error "You must be before a list form") @@ -3227,15 +3252,15 @@ edebug-instrument-callee (defun edebug-step-in () - "Step into the definition of the function or macro about to be called. + "Step into the definition of the function, macro or method about to be called. This first does `edebug-instrument-callee' to ensure that it is instrumented. Then it does `edebug-on-entry' and switches to `go' mode." (interactive) - (let ((func (edebug-instrument-callee))) - (if func + (let ((funcs (edebug-instrument-callee))) + (if funcs (progn - (edebug-on-entry func 'temp) - (edebug-go-mode nil))))) + (mapc (lambda (func) (edebug-on-entry func 'temp)) funcs) + (edebug-go-mode nil))))) (defun edebug-on-entry (function &optional flag) "Cause Edebug to stop when FUNCTION is called. diff --git a/lisp/subr.el b/lisp/subr.el index 1dd5d2ffef..4e7ddb3f2b 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -2026,6 +2026,25 @@ symbol-file (setq files (cdr files))) file))) +(defun method-files (method) + "Return a list of files where METHOD is defined by `cl-defmethod'. +The list will have entries of the form (FILE . (METHOD ...)) +where (METHOD ...) contains the qualifiers and specializers of +the method and is a suitable argument for +`find-function-search-for-symbol'. Filenames are absolute." + (let ((files load-history) + result) + (while files + (let ((defs (cdr (car files)))) + (while defs + (let ((def (car defs))) + (if (and (eq (car-safe def) 'cl-defmethod) + (eq (cadr def) method)) + (push (cons (car (car files)) (cdr def)) result))) + (setq defs (cdr defs)))) + (setq files (cdr files))) + result)) + (defun locate-library (library &optional nosuffix path interactive-call) "Show the precise file name of Emacs library LIBRARY. LIBRARY should be a relative file name of the library, a string. diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el index 0d243cc5d8..4a355bd2c9 100644 --- a/test/lisp/subr-tests.el +++ b/test/lisp/subr-tests.el @@ -291,5 +291,30 @@ subr-test--frames-1 (should-error (eval '(dolist "foo") t) :type 'wrong-type-argument)) + +(require 'cl-generic) +(cl-defgeneric subr-tests--generic (x)) +(cl-defmethod subr-tests--generic ((x string)) + (message "%s is a string" x)) +(cl-defmethod subr-tests--generic ((x integer)) + (message "%s is a number" x)) +(cl-defgeneric subr-tests--generic-without-methods (x y)) +(defvar subr-tests--this-file (or load-file-name buffer-file-name)) + +(ert-deftest subr-tests--method-files--finds-methods () + "`method-files' returns a list of files and methods for a generic function." + (let ((retval (method-files 'subr-tests--generic))) + (should (equal (length retval) 2)) + (mapc (lambda (x) + (should (equal (car x) subr-tests--this-file)) + (should (equal (cadr x) 'subr-tests--generic))) + retval) + (should-not (equal (nth 0 retval) (nth 1 retval))))) + +(ert-deftest subr-tests--method-files--nonexistent-methods () + "`method-files' returns nil if asked to find a method which doesn't exist." + (should-not (method-files 'subr-tests--undefined-generic)) + (should-not (method-files 'subr-tests--generic-without-methods))) + (provide 'subr-tests) ;;; subr-tests.el ends here -- 2.12.2 --=-=-=-- From unknown Mon Jun 23 07:50:52 2025 X-Loop: help-debbugs@gnu.org Subject: bug#22294: Patch Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 07 May 2017 02:35:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22294 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Gemini Lasswell Cc: 22294@debbugs.gnu.org Received: via spool by 22294-submit@debbugs.gnu.org id=B22294.149412447312095 (code B ref 22294); Sun, 07 May 2017 02:35:02 +0000 Received: (at 22294) by debbugs.gnu.org; 7 May 2017 02:34:33 +0000 Received: from localhost ([127.0.0.1]:58923 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d7C1p-000391-J3 for submit@debbugs.gnu.org; Sat, 06 May 2017 22:34:33 -0400 Received: from mail-wm0-f43.google.com ([74.125.82.43]:35969) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d7C1n-00038o-F9 for 22294@debbugs.gnu.org; Sat, 06 May 2017 22:34:32 -0400 Received: by mail-wm0-f43.google.com with SMTP id u65so51708734wmu.1 for <22294@debbugs.gnu.org>; Sat, 06 May 2017 19:34:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=/REjlmSP6jOKbzR7rawLl5ZFJbhaUK5WYxyXcKrn5vU=; b=FMQZ1S2WH0HvnMA6wNJ7mmyKVAvNA4SmSihu6+iD0xYLZ23PwSZDCH1/ekK2J0s6Nu 6V88nqO/5yDc1cErvKiKcwe8s+kYGR3NMhOEsEMKqNfGba5u1u1LyeCFXWWfzQCdLTBG 3YkViHvSZij28nLrc4fT4efcRUnuUd682PdPw3e2aJzKkS4tNML2S8pQ9zULtA8+mpBE Bs+j8kBsoWxyiZenAdlX7WfF9172wMGrMvOls2cFgZ1eCxFnr3kLepC67cIUcOPuKrlw TJ9xPyFZ+W/kRKO0ZNotd14svRbpJlvYmLYeK5gu794h6HBCjQT/qb2jbaRCBtKdwBMN B2WQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=/REjlmSP6jOKbzR7rawLl5ZFJbhaUK5WYxyXcKrn5vU=; b=HL+8tCpBx/rSBILZq8xjvzOCkZQisqH47WgYWdyku2Y9wSBAtK/q1BcB4yujkmydww Px9RtmGA5oG2matdA77mv9MpgQ5kxm3lcIrEkAmIamnPaW20HpKXD1aKKPDdDf2qCuEc a9/Ks1Ak5lanMzCrF/UCqVB08wffRMeFOwjZmoaNwLYzMLyzywirz+ABuAZB7VjH8Z+0 t3T0RNsNcz8UB0z2ZnaLFS7OEYDOatn1OB6bc721mXIifhyRYXnBG4NtrF5AIQwaPUtk nwGUUS5e1zZpRVmti5GJVKzlzlSsHKhtfytUTYM6gSWQ8GJ23D02c7+WdcpjwFLDkRO+ 6XCQ== X-Gm-Message-State: AODbwcBo9diTSroFWmu1S+4I/JqcSh94OZQIJFjTULE/7sOylGIJwL58 w+ZDfs9nTqsTPA== X-Received: by 10.28.31.136 with SMTP id f130mr1114227wmf.117.1494124465677; Sat, 06 May 2017 19:34:25 -0700 (PDT) Received: from [192.168.1.3] ([185.105.173.156]) by smtp.googlemail.com with ESMTPSA id a73sm10121745wrc.58.2017.05.06.19.34.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 06 May 2017 19:34:24 -0700 (PDT) References: <8637uf24px.fsf@yandex.ru> <3c954fc5-fda2-1c30-a251-e2f3fecd8534@yandex.ru> <871ssevk4e.fsf_-_@runbox.com> From: Dmitry Gutov Message-ID: <793941ae-4e88-80ef-3ac7-7bd5019b97f7@yandex.ru> Date: Sun, 7 May 2017 05:34:23 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:53.0) Gecko/20100101 Thunderbird/53.0 MIME-Version: 1.0 In-Reply-To: <871ssevk4e.fsf_-_@runbox.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 0.2 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.2 (/) Hi Gemini, Thank you very much for tackling this. I've tried the patch out, and it seems to work well. We can install it if nobody else has any strong objections. On 27.04.2017 2:12, Gemini Lasswell wrote: > Some limitations: > > - All the methods get debug instrumentation and temporary breakpoints, > not just the one that's about to be executed. But given the potential > complexity of method dispatch, it seems that fixing that would require > some deep intertwining of Edebug and cl-generic. This sounds totally fine to me, at this stage. I _think_ it shouldn't be too hard to change this, given that all the arguments are known by the time edebug-step-in, but it's not a major issue. It might change the return value of edebug-instrument-function back again, though. > - If you use edebug-step-in twice on the same generic function it will > reinstrument the methods, as opposed to using edebug-step-in twice on a > regular function where Edebug can figure out that the function is > already instrumented. This is a bit wasteful. But more importantly, it causes us to collect the list of anonymous symbols in a dynamic variable, instead of a more explicit data flow. Which is not great. > Fixing that would require some way to include > dynamic elements in the :name construct of an Edebug spec so that each > method could get a unique deterministic symbol as opposed to an > anonymous generated symbol. Ideally, we'd do this, I think. If :name spec is allowed to be a function, it could construct the unique symbol like (intern (format "%s-%s" name arguments)). Then edebug-instrument-function could also call this logic itself, instead of relying on the symbol being recorded in edebug--step-in-symbols. (On the other hand, the proposed approach probably fixes stepping into any edebug-able form, not just generic methods). > Or it could be fixed by the "future" > described in edebug-form-data's docstring. We'd still need to construct the unique symbol this way, at least somewhere, I think. A couple notes on the patch itself: > - ;; Func should be a function symbol. > - ;; Return the function symbol, or nil if not instrumented. > - (let ((func-marker (get func 'edebug))) > + "Instrument the function or generic method FUNC. > +Return the list of function symbols which were instrumented. > +This may be simply (FUNC) for a normal function, or a list of > +generated symbols for methods. If a function or method to > +instrument cannot be found, signal an error." > + (let ((func-marker (get func 'edebug)) The signature change looked worrying, but all the callers seem fine (there are not many of them). > + ((get func 'cl--generic) > + (let ((method-defs (method-files func))) > + (unless method-defs > + (error "Could not find any me > > thod definitions for %s" func)) > + (while method-defs > + (let* ((file (caar method-defs)) > + (spec (cdar method-defs)) It would be better to use `dolist' here, or even `pcase-dolist', see an example in pcase-dolist. > > + > +(require 'cl-generic) This adds a second empty line in a row. From unknown Mon Jun 23 07:50:52 2025 X-Loop: help-debbugs@gnu.org Subject: bug#22294: Patch Resent-From: Gemini Lasswell Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 07 May 2017 20:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22294 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Dmitry Gutov Cc: 22294@debbugs.gnu.org Received: via spool by 22294-submit@debbugs.gnu.org id=B22294.149418891816499 (code B ref 22294); Sun, 07 May 2017 20:29:02 +0000 Received: (at 22294) by debbugs.gnu.org; 7 May 2017 20:28:38 +0000 Received: from localhost ([127.0.0.1]:60809 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d7SnG-0004I3-Bh for submit@debbugs.gnu.org; Sun, 07 May 2017 16:28:38 -0400 Received: from aibo.runbox.com ([91.220.196.211]:38080) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d7SnE-0004Hv-Le for 22294@debbugs.gnu.org; Sun, 07 May 2017 16:28:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=runbox.com; s=rbselector1; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From; bh=eHbRfDsOQi5wBRKAa9E0UaJhWFtDbMNEkehzbaGK+H8=; b=Lo2zfp/jl5WsCdtWHX0T+SaOfO av7vR8x3rCdLlT7TagiWFEbOEKPkkeAGFPCiF64pFCprLTM8GPneq2WM718/pu8ybPHPsW1c6pWe+ gZ0nqMFVJFWhMKtm6LjUDt1/1LyvjWTbjPmzNpFBD4/xzdzw8MIfUfyHUTHmkW9baJ44LyW5r3E9Q l20B5n7aQcaK9eKFSApcP4MpNxPdqKbjcZYZaeauwkm+s1buhtOLPdNz8NVF9j1B4IMkoEL/sJbq0 HaFJnZfkaKs2H1mhs5etd1aAWWAJfpAC0drtgnXrp2aDrkJVmTaq8V2viDrgyUhOgan5HJBP6gHx9 mO2ks+7g==; Received: from [10.9.9.212] (helo=mailfront12.runbox.com) by mailtransmit02.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1d7SnD-0006eK-V8; Sun, 07 May 2017 22:28:36 +0200 Received: from c-24-22-244-161.hsd1.wa.comcast.net ([24.22.244.161] helo=chinook) by mailfront12.runbox.com with esmtpsa (uid:179284 ) (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) id 1d7Sn8-0006RX-AP; Sun, 07 May 2017 22:28:30 +0200 From: Gemini Lasswell References: <8637uf24px.fsf@yandex.ru> <3c954fc5-fda2-1c30-a251-e2f3fecd8534@yandex.ru> <871ssevk4e.fsf_-_@runbox.com> <793941ae-4e88-80ef-3ac7-7bd5019b97f7@yandex.ru> Date: Sun, 07 May 2017 13:28:18 -0700 In-Reply-To: <793941ae-4e88-80ef-3ac7-7bd5019b97f7@yandex.ru> (Dmitry Gutov's message of "Sun, 7 May 2017 05:34:23 +0300") Message-ID: <87efw08l99.fsf@chinook> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --=-=-= Content-Type: text/plain Dmitry Gutov writes: >> Some limitations: >> >> - All the methods get debug instrumentation and temporary breakpoints, >> not just the one that's about to be executed. But given the potential >> complexity of method dispatch, it seems that fixing that would require >> some deep intertwining of Edebug and cl-generic. > > This sounds totally fine to me, at this stage. I _think_ it shouldn't > be too hard to change this, given that all the arguments are known by > the time edebug-step-in, but it's not a major issue. Actually the arguments are not known because they have not yet been evaluated when edebug-step-in is invoked. So it would have to set a breakpoint after argument evaluation, run the code under debugging until it gets to that breakpoint, look at the evaluated arguments, figure out what method to instrument, instrument the method and set a breakpoint in it, and then run again. > This is a bit wasteful. But more importantly, it causes us to collect > the list of anonymous symbols in a dynamic variable, instead of a more > explicit data flow. Which is not great. Agreed. Edebug already has far too many dynamic variables obscuring its logic, making it appear the safest change is to simply add another one rather than change the logic to allow more explicit data flow. I don't think there is an easy answer. I have started writing tests for Edebug, as a step towards making it possible to improve it without worrying about breaking things that are working. Probably it will help me understand the code in there better too. > A couple notes on the patch itself: > It would be better to use `dolist' here, or even `pcase-dolist', see > an example in pcase-dolist. Here's a revised patch. Thanks for letting me know about pcase-dolist as it looks very useful. It's not documented and I didn't know it existed. --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=0001-Make-edebug-step-in-work-on-generic-methods-Bug-2229.patch >From 3d45b931ec37aa6c0dc8bed5b2ad7f744da82dca Mon Sep 17 00:00:00 2001 From: Gemini Lasswell Date: Wed, 26 Apr 2017 09:25:50 -0700 Subject: [PATCH] Make edebug-step-in work on generic methods (Bug#22294) * lisp/emacs-lisp/edebug.el (edebug--step-in-symbols): New variable. (edebug-make-form-wrapper): Add defined symbols to edebug--step-in-symbols. (edebug-instrument-function): If the function is a generic function, find and instrument all of its methods. Return a list instead of a single symbol. (edebug-instrument-callee): Now returns a list. Update docstring. (edebug-step-in): Handle the list returned by edebug-instrument-callee. * lisp/subr.el (method-files): New function. * test/lisp/subr-tests.el (subr-tests--method-files--finds-methods) (subr-tests--method-files--nonexistent-methods): New tests. --- lisp/emacs-lisp/edebug.el | 46 ++++++++++++++++++++++++++++++++++------------ lisp/subr.el | 19 +++++++++++++++++++ test/lisp/subr-tests.el | 24 ++++++++++++++++++++++++ 3 files changed, 77 insertions(+), 12 deletions(-) diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el index 4116e31d0a..1c30cfdf78 100644 --- a/lisp/emacs-lisp/edebug.el +++ b/lisp/emacs-lisp/edebug.el @@ -1170,6 +1170,8 @@ edebug-def-args (defvar edebug-def-interactive) ; is it an emacs interactive function? (defvar edebug-inside-func) ;; whether code is inside function context. ;; Currently def-form sets this to nil; def-body sets it to t. +(defvar edebug--step-in-symbols nil + "Used by edebug-step-in command to gather list of functions instrumented.") (defun edebug-interactive-p-name () ;; Return a unique symbol for the variable used to store the @@ -1332,6 +1334,7 @@ edebug-make-form-wrapper ;; (message "defining: %s" edebug-def-name) (sit-for 2) (edebug-make-top-form-data-entry form-data-entry) + (push edebug-def-name edebug--step-in-symbols) (message "Edebug: %s" edebug-def-name) ;;(debug edebug-def-name) @@ -3186,19 +3189,35 @@ edebug-step-out ))))) (defun edebug-instrument-function (func) - ;; Func should be a function symbol. - ;; Return the function symbol, or nil if not instrumented. - (let ((func-marker (get func 'edebug))) + "Instrument the function or generic method FUNC. +Return the list of function symbols which were instrumented. +This may be simply (FUNC) for a normal function, or a list of +generated symbols for methods. If a function or method to +instrument cannot be found, signal an error." + (let ((func-marker (get func 'edebug)) + edebug--step-in-symbols) (cond ((and (markerp func-marker) (marker-buffer func-marker)) ;; It is uninstrumented, so instrument it. (with-current-buffer (marker-buffer func-marker) (goto-char func-marker) (edebug-eval-top-level-form) - func)) + edebug--step-in-symbols)) ((consp func-marker) (message "%s is already instrumented." func) - func) + (list func)) + ((get func 'cl--generic) + (let ((method-defs (method-files func))) + (unless method-defs + (error "Could not find any method definitions for %s" func)) + (pcase-dolist (`(,file . ,spec) method-defs) + (let* ((loc (find-function-search-for-symbol spec 'cl-defmethod file))) + (unless (cdr loc) + (error "Could not find the definition for %s in its file" spec)) + (with-current-buffer (car loc) + (goto-char (cdr loc)) + (edebug-eval-top-level-form))))) + edebug--step-in-symbols) (t (let ((loc (find-function-noselect func t))) (unless (cdr loc) @@ -3206,13 +3225,16 @@ edebug-instrument-function (with-current-buffer (car loc) (goto-char (cdr loc)) (edebug-eval-top-level-form) - func)))))) + edebug--step-in-symbols)))))) (defun edebug-instrument-callee () "Instrument the definition of the function or macro about to be called. Do this when stopped before the form or it will be too late. One side effect of using this command is that the next time the -function or macro is called, Edebug will be called there as well." +function or macro is called, Edebug will be called there as well. +If the callee is a generic function, Edebug will instrument all +the methods, not just the one which is about to be called. Return +the list of symbols which were instrumented." (interactive) (if (not (looking-at "(")) (error "You must be before a list form") @@ -3227,15 +3249,15 @@ edebug-instrument-callee (defun edebug-step-in () - "Step into the definition of the function or macro about to be called. + "Step into the definition of the function, macro or method about to be called. This first does `edebug-instrument-callee' to ensure that it is instrumented. Then it does `edebug-on-entry' and switches to `go' mode." (interactive) - (let ((func (edebug-instrument-callee))) - (if func + (let ((funcs (edebug-instrument-callee))) + (if funcs (progn - (edebug-on-entry func 'temp) - (edebug-go-mode nil))))) + (mapc (lambda (func) (edebug-on-entry func 'temp)) funcs) + (edebug-go-mode nil))))) (defun edebug-on-entry (function &optional flag) "Cause Edebug to stop when FUNCTION is called. diff --git a/lisp/subr.el b/lisp/subr.el index 02e7993223..8d5d2a779c 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -2026,6 +2026,25 @@ symbol-file (setq files (cdr files))) file))) +(defun method-files (method) + "Return a list of files where METHOD is defined by `cl-defmethod'. +The list will have entries of the form (FILE . (METHOD ...)) +where (METHOD ...) contains the qualifiers and specializers of +the method and is a suitable argument for +`find-function-search-for-symbol'. Filenames are absolute." + (let ((files load-history) + result) + (while files + (let ((defs (cdr (car files)))) + (while defs + (let ((def (car defs))) + (if (and (eq (car-safe def) 'cl-defmethod) + (eq (cadr def) method)) + (push (cons (car (car files)) (cdr def)) result))) + (setq defs (cdr defs)))) + (setq files (cdr files))) + result)) + (defun locate-library (library &optional nosuffix path interactive-call) "Show the precise file name of Emacs library LIBRARY. LIBRARY should be a relative file name of the library, a string. diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el index 0d243cc5d8..8fa258d12e 100644 --- a/test/lisp/subr-tests.el +++ b/test/lisp/subr-tests.el @@ -291,5 +291,29 @@ subr-test--frames-1 (should-error (eval '(dolist "foo") t) :type 'wrong-type-argument)) +(require 'cl-generic) +(cl-defgeneric subr-tests--generic (x)) +(cl-defmethod subr-tests--generic ((x string)) + (message "%s is a string" x)) +(cl-defmethod subr-tests--generic ((x integer)) + (message "%s is a number" x)) +(cl-defgeneric subr-tests--generic-without-methods (x y)) +(defvar subr-tests--this-file (or load-file-name buffer-file-name)) + +(ert-deftest subr-tests--method-files--finds-methods () + "`method-files' returns a list of files and methods for a generic function." + (let ((retval (method-files 'subr-tests--generic))) + (should (equal (length retval) 2)) + (mapc (lambda (x) + (should (equal (car x) subr-tests--this-file)) + (should (equal (cadr x) 'subr-tests--generic))) + retval) + (should-not (equal (nth 0 retval) (nth 1 retval))))) + +(ert-deftest subr-tests--method-files--nonexistent-methods () + "`method-files' returns nil if asked to find a method which doesn't exist." + (should-not (method-files 'subr-tests--undefined-generic)) + (should-not (method-files 'subr-tests--generic-without-methods))) + (provide 'subr-tests) ;;; subr-tests.el ends here -- 2.12.2 --=-=-=-- From unknown Mon Jun 23 07:50:52 2025 X-Loop: help-debbugs@gnu.org Subject: bug#22294: Patch Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 08 May 2017 02:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22294 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Gemini Lasswell Cc: 22294@debbugs.gnu.org Received: via spool by 22294-submit@debbugs.gnu.org id=B22294.149420997814824 (code B ref 22294); Mon, 08 May 2017 02:20:02 +0000 Received: (at 22294) by debbugs.gnu.org; 8 May 2017 02:19:38 +0000 Received: from localhost ([127.0.0.1]:60971 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d7YGw-0003r1-7y for submit@debbugs.gnu.org; Sun, 07 May 2017 22:19:38 -0400 Received: from mail-wm0-f53.google.com ([74.125.82.53]:35832) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d7YGu-0003qn-OS for 22294@debbugs.gnu.org; Sun, 07 May 2017 22:19:37 -0400 Received: by mail-wm0-f53.google.com with SMTP id b84so38649225wmh.0 for <22294@debbugs.gnu.org>; Sun, 07 May 2017 19:19:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language; bh=fh8fcnO9NUd9vZC1AGDO+L2eArA4vul7kBeZI/VP0qc=; b=L3OevfiOwGgU8s+VGRSpVOrcd0dEyZGp92xgfs+G9TKF735xAwdMkZ1N9GXj5NCmTI FpcV1/XR20t1Q3Nq++hktWX523VsuK3fL1/IHM1BqbRJGs4WS4UjrLQvJ/htQ8ST5ed4 i3w8KuoxKyXpm3bCnpudiVAs1tF9hQBZRmEV7uv1U4L6NYh4rgj10ZlfJKeJjXgx8p4r AwtL4WG1pcT3i4Q5pqr4vVNO29n2ZdssDZr4ceeZwwP6s4kRn7HOrFr34uIUcUOgsBYw uJS4CCciQop/7oGc+gXEW7sEivCbkFxTlIpIlfsy0q+d+62zIueYMWVlYSIsgGenV9yZ hJmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language; bh=fh8fcnO9NUd9vZC1AGDO+L2eArA4vul7kBeZI/VP0qc=; b=DhGgMsMxrbdcAGMIeLUmqS0TngUIHKPL89q91ODiO0RHw5cyZ5cjNwKiO5tOwjpuyT FFMCDLN1RaG0jMqDRgRyFsWyCWbqTNluW3/4fSKcpKQzaDgtXm4Jxj03gt6nDQFSvPib hn7eiBcKjbt6T8t4IgVDsUkb8SMqwQ4WTfGfoCIz3SLQdVqKWEbDfZCCHrMbA9pIAj2a 4artjCBkKWWEhsmR4LA3iM62PzTLwT/aBHK4XOg3WFOcJdMJdtdEImari7IyOW3GKPnj 33/0IEaRz2mizL8yahgbMO6Ar1UBOgpGu0xhqS79g37tZlsxCwSnXKNQSJhYKt7Rb5fN E/eg== X-Gm-Message-State: AN3rC/68Cj1mQeSZk++de9i+R67FULtJYFMVZxfGpN8coeX+ysjt7Og0 SqvVzOkUvrZJTg== X-Received: by 10.28.20.84 with SMTP id 81mr11515366wmu.51.1494209970913; Sun, 07 May 2017 19:19:30 -0700 (PDT) Received: from [192.168.1.3] ([185.105.173.156]) by smtp.googlemail.com with ESMTPSA id 30sm9397915wrp.6.2017.05.07.19.19.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 07 May 2017 19:19:30 -0700 (PDT) References: <8637uf24px.fsf@yandex.ru> <3c954fc5-fda2-1c30-a251-e2f3fecd8534@yandex.ru> <871ssevk4e.fsf_-_@runbox.com> <793941ae-4e88-80ef-3ac7-7bd5019b97f7@yandex.ru> <87efw08l99.fsf@chinook> From: Dmitry Gutov Message-ID: Date: Mon, 8 May 2017 05:19:28 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:53.0) Gecko/20100101 Thunderbird/53.0 MIME-Version: 1.0 In-Reply-To: <87efw08l99.fsf@chinook> Content-Type: multipart/mixed; boundary="------------340116A7B3956DC79401AAC4" Content-Language: en-US X-Spam-Score: 0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.7 (/) This is a multi-part message in MIME format. --------------340116A7B3956DC79401AAC4 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 07.05.2017 23:28, Gemini Lasswell wrote: > Actually the arguments are not known because they have not yet been > evaluated when edebug-step-in is invoked. So it would have to set a > breakpoint after argument evaluation, run the code under debugging > until it gets to that breakpoint, look at the evaluated arguments, > figure out what method to instrument, instrument the method and set a > breakpoint in it, and then run again. Very good point, it sounds like a pain. Fixing the edebug name for cl-defmethod seems like it should be a smaller effort. I've tried to do that via a new edebug spec for method arguments, see the attached variation of your patch (only partially tested). Unfortunately, this code fails when instrumenting a generic method (e.g. using C-u C-M-x) with something like: Unknown specializer foo@setf\ \(v\ \(_y\ \(eql\ 4\)\)\ z\) Any thoughts? edebug-match-method-args is definitely at fault there, but I'm not sure how to improve it. > I have started writing tests for > Edebug, as a step towards making it possible to improve it without > worrying about breaking things that are working. Probably it will help > me understand the code in there better too. Sounds great. > Here's a revised patch. Thanks for letting me know about pcase-dolist > as it looks very useful. It's not documented and I didn't know it > existed. I usually find those via normal introspection. Try typing 'C-h f pcase- TAB' and looking at the "public" names (without the double-dash in their name). --------------340116A7B3956DC79401AAC4 Content-Type: text/x-patch; name="0002-edebug-and-defmethod.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0002-edebug-and-defmethod.diff" diff --git a/lisp/emacs-lisp/cl-generic.el b/lisp/emacs-lisp/cl-generic.el index 068f4fb..a4da02a 100644 --- a/lisp/emacs-lisp/cl-generic.el +++ b/lisp/emacs-lisp/cl-generic.el @@ -413,12 +413,12 @@ cl-defmethod (declare (doc-string 3) (indent 2) (debug (&define ; this means we are defining something - [&or symbolp ("setf" symbolp)] + [&or name ("setf" name :name setf)] ;; ^^ This is the methods symbol [ &rest atom ] ; Multiple qualifiers are allowed. ; Like in CLOS spec, we support ; any non-list values. - listp ; arguments + method-args ; arguments [ &optional stringp ] ; documentation string def-body))) ; part to be debugged (let ((qualifiers nil)) diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el index 4116e31..5f295ac 100644 --- a/lisp/emacs-lisp/edebug.el +++ b/lisp/emacs-lisp/edebug.el @@ -1607,6 +1607,7 @@ edebug-match-specs ;; Less frequently used: ;; (function . edebug-match-function) (lambda-expr . edebug-match-lambda-expr) + (method-args . edebug-match-method-args) (¬ . edebug-match-¬) (&key . edebug-match-&key) (place . edebug-match-place) @@ -1900,6 +1901,16 @@ edebug-match-colon-name spec)) nil) +(defun edebug-match-method-args (cursor) + (let ((args (edebug-top-element-required cursor "Expected arguments"))) + (if (not (listp args)) + (edebug-no-match cursor "List expected")) + ;; Append the arguments to edebug-def-name. + (setq edebug-def-name + (intern (format "%s %s" edebug-def-name args))) + (edebug-move-cursor cursor) + nil)) + (defun edebug-match-arg (cursor) ;; set the def-args bound in edebug-defining-form (let ((edebug-arg (edebug-top-element-required cursor "Expected arg"))) @@ -3186,8 +3197,11 @@ edebug-step-out ))))) (defun edebug-instrument-function (func) - ;; Func should be a function symbol. - ;; Return the function symbol, or nil if not instrumented. + "Instrument the function or generic method FUNC. +Return the list of function symbols which were instrumented. +This may be simply (FUNC) for a normal function, or a list of +generated symbols for methods. If a function or method to +instrument cannot be found, signal an error." (let ((func-marker (get func 'edebug))) (cond ((and (markerp func-marker) (marker-buffer func-marker)) @@ -3195,10 +3209,24 @@ edebug-instrument-function (with-current-buffer (marker-buffer func-marker) (goto-char func-marker) (edebug-eval-top-level-form) - func)) + (list func))) ((consp func-marker) (message "%s is already instrumented." func) - func) + (list func)) + ((get func 'cl--generic) + (let ((method-defs (method-files func)) + symbols) + (unless method-defs + (error "Could not find any method definitions for %s" func)) + (pcase-dolist (`(,file . ,spec) method-defs) + (let* ((loc (find-function-search-for-symbol spec 'cl-defmethod file))) + (unless (cdr loc) + (error "Could not find the definition for %s in its file" spec)) + (with-current-buffer (car loc) + (goto-char (cdr loc)) + (edebug-eval-top-level-form) + (push (edebug-form-data-symbol) symbols)))) + symbols)) (t (let ((loc (find-function-noselect func t))) (unless (cdr loc) @@ -3206,13 +3234,16 @@ edebug-instrument-function (with-current-buffer (car loc) (goto-char (cdr loc)) (edebug-eval-top-level-form) - func)))))) + (list func))))))) (defun edebug-instrument-callee () "Instrument the definition of the function or macro about to be called. Do this when stopped before the form or it will be too late. One side effect of using this command is that the next time the -function or macro is called, Edebug will be called there as well." +function or macro is called, Edebug will be called there as well. +If the callee is a generic function, Edebug will instrument all +the methods, not just the one which is about to be called. Return +the list of symbols which were instrumented." (interactive) (if (not (looking-at "(")) (error "You must be before a list form") @@ -3227,15 +3258,15 @@ edebug-instrument-callee (defun edebug-step-in () - "Step into the definition of the function or macro about to be called. + "Step into the definition of the function, macro or method about to be called. This first does `edebug-instrument-callee' to ensure that it is instrumented. Then it does `edebug-on-entry' and switches to `go' mode." (interactive) - (let ((func (edebug-instrument-callee))) - (if func + (let ((funcs (edebug-instrument-callee))) + (if funcs (progn - (edebug-on-entry func 'temp) - (edebug-go-mode nil))))) + (mapc (lambda (func) (edebug-on-entry func 'temp)) funcs) + (edebug-go-mode nil))))) (defun edebug-on-entry (function &optional flag) "Cause Edebug to stop when FUNCTION is called. diff --git a/lisp/emacs-lisp/eieio-compat.el b/lisp/emacs-lisp/eieio-compat.el index fe65ae0..c073b1a 100644 --- a/lisp/emacs-lisp/eieio-compat.el +++ b/lisp/emacs-lisp/eieio-compat.el @@ -105,10 +105,10 @@ defmethod (declare (doc-string 3) (obsolete cl-defmethod "25.1") (debug (&define ; this means we are defining something - [&or symbolp ("setf" symbolp)] + [&or name ("setf" name :name setf)] ;; ^^ This is the methods symbol [ &optional symbolp ] ; this is key :before etc - listp ; arguments + method-args ; arguments [ &optional stringp ] ; documentation string def-body ; part to be debugged ))) diff --git a/lisp/subr.el b/lisp/subr.el index 02e7993..8d5d2a7 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -2026,6 +2026,25 @@ symbol-file (setq files (cdr files))) file))) +(defun method-files (method) + "Return a list of files where METHOD is defined by `cl-defmethod'. +The list will have entries of the form (FILE . (METHOD ...)) +where (METHOD ...) contains the qualifiers and specializers of +the method and is a suitable argument for +`find-function-search-for-symbol'. Filenames are absolute." + (let ((files load-history) + result) + (while files + (let ((defs (cdr (car files)))) + (while defs + (let ((def (car defs))) + (if (and (eq (car-safe def) 'cl-defmethod) + (eq (cadr def) method)) + (push (cons (car (car files)) (cdr def)) result))) + (setq defs (cdr defs)))) + (setq files (cdr files))) + result)) + (defun locate-library (library &optional nosuffix path interactive-call) "Show the precise file name of Emacs library LIBRARY. LIBRARY should be a relative file name of the library, a string. diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el index 0d243cc..4a355bd 100644 --- a/test/lisp/subr-tests.el +++ b/test/lisp/subr-tests.el @@ -291,5 +291,30 @@ subr-test--frames-1 (should-error (eval '(dolist "foo") t) :type 'wrong-type-argument)) + +(require 'cl-generic) +(cl-defgeneric subr-tests--generic (x)) +(cl-defmethod subr-tests--generic ((x string)) + (message "%s is a string" x)) +(cl-defmethod subr-tests--generic ((x integer)) + (message "%s is a number" x)) +(cl-defgeneric subr-tests--generic-without-methods (x y)) +(defvar subr-tests--this-file (or load-file-name buffer-file-name)) + +(ert-deftest subr-tests--method-files--finds-methods () + "`method-files' returns a list of files and methods for a generic function." + (let ((retval (method-files 'subr-tests--generic))) + (should (equal (length retval) 2)) + (mapc (lambda (x) + (should (equal (car x) subr-tests--this-file)) + (should (equal (cadr x) 'subr-tests--generic))) + retval) + (should-not (equal (nth 0 retval) (nth 1 retval))))) + +(ert-deftest subr-tests--method-files--nonexistent-methods () + "`method-files' returns nil if asked to find a method which doesn't exist." + (should-not (method-files 'subr-tests--undefined-generic)) + (should-not (method-files 'subr-tests--generic-without-methods))) + (provide 'subr-tests) ;;; subr-tests.el ends here --------------340116A7B3956DC79401AAC4-- From unknown Mon Jun 23 07:50:52 2025 X-Loop: help-debbugs@gnu.org Subject: bug#22294: Generating Edebug names for generic methods (was: bug#22294: Patch) Resent-From: Gemini Lasswell Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 10 May 2017 05:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22294 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Dmitry Gutov Cc: 22294@debbugs.gnu.org Received: via spool by 22294-submit@debbugs.gnu.org id=B22294.14943928944488 (code B ref 22294); Wed, 10 May 2017 05:09:02 +0000 Received: (at 22294) by debbugs.gnu.org; 10 May 2017 05:08:14 +0000 Received: from localhost ([127.0.0.1]:34879 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d8JrB-0001AK-Og for submit@debbugs.gnu.org; Wed, 10 May 2017 01:08:13 -0400 Received: from aibo.runbox.com ([91.220.196.211]:43430) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d8Jr9-0001AC-NZ for 22294@debbugs.gnu.org; Wed, 10 May 2017 01:08:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=runbox.com; s=rbselector1; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From; bh=5cywzNg+Nei/VdAPs7/LPfDHRMYoRegtKwuXYYPG2rw=; b=EomNwfCjtFV4e8IGvBjeHTrBTA deDl0x+2Ks8XYBjESpefr6el/XnDNyuyLzZI0Um3sYya0pGcrhQac4TYSvU/5Ty8Yy2DrhBWOUnsI uI1m8qTg2LqjrtxH9ZjIIIdHMxDdTlE5P5GhnEPr1OOdvNpz/Xszz0UKWYIbK4KMeZq+EfVI2lVX3 Ql8rlwXJUfayl546GYpOq8uwStQuQNv/KfRdcWKmL/llsGhtUq2W4DR+R+jmMu8nEpNWAobKIo/Xl 4ROFu+zHvJprnqVbaoSh4oUeiTmzRw06oUyzvJem9FDCgRmkUxJJYsG5COwwbm4tgkuqAfnUOrsMn zIeL9IfQ==; Received: from [10.9.9.210] (helo=mailfront10.runbox.com) by mailtransmit03.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1d8Jr6-0000J7-KZ; Wed, 10 May 2017 07:08:08 +0200 Received: from c-24-22-244-161.hsd1.wa.comcast.net ([24.22.244.161] helo=chinook) by mailfront10.runbox.com with esmtpsa (uid:179284 ) (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) id 1d8Jqx-0005zv-T4; Wed, 10 May 2017 07:08:00 +0200 From: Gemini Lasswell References: <8637uf24px.fsf@yandex.ru> <3c954fc5-fda2-1c30-a251-e2f3fecd8534@yandex.ru> <871ssevk4e.fsf_-_@runbox.com> <793941ae-4e88-80ef-3ac7-7bd5019b97f7@yandex.ru> <87efw08l99.fsf@chinook> Date: Tue, 09 May 2017 22:07:57 -0700 In-Reply-To: (Dmitry Gutov's message of "Mon, 8 May 2017 05:19:28 +0300") Message-ID: <87zielwb82.fsf_-_@runbox.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Dmitry Gutov writes: > Unfortunately, this code fails when instrumenting a generic method > (e.g. using C-u C-M-x) with something like: > > Unknown specializer foo@setf\ \(v\ \(_y\ \(eql\ 4\)\)\ z\) > > Any thoughts? edebug-match-method-args is definitely at fault there, > but I'm not sure how to improve it. > Changing the return value of edebug-match-method-args from nil to (list args) makes the error go away and the code sample from #24753 work. I haven't tested it beyond that. From unknown Mon Jun 23 07:50:52 2025 X-Loop: help-debbugs@gnu.org Subject: bug#22294: Generating Edebug names for generic methods Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 10 May 2017 14:19:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22294 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Gemini Lasswell Cc: 22294@debbugs.gnu.org Received: via spool by 22294-submit@debbugs.gnu.org id=B22294.149442593310858 (code B ref 22294); Wed, 10 May 2017 14:19:02 +0000 Received: (at 22294) by debbugs.gnu.org; 10 May 2017 14:18:53 +0000 Received: from localhost ([127.0.0.1]:36831 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d8SS4-0002p4-QE for submit@debbugs.gnu.org; Wed, 10 May 2017 10:18:52 -0400 Received: from mail-wm0-f46.google.com ([74.125.82.46]:38267) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d8SS3-0002or-MK for 22294@debbugs.gnu.org; Wed, 10 May 2017 10:18:52 -0400 Received: by mail-wm0-f46.google.com with SMTP id 142so807122wma.1 for <22294@debbugs.gnu.org>; Wed, 10 May 2017 07:18:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=XY83X7wBh34UBeArmaea8QY+RvykB0Y8JzGJG2yxREA=; b=h8I3JOTBBahOySp+j6fPv+j9StoGylAdfkBHOkGnpDU+1FiUSGwz881RZ17Lz4vHKi Qbz1XUgjyHZAwZIPS2hvFZg1BZoCJ0bg10PI0vk5hzZeGZ8CspayG7O/8MkI6gYC8wCm 9lpyl8uBs37s/hnlSUMQM3V+L0AEMHBKVg9A9Y53hYVtqjezTpJi6IU1IWN4zTRTUvxY hqsKjg45CYdv/+UZDQ2TMyX8mMoO/RgqmnSUjdGExjA+/UFzcVhpi0j9HXiDldrEvisj WbYQlKKTl+YyXmiQ35xsQrJXlceFjsw0cve3TqzEuecZFUs/XQGiIfLomokwiK+6Fjra KStg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=XY83X7wBh34UBeArmaea8QY+RvykB0Y8JzGJG2yxREA=; b=OZ7wSnY8WHsb0AQsgDNav0leQlsSx36IZ3LD75P3mJ1gDzBbjfZoMREMEaEK4/NAad GNI0KGpHPPS8xHRqFNNN72WQBqO5Ll3Cy457qMSCSUPL+bjqJcl6GpMpl2swwUtgeoR5 Ubd+lfmfGU3eYBUa47xDpEAhdvvEQ3sNRnCuCDhGCnPHFsxPbf8Mo3wt82Mb+TsmP+O6 lhAigMWBJDscrPzekkaFB5i9b7u4BnjmywwIwcMaJNVO8G/FnTXIq8zIMxL4En9j6WUb XteB+fxs2oUEn+iBoe6zJ3qI8MwwueIPdkWAFQmGNf+VtV+QqWUseKz1j/TKB0ILFPfR LIMw== X-Gm-Message-State: AODbwcCJ9MlzNi5fVpVryOhOOEm5c2K0HwaTCC1scy4hILLptoN+STOT Ri9WKVbM46Nw9g== X-Received: by 10.28.18.69 with SMTP id 66mr392202wms.9.1494425925923; Wed, 10 May 2017 07:18:45 -0700 (PDT) Received: from [192.168.0.133] (static-nbl2-118.cytanet.com.cy. [212.31.107.118]) by smtp.googlemail.com with ESMTPSA id 133sm3554484wms.22.2017.05.10.07.18.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 May 2017 07:18:44 -0700 (PDT) References: <8637uf24px.fsf@yandex.ru> <3c954fc5-fda2-1c30-a251-e2f3fecd8534@yandex.ru> <871ssevk4e.fsf_-_@runbox.com> <793941ae-4e88-80ef-3ac7-7bd5019b97f7@yandex.ru> <87efw08l99.fsf@chinook> <87zielwb82.fsf_-_@runbox.com> From: Dmitry Gutov Message-ID: <3070039f-caf2-3e58-e3d3-afb8eac5152f@yandex.ru> Date: Wed, 10 May 2017 17:18:42 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:53.0) Gecko/20100101 Thunderbird/53.0 MIME-Version: 1.0 In-Reply-To: <87zielwb82.fsf_-_@runbox.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.7 (/) On 10.05.2017 8:07, Gemini Lasswell wrote: > Changing the return value of edebug-match-method-args from nil to > (list args) makes the error go away and the code sample from #24753 > work. I haven't tested it beyond that. Thanks! I only tried `args' (without (list)). My only excuse is that it was late at night. So, what do you think about this modification? It works well in my testing, and it avoids introducing the dynamic variable. I'll commit it in your name (since you did most of the work anyway) if you like it. From unknown Mon Jun 23 07:50:52 2025 X-Loop: help-debbugs@gnu.org Subject: bug#22294: Generating Edebug names for generic methods Resent-From: Gemini Lasswell Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 13 May 2017 20:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22294 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Dmitry Gutov Cc: 22294@debbugs.gnu.org, monnier@iro.umontreal.ca Received: via spool by 22294-submit@debbugs.gnu.org id=B22294.149470910914597 (code B ref 22294); Sat, 13 May 2017 20:59:02 +0000 Received: (at 22294) by debbugs.gnu.org; 13 May 2017 20:58:29 +0000 Received: from localhost ([127.0.0.1]:43289 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d9e7R-0003nM-37 for submit@debbugs.gnu.org; Sat, 13 May 2017 16:58:29 -0400 Received: from aibo.runbox.com ([91.220.196.211]:49594) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d9e7P-0003nE-D5 for 22294@debbugs.gnu.org; Sat, 13 May 2017 16:58:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=runbox.com; s=rbselector1; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From; bh=ZyUKvk738yjvoEBskOY1+YqKwtKfU6WQaCoOhs1d1VI=; b=SZbn9C2MjGa84J/tk+Gfh+mrRI YLzH2pjEC8hb/xaco4mPzpuy4iSWeK9Nb/QqoklIz2YIPEdHwf7x1hrD8g9RNoO2ngmfXL9TEEPzi FVoZHPwhx/pheKb7X7bG4YQC5O2VYAcwr8VOTpVfmA19UnqpIl/3rOkMLdYkpvkawc3H58j6L2Z2W JO7vd6LUnYCD/Ni5Aa5Uqy/2LHFVuHHm9qd1v05g00iOmPMGOUMJbkEmHnRst4Zn2MC1kBVb1G8YV o0mzQKiHzEOnC0LjnT19DnEukP0Rf7yARV/k9pWtBcv6vvGO2jNZMmbkqIxx4WN71D00sYQ3DAaha uluroZqg==; Received: from [10.9.9.210] (helo=mailfront10.runbox.com) by mailtransmit03.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1d9e7K-0003Ey-9d; Sat, 13 May 2017 22:58:22 +0200 Received: from c-24-22-244-161.hsd1.wa.comcast.net ([24.22.244.161] helo=chinook) by mailfront10.runbox.com with esmtpsa (uid:179284 ) (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) id 1d9e79-00075f-K2; Sat, 13 May 2017 22:58:12 +0200 From: Gemini Lasswell References: <8637uf24px.fsf@yandex.ru> <3c954fc5-fda2-1c30-a251-e2f3fecd8534@yandex.ru> <871ssevk4e.fsf_-_@runbox.com> <793941ae-4e88-80ef-3ac7-7bd5019b97f7@yandex.ru> <87efw08l99.fsf@chinook> <87zielwb82.fsf_-_@runbox.com> <3070039f-caf2-3e58-e3d3-afb8eac5152f@yandex.ru> Date: Sat, 13 May 2017 13:58:08 -0700 In-Reply-To: <3070039f-caf2-3e58-e3d3-afb8eac5152f@yandex.ru> (Dmitry Gutov's message of "Wed, 10 May 2017 17:18:42 +0300") Message-ID: <87wp9kwk2n.fsf@runbox.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --=-=-= Content-Type: text/plain Dmitry Gutov writes: > On 10.05.2017 8:07, Gemini Lasswell wrote: > > It works well in my testing, and it avoids introducing the dynamic > variable. I'll commit it in your name (since you did most of the work > anyway) if you like it. It works in my testing too. Here's a revised version of the patch with your changes incorporated and a couple of other changes too. Since a method's argument list is supposed to be a list but not nil, I changed the test for a valid one from listp to consp. I also changed the names of method-args and edebug-match-method-args to cl-generic-method-args and edebug-match-cl-generic-method-args to better associate them with the code that uses them, and to avoid the idea that this might be new Edebug specification list functionality that should really be documented. That documentation already is complex enough that it's hard to understand and doesn't need any new complex things added to it. But if you don't like the name change feel free to change it back. --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=0001-Make-edebug-step-in-work-on-generic-methods-Bug-2229.patch >From f0e50bcfc4e9b80a0975151db8ad18cecf22b719 Mon Sep 17 00:00:00 2001 From: Gemini Lasswell Date: Sat, 13 May 2017 11:35:49 -0700 Subject: [PATCH] Make edebug-step-in work on generic methods (Bug#22294) * lisp/emacs-lisp/edebug.el (edebug-match-cl-generic-method-args): New function to implement the edebug-form-spec property of the symbol cl-generic-method-args. (edebug-instrument-function): If the function is a generic function, find and instrument all of its methods. Return a list instead of a single symbol. (edebug-instrument-callee): Now returns a list. Update docstring. (edebug-step-in): Handle the list returned by edebug-instrument-callee. * lisp/emacs-lisp/cl-generic.el (cl-defmethod): Use name and cl-generic-method-args in its Edebug spec. * lisp/emacs-lisp/eieio-compat.el (defmethod): Use name and cl-generic-method-args in its Edebug spec. * lisp/subr.el (method-files): New function. * test/lisp/subr-tests.el (subr-tests--method-files--finds-methods) (subr-tests--method-files--nonexistent-methods): New tests. --- lisp/emacs-lisp/cl-generic.el | 4 ++-- lisp/emacs-lisp/edebug.el | 53 ++++++++++++++++++++++++++++++++--------- lisp/emacs-lisp/eieio-compat.el | 4 ++-- lisp/subr.el | 19 +++++++++++++++ test/lisp/subr-tests.el | 25 +++++++++++++++++++ 5 files changed, 90 insertions(+), 15 deletions(-) diff --git a/lisp/emacs-lisp/cl-generic.el b/lisp/emacs-lisp/cl-generic.el index 068f4fb0c8..c64376b940 100644 --- a/lisp/emacs-lisp/cl-generic.el +++ b/lisp/emacs-lisp/cl-generic.el @@ -413,12 +413,12 @@ cl-defmethod (declare (doc-string 3) (indent 2) (debug (&define ; this means we are defining something - [&or symbolp ("setf" symbolp)] + [&or name ("setf" name :name setf)] ;; ^^ This is the methods symbol [ &rest atom ] ; Multiple qualifiers are allowed. ; Like in CLOS spec, we support ; any non-list values. - listp ; arguments + cl-generic-method-args ; arguments [ &optional stringp ] ; documentation string def-body))) ; part to be debugged (let ((qualifiers nil)) diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el index 4116e31d0a..65e30f8677 100644 --- a/lisp/emacs-lisp/edebug.el +++ b/lisp/emacs-lisp/edebug.el @@ -1607,6 +1607,7 @@ edebug-match-specs ;; Less frequently used: ;; (function . edebug-match-function) (lambda-expr . edebug-match-lambda-expr) + (cl-generic-method-args . edebug-match-cl-generic-method-args) (¬ . edebug-match-¬) (&key . edebug-match-&key) (place . edebug-match-place) @@ -1900,6 +1901,16 @@ edebug-match-colon-name spec)) nil) +(defun edebug-match-cl-generic-method-args (cursor) + (let ((args (edebug-top-element-required cursor "Expected arguments"))) + (if (not (consp args)) + (edebug-no-match cursor "List expected")) + ;; Append the arguments to edebug-def-name. + (setq edebug-def-name + (intern (format "%s %s" edebug-def-name args))) + (edebug-move-cursor cursor) + (list args))) + (defun edebug-match-arg (cursor) ;; set the def-args bound in edebug-defining-form (let ((edebug-arg (edebug-top-element-required cursor "Expected arg"))) @@ -3186,8 +3197,11 @@ edebug-step-out ))))) (defun edebug-instrument-function (func) - ;; Func should be a function symbol. - ;; Return the function symbol, or nil if not instrumented. + "Instrument the function or generic method FUNC. +Return the list of function symbols which were instrumented. +This may be simply (FUNC) for a normal function, or a list of +generated symbols for methods. If a function or method to +instrument cannot be found, signal an error." (let ((func-marker (get func 'edebug))) (cond ((and (markerp func-marker) (marker-buffer func-marker)) @@ -3195,10 +3209,24 @@ edebug-instrument-function (with-current-buffer (marker-buffer func-marker) (goto-char func-marker) (edebug-eval-top-level-form) - func)) + (list func))) ((consp func-marker) (message "%s is already instrumented." func) - func) + (list func)) + ((get func 'cl--generic) + (let ((method-defs (method-files func)) + symbols) + (unless method-defs + (error "Could not find any method definitions for %s" func)) + (pcase-dolist (`(,file . ,spec) method-defs) + (let* ((loc (find-function-search-for-symbol spec 'cl-defmethod file))) + (unless (cdr loc) + (error "Could not find the definition for %s in its file" spec)) + (with-current-buffer (car loc) + (goto-char (cdr loc)) + (edebug-eval-top-level-form) + (push (edebug-form-data-symbol) symbols)))) + symbols)) (t (let ((loc (find-function-noselect func t))) (unless (cdr loc) @@ -3206,13 +3234,16 @@ edebug-instrument-function (with-current-buffer (car loc) (goto-char (cdr loc)) (edebug-eval-top-level-form) - func)))))) + (list func))))))) (defun edebug-instrument-callee () "Instrument the definition of the function or macro about to be called. Do this when stopped before the form or it will be too late. One side effect of using this command is that the next time the -function or macro is called, Edebug will be called there as well." +function or macro is called, Edebug will be called there as well. +If the callee is a generic function, Edebug will instrument all +the methods, not just the one which is about to be called. Return +the list of symbols which were instrumented." (interactive) (if (not (looking-at "(")) (error "You must be before a list form") @@ -3227,15 +3258,15 @@ edebug-instrument-callee (defun edebug-step-in () - "Step into the definition of the function or macro about to be called. + "Step into the definition of the function, macro or method about to be called. This first does `edebug-instrument-callee' to ensure that it is instrumented. Then it does `edebug-on-entry' and switches to `go' mode." (interactive) - (let ((func (edebug-instrument-callee))) - (if func + (let ((funcs (edebug-instrument-callee))) + (if funcs (progn - (edebug-on-entry func 'temp) - (edebug-go-mode nil))))) + (mapc (lambda (func) (edebug-on-entry func 'temp)) funcs) + (edebug-go-mode nil))))) (defun edebug-on-entry (function &optional flag) "Cause Edebug to stop when FUNCTION is called. diff --git a/lisp/emacs-lisp/eieio-compat.el b/lisp/emacs-lisp/eieio-compat.el index fe65ae0262..e6e6d11870 100644 --- a/lisp/emacs-lisp/eieio-compat.el +++ b/lisp/emacs-lisp/eieio-compat.el @@ -105,10 +105,10 @@ defmethod (declare (doc-string 3) (obsolete cl-defmethod "25.1") (debug (&define ; this means we are defining something - [&or symbolp ("setf" symbolp)] + [&or name ("setf" name :name setf)] ;; ^^ This is the methods symbol [ &optional symbolp ] ; this is key :before etc - listp ; arguments + cl-generic-method-args ; arguments [ &optional stringp ] ; documentation string def-body ; part to be debugged ))) diff --git a/lisp/subr.el b/lisp/subr.el index 02e7993223..8d5d2a779c 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -2026,6 +2026,25 @@ symbol-file (setq files (cdr files))) file))) +(defun method-files (method) + "Return a list of files where METHOD is defined by `cl-defmethod'. +The list will have entries of the form (FILE . (METHOD ...)) +where (METHOD ...) contains the qualifiers and specializers of +the method and is a suitable argument for +`find-function-search-for-symbol'. Filenames are absolute." + (let ((files load-history) + result) + (while files + (let ((defs (cdr (car files)))) + (while defs + (let ((def (car defs))) + (if (and (eq (car-safe def) 'cl-defmethod) + (eq (cadr def) method)) + (push (cons (car (car files)) (cdr def)) result))) + (setq defs (cdr defs)))) + (setq files (cdr files))) + result)) + (defun locate-library (library &optional nosuffix path interactive-call) "Show the precise file name of Emacs library LIBRARY. LIBRARY should be a relative file name of the library, a string. diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el index 0d243cc5d8..4a355bd2c9 100644 --- a/test/lisp/subr-tests.el +++ b/test/lisp/subr-tests.el @@ -291,5 +291,30 @@ subr-test--frames-1 (should-error (eval '(dolist "foo") t) :type 'wrong-type-argument)) + +(require 'cl-generic) +(cl-defgeneric subr-tests--generic (x)) +(cl-defmethod subr-tests--generic ((x string)) + (message "%s is a string" x)) +(cl-defmethod subr-tests--generic ((x integer)) + (message "%s is a number" x)) +(cl-defgeneric subr-tests--generic-without-methods (x y)) +(defvar subr-tests--this-file (or load-file-name buffer-file-name)) + +(ert-deftest subr-tests--method-files--finds-methods () + "`method-files' returns a list of files and methods for a generic function." + (let ((retval (method-files 'subr-tests--generic))) + (should (equal (length retval) 2)) + (mapc (lambda (x) + (should (equal (car x) subr-tests--this-file)) + (should (equal (cadr x) 'subr-tests--generic))) + retval) + (should-not (equal (nth 0 retval) (nth 1 retval))))) + +(ert-deftest subr-tests--method-files--nonexistent-methods () + "`method-files' returns nil if asked to find a method which doesn't exist." + (should-not (method-files 'subr-tests--undefined-generic)) + (should-not (method-files 'subr-tests--generic-without-methods))) + (provide 'subr-tests) ;;; subr-tests.el ends here -- 2.12.2 --=-=-=-- From unknown Mon Jun 23 07:50:52 2025 X-Loop: help-debbugs@gnu.org Subject: bug#22294: Generating Edebug names for generic methods Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 14 May 2017 01:18:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22294 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Gemini Lasswell Cc: 22294@debbugs.gnu.org, monnier@iro.umontreal.ca Received: via spool by 22294-submit@debbugs.gnu.org id=B22294.149472467612578 (code B ref 22294); Sun, 14 May 2017 01:18:01 +0000 Received: (at 22294) by debbugs.gnu.org; 14 May 2017 01:17:56 +0000 Received: from localhost ([127.0.0.1]:43426 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d9iAW-0003Go-MU for submit@debbugs.gnu.org; Sat, 13 May 2017 21:17:56 -0400 Received: from mail-wr0-f181.google.com ([209.85.128.181]:33352) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d9iAU-0003Gb-Ic for 22294@debbugs.gnu.org; Sat, 13 May 2017 21:17:55 -0400 Received: by mail-wr0-f181.google.com with SMTP id w50so60461510wrc.0 for <22294@debbugs.gnu.org>; Sat, 13 May 2017 18:17:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=bCzsNDOgL78DWVHL6o7S3jeRGjyXxYBWNEtnZ2pzQAQ=; b=Db7W1Dy4xZ0EVzaDopiAGZPKNYqRYQ/iSEbb0m+6AZ4gTqRetpr7G9wqXXCZzHm6Rs DfkkxbJslOjqEozMVJ4rDWC+JtaB50PJ4loUud0XzaVDxX8uvUticd3I1dbItpRWH/NM dcwbtQHK31j4jDTpxs0t81Q2BuZ0/70g2PCyzniFX/ld7zKIZMWZiwatYYe4LEqY0Nvf W9DXCVaqGjk3TrUcYyL7CsCrPU2c3XQxU8K/SuSoybPF3xd+wLlx1NdxrdTjL1fcHsVg cpA/b3uu+4Zy7tUpXXlNBluV4GHyr3SXubVGLt8ngEmw6GBj3DIcUpMbwG+Q/D8h+Rpp rxbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=bCzsNDOgL78DWVHL6o7S3jeRGjyXxYBWNEtnZ2pzQAQ=; b=C5DwjnjWJkHBBYSfO9Kk15ZSycFxoJcca6xgaE3Ep4PmT3CVS4ICWh/8IqWLNLgIxl 8wr0lNMN4l5jrBJasrJs+JS9p8BGQGRnist+CzvUV1ao4kZpX4gNbCf0OTvbhEXAOvpO wD5804JFX5iQLz+Z+QH3CtbpZ7EUlFKhy0EE2VHkwazfMS7KH9oqoIUOKVhoHDelTkiB rlXHoY3AhsnC8eZeDiBljdcr4vis2VyM8TxrL8Qj6InCUGNjP90KRvI37lvQ7z2n2QcR gvRVrNTdnDvlmIcaWBvHe7ZzjF2b1Ifqb+zQ0NMV5n0FVD6YkrgEGAtmWTUBZnLlfgjW KiSQ== X-Gm-Message-State: AODbwcDkRSIP7U41X9AfIUMR60/J7xVruc7GHk1QZkAOZciQuWC9W6Ov YVKVOKoec1OwK/Ca7Hk= X-Received: by 10.223.169.226 with SMTP id b89mr7341736wrd.147.1494724669041; Sat, 13 May 2017 18:17:49 -0700 (PDT) Received: from [192.168.1.3] ([185.105.173.156]) by smtp.googlemail.com with ESMTPSA id s5sm4697404wra.60.2017.05.13.18.17.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 13 May 2017 18:17:48 -0700 (PDT) References: <8637uf24px.fsf@yandex.ru> <3c954fc5-fda2-1c30-a251-e2f3fecd8534@yandex.ru> <871ssevk4e.fsf_-_@runbox.com> <793941ae-4e88-80ef-3ac7-7bd5019b97f7@yandex.ru> <87efw08l99.fsf@chinook> <87zielwb82.fsf_-_@runbox.com> <3070039f-caf2-3e58-e3d3-afb8eac5152f@yandex.ru> <87wp9kwk2n.fsf@runbox.com> From: Dmitry Gutov Message-ID: <185bc21c-9730-95f5-74d6-70147d9867a1@yandex.ru> Date: Sun, 14 May 2017 04:17:47 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:53.0) Gecko/20100101 Thunderbird/53.0 MIME-Version: 1.0 In-Reply-To: <87wp9kwk2n.fsf@runbox.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: -2.1 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.1 (--) On 13.05.2017 23:58, Gemini Lasswell wrote: > It works in my testing too. Here's a revised version of the patch with > your changes incorporated and a couple of other changes too. Thanks! I'll push this version shortly. > Since a > method's argument list is supposed to be a list but not nil, I changed > the test for a valid one from listp to consp. Like mentioned, nil arguments list also works (in Emacs but not in CLOS). If people prefer this possibility is not used, though, that's fine by me. > I also changed the names of method-args and edebug-match-method-args to > cl-generic-method-args and edebug-match-cl-generic-method-args to better > associate them with the code that uses them, and to avoid the idea that > this might be new Edebug specification list functionality that should > really be documented. Sounds good. From unknown Mon Jun 23 07:50:52 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Dmitry Gutov Subject: bug#22294: closed (Re: bug#22294: Generating Edebug names for generic methods) Message-ID: References: <3afd59b7-7790-ea92-9ee4-f08263168189@yandex.ru> <8637uf24px.fsf@yandex.ru> X-Gnu-PR-Message: they-closed 22294 X-Gnu-PR-Package: emacs Reply-To: 22294@debbugs.gnu.org Date: Sun, 14 May 2017 20:35:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1494794102-8027-1" This is a multi-part message in MIME format... ------------=_1494794102-8027-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #22294: 25.0.50; edebug should support jumping into generic methods which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 22294@debbugs.gnu.org. --=20 22294: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D22294 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1494794102-8027-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 22294-done) by debbugs.gnu.org; 14 May 2017 20:34:09 +0000 Received: from localhost ([127.0.0.1]:45137 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dA0DQ-00024P-Ow for submit@debbugs.gnu.org; Sun, 14 May 2017 16:34:08 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:33501) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dA0DN-00023t-A8 for 22294-done@debbugs.gnu.org; Sun, 14 May 2017 16:34:05 -0400 Received: by mail-wm0-f68.google.com with SMTP id y10so23880559wmh.0 for <22294-done@debbugs.gnu.org>; Sun, 14 May 2017 13:34:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=OV4/YQ7BvY5ISiUb3GvzRjY374iFHan6ro9fdID25Aw=; b=ARHvjl+oJ4qM+AzZbhiLRRjU2kkZaPtC9/LDIKVmYBU/PtYyiNRgnDN5pOF53wr3FU vYHk2EfZKLtMw1PercdaHngy7toQJr6TVEUQ5556lV70J27svZf0C+ltAH/rnwLJjpj3 vfEb2gfr914v6D0/aHaiT8A2Qt+aHzBTcisDXVDKEzXbKCppyBJKSHsU1R8BsdlJugSA yA7A8dqq0hPVCuvxS9kr0DgUFAaaivuibszizxaHhxSq4iCbcAIefCQqFm2ql2ZdfsMj fGZhOiCaXVeNR5ITrfQhPD/U6c5M+m1U36xJn6hQDHbGWuv7L+D7PXJ77IAd2i+ujfkb eCoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:from:to:cc:references:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=OV4/YQ7BvY5ISiUb3GvzRjY374iFHan6ro9fdID25Aw=; b=epIUfd9rX8vu76vf5wzlbB3UdldOzKp2MsolrTSCpsF9u0g2az97QTAh02D8NhKgR8 dUc08Fzr0P6NnMwTK8OlFBuWjaTsNeJh3d0Z0fl/rYTVSywB4ptR/l3gjddtKh2PHfYN FX4i62izYXAmSRCy64oziv8liA0f0erMmBLZ7hh2P8gRzB+GzAjTZjWcix4Tp7iRC/Ya 0wPhUGCKsFVB2fxTmZxnV/ND3O3QYxm84dGjfgIvbeNIAJcBGUAwTZXVpChfrpMHjNo2 RR8OT7rhVncgD1kuzwwk1LvxICtKVStknkzrSnj+4XdLcoZ4ZckIiT6ipnHi88k7f7C9 Q+wg== X-Gm-Message-State: AODbwcA2SfetH4/8vsZ6WIgomBeb6j53/ko6tjqsJT72Frws7bv0kaIt LEPaYIUEOO0g8g== X-Received: by 10.28.68.195 with SMTP id r186mr1716318wma.22.1494794039609; Sun, 14 May 2017 13:33:59 -0700 (PDT) Received: from [192.168.1.3] ([185.105.173.156]) by smtp.googlemail.com with ESMTPSA id v7sm7354660wrv.59.2017.05.14.13.33.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 14 May 2017 13:33:58 -0700 (PDT) Subject: Re: bug#22294: Generating Edebug names for generic methods From: Dmitry Gutov To: Gemini Lasswell References: <8637uf24px.fsf@yandex.ru> <3c954fc5-fda2-1c30-a251-e2f3fecd8534@yandex.ru> <871ssevk4e.fsf_-_@runbox.com> <793941ae-4e88-80ef-3ac7-7bd5019b97f7@yandex.ru> <87efw08l99.fsf@chinook> <87zielwb82.fsf_-_@runbox.com> <3070039f-caf2-3e58-e3d3-afb8eac5152f@yandex.ru> <87wp9kwk2n.fsf@runbox.com> <185bc21c-9730-95f5-74d6-70147d9867a1@yandex.ru> Message-ID: <3afd59b7-7790-ea92-9ee4-f08263168189@yandex.ru> Date: Sun, 14 May 2017 23:33:56 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:53.0) Gecko/20100101 Thunderbird/53.0 MIME-Version: 1.0 In-Reply-To: <185bc21c-9730-95f5-74d6-70147d9867a1@yandex.ru> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: 22294-done Cc: 22294-done@debbugs.gnu.org, monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.7 (/) On 14.05.2017 4:17, Dmitry Gutov wrote: > I'll push this version shortly. Done, and closing! ------------=_1494794102-8027-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 2 Jan 2016 18:53:31 +0000 Received: from localhost ([127.0.0.1]:35537 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aFRIw-0001vF-Sy for submit@debbugs.gnu.org; Sat, 02 Jan 2016 13:53:31 -0500 Received: from eggs.gnu.org ([208.118.235.92]:59382) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aFRIv-0001v3-Is for submit@debbugs.gnu.org; Sat, 02 Jan 2016 13:53:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aFRIp-0006nn-Ob for submit@debbugs.gnu.org; Sat, 02 Jan 2016 13:53:24 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.4 required=5.0 tests=BAYES_20,BODY_URI_ONLY, FREEMAIL_FROM,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:57664) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aFRIp-0006nj-Ls for submit@debbugs.gnu.org; Sat, 02 Jan 2016 13:53:23 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50353) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aFRIo-0004OO-VP for bug-gnu-emacs@gnu.org; Sat, 02 Jan 2016 13:53:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aFRIk-0006nH-1V for bug-gnu-emacs@gnu.org; Sat, 02 Jan 2016 13:53:22 -0500 Received: from mail-wm0-x232.google.com ([2a00:1450:400c:c09::232]:36878) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aFRIj-0006n4-RN for bug-gnu-emacs@gnu.org; Sat, 02 Jan 2016 13:53:17 -0500 Received: by mail-wm0-x232.google.com with SMTP id f206so164171230wmf.0 for ; Sat, 02 Jan 2016 10:53:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:date:message-id:mime-version:content-type; bh=fK92R8iipE084+9utE7lsgu8DH3ijvNlkZj/t8xuTB0=; b=PtP/8f8aTwRZWZd4rPmj/nZF7n/t4z1fwAyiMw/N8qp93NOH4rBuY4ScjHPpR5LibB Wj1uANgNzmeRC5sj9lyzCnMyKWjWaCe5eJy6PhCSMyG1fit7RG0gtsh0nYb1+3hyhyHx lL9DxswdxcMYlzD6gxK3ZuKI/DMbfMP8CE1gSsUmuqVU8ai235f5XaF8/Y2Q5/RD/kZO 5IQZM0Gqs0y00EoM5r5Cyg5773iMITmpmIasKuy67ucP+5/6jayavZ9Ob+YBMZKhwfwK t5hXyEPpPmStE1Kp6+VDKfuy85Mx7cZZ6Vr2agpOyC19FkT6Ol1sKKarQNVUhUB4VXLN uQVw== X-Received: by 10.28.134.147 with SMTP id i141mr32243107wmd.87.1451760797269; Sat, 02 Jan 2016 10:53:17 -0800 (PST) Received: from axl ([185.105.175.24]) by smtp.gmail.com with ESMTPSA id i196sm58882509wmf.23.2016.01.02.10.53.15 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 02 Jan 2016 10:53:16 -0800 (PST) From: Dmitry Gutov To: bug-gnu-emacs@gnu.org Subject: 25.0.50; edebug should support jumping into generic methods Date: Sat, 02 Jan 2016 20:53:14 +0200 Message-ID: <8637uf24px.fsf@yandex.ru> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -3.8 (---) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.8 (---) This has come up in the discussion of bug#22292. I'd like to add my +1 to the request. ------------=_1494794102-8027-1--