From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#22294: Patch Date: Sun, 7 May 2017 05:34:23 +0300 Message-ID: <793941ae-4e88-80ef-3ac7-7bd5019b97f7@yandex.ru> References: <8637uf24px.fsf@yandex.ru> <3c954fc5-fda2-1c30-a251-e2f3fecd8534@yandex.ru> <871ssevk4e.fsf_-_@runbox.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1494124512 32349 195.159.176.226 (7 May 2017 02:35:12 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 7 May 2017 02:35:12 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:53.0) Gecko/20100101 Thunderbird/53.0 Cc: 22294@debbugs.gnu.org To: Gemini Lasswell Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun May 07 04:35:07 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d7C2M-0008KU-Aw for geb-bug-gnu-emacs@m.gmane.org; Sun, 07 May 2017 04:35:06 +0200 Original-Received: from localhost ([::1]:53423 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d7C2S-0005KM-2r for geb-bug-gnu-emacs@m.gmane.org; Sat, 06 May 2017 22:35:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60271) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d7C2M-0005Ir-Fw for bug-gnu-emacs@gnu.org; Sat, 06 May 2017 22:35:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d7C2I-0006KP-HE for bug-gnu-emacs@gnu.org; Sat, 06 May 2017 22:35:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:60724) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d7C2I-0006KK-Cd for bug-gnu-emacs@gnu.org; Sat, 06 May 2017 22:35:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1d7C2I-00039o-6x for bug-gnu-emacs@gnu.org; Sat, 06 May 2017 22:35:02 -0400 X-Loop: help-debbugs@gnu.org 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: Original-Received: via spool by 22294-submit@debbugs.gnu.org id=B22294.149412447312095 (code B ref 22294); Sun, 07 May 2017 02:35:02 +0000 Original-Received: (at 22294) by debbugs.gnu.org; 7 May 2017 02:34:33 +0000 Original-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 Original-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 Original-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) Original-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) In-Reply-To: <871ssevk4e.fsf_-_@runbox.com> Content-Language: en-US X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] 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" Xref: news.gmane.org gmane.emacs.bugs:132330 Archived-At: 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.