From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?=C5=A0t=C4=9Bp=C3=A1n_?= =?UTF-8?Q?N=C4=9Bmec?= Newsgroups: gmane.emacs.bugs Subject: bug#17871: 24.4.50; (elisp) `Core Advising Primitives': interactive spec as function? Date: Wed, 21 Aug 2019 10:17:42 +0200 Message-ID: <87k1b7j5jt.fsf@gmail.com> References: <400906ac-35f1-48e4-8df9-8e65b340209b@default> <87vbrjdajs.fsf@web.de> <82178260-247b-4653-85db-d6586480419e@default> <87d2dqdsyj.fsf@web.de> <8736ihb0ds.fsf@mouse.gnus.org> <87d0hl3xqx.fsf@web.de> <878ss99jhi.fsf@mouse.gnus.org> <87o914xh50.fsf@web.de> <87ftmgdl2d.fsf@mouse.gnus.org> <8736hy1wxt.fsf@web.de> <87ef1i38g4.fsf@gmail.com> <87k1ba3wgc.fsf@mouse.gnus.org> <877e7a2fut.fsf@gmail.com> <87d0gzwnm6.fsf@mail.linkov.net> <87o90jjw3t.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="174113"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: Michael Heerdegen , Lars Ingebrigtsen , Juri Linkov , 17871@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Aug 21 10:18:14 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1i0Lor-000j8E-51 for geb-bug-gnu-emacs@m.gmane.org; Wed, 21 Aug 2019 10:18:13 +0200 Original-Received: from localhost ([::1]:45048 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i0Lop-0005IB-RD for geb-bug-gnu-emacs@m.gmane.org; Wed, 21 Aug 2019 04:18:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50490) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i0Loj-0005Gd-Ik for bug-gnu-emacs@gnu.org; Wed, 21 Aug 2019 04:18:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i0Loi-00036I-Cp for bug-gnu-emacs@gnu.org; Wed, 21 Aug 2019 04:18:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:53930) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i0Loi-000367-6n for bug-gnu-emacs@gnu.org; Wed, 21 Aug 2019 04:18:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1i0Loh-0005VD-W7 for bug-gnu-emacs@gnu.org; Wed, 21 Aug 2019 04:18:04 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?=C5=A0t=C4=9Bp=C3=A1n_?= =?UTF-8?Q?N=C4=9Bmec?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 21 Aug 2019 08:18:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17871 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: fixed Original-Received: via spool by 17871-submit@debbugs.gnu.org id=B17871.156637547221135 (code B ref 17871); Wed, 21 Aug 2019 08:18:03 +0000 Original-Received: (at 17871) by debbugs.gnu.org; 21 Aug 2019 08:17:52 +0000 Original-Received: from localhost ([127.0.0.1]:34518 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i0LoV-0005Uo-MR for submit@debbugs.gnu.org; Wed, 21 Aug 2019 04:17:51 -0400 Original-Received: from mail-wm1-f41.google.com ([209.85.128.41]:50892) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i0LoT-0005Ud-Su for 17871@debbugs.gnu.org; Wed, 21 Aug 2019 04:17:50 -0400 Original-Received: by mail-wm1-f41.google.com with SMTP id v15so1167216wml.0 for <17871@debbugs.gnu.org>; Wed, 21 Aug 2019 01:17:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-transfer-encoding; bh=DjNN8em7BuwCNz4P+eYMCtjHOryY3JeTomrZgJygnL0=; b=bF/bdCJPUSEsraxF7gKLkdLO2gU97zDMKAkMfJlqzlkh7aO1mHC24M9RhGiYa6wFIi Ep9ynEo3omoFUQpqMr9uDozMoDgM7OknXnLAmc5tbO46ZmU1tnQLHMdmQJDkvQ7nLYIZ dVwC2JSBopljCvvW6MjjOu6eJlbWBOX49LRPiHObG8jJRIVY/41r4dAUW/fM6eNzrlLd Qnyh/00qnOmXFkKSwuRz+movMIZzEZ3wFuzFmGxW190rBter5K5nYcEKHQAjH6Xx4Md+ Tnde8JreqIKnWMKPi9hkpAnxbf2qFzKChkUTeJhcd+50YAnVlNbFks4Shze4d936yF6V zOAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references :user-agent:date:message-id:mime-version:content-transfer-encoding; bh=DjNN8em7BuwCNz4P+eYMCtjHOryY3JeTomrZgJygnL0=; b=FEp4SUAfSzaNlI6vyLlBtsfM+je4phtutPTyCq8PGKjWntx8QA/Z/Dt+IE0dS/zth6 2Vk/QCLjb61tNzevSfZX3OHHRHGxaj/T52vn4wunkgEcya+zWshtbsoKgmwqhK/Fkdsg Jfbm86DyvyL69PsrS6O/jVhAW7cG4eXHCkCLw/auKKosNd9+fMWSC060h85Pau1+IP/6 RsXyKPKNEy2rwY9/gmxR41215bvazNR6MXNZUjGDZEioGYtWIR9HeGyIBkBlXEtq/X5b MraFommRaB9sTjGx3KKBAnQEOtEr83xR4kccmaES4g0zbypwPKUyNPHHEXXdw0tCcIFt oPvQ== X-Gm-Message-State: APjAAAXDlIrfp+BVp1l5YO7ju3yfzgvwrCJA08UQbzS1UHF0q+Jx0Uf/ P0uc9hifNnH8FKCgK4Z88zM= X-Google-Smtp-Source: APXvYqxwjZPQcLooiDAVZdLY5dQXZbX7a58d6y1bkH49MRNBZUPLYLpNhjN2+973N58koOGXJbsy9w== X-Received: by 2002:a05:600c:254a:: with SMTP id e10mr4766447wma.113.1566375463969; Wed, 21 Aug 2019 01:17:43 -0700 (PDT) Original-Received: from localhost ([185.112.167.114]) by smtp.gmail.com with ESMTPSA id u6sm2145702wmm.26.2019.08.21.01.17.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Aug 2019 01:17:43 -0700 (PDT) In-Reply-To: (Stefan Monnier's message of "Wed, 21 Aug 2019 03:01:23 -0400") 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: 209.51.188.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:165478 Archived-At: On Wed, 21 Aug 2019 03:01:23 -0400 Stefan Monnier wrote: > The interactive form is executed to build the args with which the > function will be called (hence your advice is only executed after the > interactive spec), so in order for your code to do what you want, > we'd have to always wrap the interactive spec identically to the body. Thank you! I guess from the implementation POV this is obvious, but I think this simple use case (wrap a function/command) is one of the most common around advice usage patterns, and I at least was utterly confused by the behaviour, so I'd have appreciated very much if this "gotcha" was documented somewhere (my commented example[1] was intended as possible material for that, but even simple one-sentence mention would be great help). > Maybe in this case it'd do what you want, but in many other cases > it wouldn't. Do you mean cases where one might _want_ to only affect the body, not the interactive form? I can't really imagine anything like that... do you have anything concrete in mind? The current need to wrap the two separately really feels like jumping through hoops to me[2], but I guess dwimmishly auto-wrapping the interactive spec sounds kinda dirty, and would break those other cases I can't imagine. [1] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D17871#38 [2] Juri's example is a good illustration of that: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D36826#41 --=20 =C5=A0t=C4=9Bp=C3=A1n