From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.bugs Subject: bug#17871: 24.4.50; (elisp) `Core Advising Primitives': interactive spec as function? Date: Mon, 05 Aug 2019 08:26:03 +0200 Message-ID: <87o914xh50.fsf@web.de> 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> 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="162935"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: Stefan Monnier , 17871@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Aug 05 08:27:09 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 1huWSb-000gGR-6o for geb-bug-gnu-emacs@m.gmane.org; Mon, 05 Aug 2019 08:27:09 +0200 Original-Received: from localhost ([::1]:50866 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1huWSa-0002zw-6O for geb-bug-gnu-emacs@m.gmane.org; Mon, 05 Aug 2019 02:27:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58989) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1huWSV-0002zo-H5 for bug-gnu-emacs@gnu.org; Mon, 05 Aug 2019 02:27:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1huWSU-00035L-GX for bug-gnu-emacs@gnu.org; Mon, 05 Aug 2019 02:27:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:53920) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1huWSU-00035D-8a for bug-gnu-emacs@gnu.org; Mon, 05 Aug 2019 02:27:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1huWSU-0001lr-2a for bug-gnu-emacs@gnu.org; Mon, 05 Aug 2019 02:27:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Michael Heerdegen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 05 Aug 2019 06:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17871 X-GNU-PR-Package: emacs Original-Received: via spool by 17871-submit@debbugs.gnu.org id=B17871.15649863896761 (code B ref 17871); Mon, 05 Aug 2019 06:27:02 +0000 Original-Received: (at 17871) by debbugs.gnu.org; 5 Aug 2019 06:26:29 +0000 Original-Received: from localhost ([127.0.0.1]:34508 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1huWRx-0001ky-HM for submit@debbugs.gnu.org; Mon, 05 Aug 2019 02:26:29 -0400 Original-Received: from mout.web.de ([212.227.15.4]:39501) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1huWRv-0001km-2E for 17871@debbugs.gnu.org; Mon, 05 Aug 2019 02:26:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=dbaedf251592; t=1564986365; bh=7znvYA1y5lnNzBkAHKOU06t3hZTdvN0qjrC6nWOyQBg=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=lisqod/zJhg6hfCVB/8WYNUqwHiJQVlU6R9Fl+UdD3MxVLv7b1Dse1UCvPFu7U1e8 tSY4fbyDz34mNfuxz3UVg/ivUqZuCc4cwNv6hngCR6moFLki52SKXFy4Z9zC5h863j W9L07brhBJO/QXTk0x1ZVTuru8lR2pPszDqMhsWA= X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9 Original-Received: from drachen.dragon ([92.208.178.242]) by smtp.web.de (mrweb003 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MIN5j-1hun1X434h-004B4i; Mon, 05 Aug 2019 08:26:05 +0200 In-Reply-To: <878ss99jhi.fsf@mouse.gnus.org> (Lars Ingebrigtsen's message of "Sun, 04 Aug 2019 14:56:57 +0200") X-Provags-ID: V03:K1:Uu6r8yHeKg3cO3HSfnPG6Kf8hdrUXxQ/jqr83MzWJOW5dFF7fNI 4tXkosf2gC+Akb6V5jVpeE9VzX640AyYXv/Qw23V8SNzcNCSA4RsP+S6qUVEYshKx0yGPB9 AMlkf0PGZ0nMAhBnZO2Duw5/rBLDYVei/8XtzoiO5eHlwEHuRL4aqzP8dazh2B5oVcCPMNC dIV/+nWECy1vcWtgZ+sFA== X-UI-Out-Filterresults: notjunk:1;V03:K0:vGMH9UYcSlw=:kk9sg0GFJmtxBmphynrsIh PimaVZoTqeSBN5STGnO+sSYNZkA+He4Dad4yJLZ5ZuQH2gi1/0uLpACFYL85I6eXabo3CSBWh 9huW5wdm1X79VGdaZf55+CNej5JIpoQ6DumAln+oL2jY+F0DK6LyfYvwD6tk/l2iBGJVTH/cc gdKpzP78LktgtB7cYfpcKwIwGW29olqp2R+YFsj9/33k/KvlhVbjUk3Xije3Hd5JALhxj2xRm 5LYEjEoc3vJL+R5Ea1DSdAKFJk6eGtRtz5B3aDLCB6Rw0qtkkhLj63kjUN96THg8AlQPMbiy8 Zb3ulHMzP7OxQl1u5wukFKd1YeqLNArEM8MRTECAn+YvHcsiEH59KJl0tQJY18tGttXC9q8KM roNNR6BH7EAymsECarhCsuTDOqxzGbFWWj2EfrQHhDCPkwHrmnEiifrTIjIajsoOk2ad5mWYf 4dj0K4lH9O61Si85tDW4jMSdOzF7Qr88npWipHZGmZxwfqYqshssXEaL2t54Rj9VbxEw0oh0b 19MOPhviGJtIR04ShoGse5CPJ6Vz5oTSVsG/SbgW7DcnJk6wxmMuKQQfEGv9t4tO6nu+lXeCm R8Z3x25whjQPAhKtDUA7ZMZaO5gRDD/IGxuXhymqdITzVJtaoxjz3eW34zAF8X1qMptrYUw8E pmJhi+hLGPDFPxKgkZqKlcH2C3Ppnp4UWBT7g4Nhb8y4HAyCINgsmgnuQ+CZk/sadTSYz5Gu5 muMufRFHwA44E6lhJvVp3SFt9oCCS1ujixgIFJBuQZ918MEnZE1t0lJnfPau9dScUYQQzaqg 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:164613 Archived-At: Lars Ingebrigtsen writes: > Michael Heerdegen writes: > > > I guess SPEC is never functionp, at least after that change. By > > skimming over the code, the > > > > (interactive (lambda (old-interactive-form) ...)) > > > > case is transformed by `advice--make-interactive-form' to something else > > that is not a function, and apart from this, interactive specs are never > > functionp. > > Ah, right. But since `advice--make-interactive-form' does the > transform, then I guess functionp interactive specs in advice is still > allowed? Would surprise me if not. > And then we should add an example in the manual, I think. Anybody got > one? :-) If nobody suggests a nice one (the one by =C5=A0t=C4=9Bp=C3=A1n is not bad)= , we could construct one deriving from the following typical use cases: (1) Changing how input is read for a single command. =C5=A0t=C4=9Bp=C3=A1n= 's example is such a thing. Make individual commands use helm or ido or icicles, or single command not use helm or ido or icicles although the according mode is turned on, is a use case. (2) Enhance a command to accept an additional argument. The interactive form of the :around advice will reuse the interactive form of the original command to read in the arguments the original command accepts, read in the additional argument, and return the combined list. (3) Make input reading saver: If certain input for a command is potentially dangerous or error-prone, one could change it to add tests/ ask for confirmation, or run it in a loop y (confirm) n (abort) r (retry, give new input). I think (2) could provide a nice playground example if no one suggests something nice real-life. Michael.