From unknown Thu Sep 11 06:33:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#12844: 24.2.50; feature request: advice.el: implement `ad-do-interactive'? Resent-From: Michael Heerdegen Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 09 Nov 2012 17:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 12844 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 12844@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.135248366432270 (code B ref -1); Fri, 09 Nov 2012 17:55:02 +0000 Received: (at submit) by debbugs.gnu.org; 9 Nov 2012 17:54:24 +0000 Received: from localhost ([127.0.0.1]:58270 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TWsme-0008OR-1k for submit@debbugs.gnu.org; Fri, 09 Nov 2012 12:54:24 -0500 Received: from eggs.gnu.org ([208.118.235.92]:51305) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TWsmb-0008OI-MP for submit@debbugs.gnu.org; Fri, 09 Nov 2012 12:54:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TWsmR-0003J5-Tx for submit@debbugs.gnu.org; Fri, 09 Nov 2012 12:54:13 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI,RCVD_IN_XBL autolearn=ham version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:55058) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TWsmR-0003In-Py for submit@debbugs.gnu.org; Fri, 09 Nov 2012 12:54:11 -0500 Received: from eggs.gnu.org ([208.118.235.92]:36953) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TWsmQ-0007YU-33 for bug-gnu-emacs@gnu.org; Fri, 09 Nov 2012 12:54:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TWsYU-0007Ab-3u for bug-gnu-emacs@gnu.org; Fri, 09 Nov 2012 12:39:46 -0500 Received: from mout.web.de ([212.227.17.11]:63833) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TWsYT-0007AU-QI for bug-gnu-emacs@gnu.org; Fri, 09 Nov 2012 12:39:46 -0500 Received: from drachen.dragon ([89.204.130.15]) by smtp.web.de (mrweb003) with ESMTPSA (Nemesis) id 0MgfH5-1TjISm15kd-00NyMv; Fri, 09 Nov 2012 18:39:43 +0100 From: Michael Heerdegen Date: Fri, 09 Nov 2012 18:40:08 +0100 Message-ID: <87k3tuvfnr.fsf@web.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V02:K0:GevC3bNdI69gJs6wNMHSdQooXygBXcpoESxFehfj97K 7DO44nGxwnxl93Xq54knM8V7184VqjtaDHy3FB9bAzhL9ZMYgB 2ojQEjPUFuLuNM/qgsJIk2f4gyMhDyOCLE2h14xtk7C0OqspjX J7ChbYZgiMdsevWEbzRQ8BqcrQEuArSbAF9Uf42V8BCDUkbMfb 3r5mk8TztsVGnNR47aYvNXVxt8vy/soyc5GJnuUMws= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) Hello, I faced this situation too often - that's why I decided to file a bug report now. `defadvice' provides a pseudo variable `ad-do-it' which we all know, it is very practical. It makes it often unnecessary to copy and paste code from the original function if we only want to bind some vars to certain values etc. Now I ask if we could do the same for the `interactive' specification. `defadvice' allows to redefine the interactive spec of the original function - but if it is a (maybe very complicated) list expression, there's currently no way to refer to it in `defadvice'. I want to give an example why this would be useful: The package `eldoc-eval' by Thierry Volpiatto implements a macro `with-eldoc-in-minibuffer' that enables displaying eldoc information in the mode-line while an expression is read from the minibuffer. I wanted to use this for `debugger-record-expression'. So I tried: (defadvice debugger-record-expression (around use-eldoc-eval activate) "Use eldoc-eval when reading the expression." (with-eldoc-in-minibuffer ad-do-it)) But that doesn't work, because the expression is read in by the interactive spec of `debugger-record-expression'. I now have this solution: (require 'debug) (defvar debugger-record-expression-orig-interactive-form (cdr (interactive-form 'debugger-record-expression))) (eval `(defadvice debugger-record-expression (around use-eldoc-eval activate) "Use eldoc-eval when reading the expression." (interactive (with-eldoc-in-minibuffer (list ,@debugger-record-expression-orig-interactive-form))) ad-do-it)) Looks not very nice, but works, and it screams for automation. Dunno if it's really that easy in general, but it would be a good feature. I often missed something like `ad-do-interactive'. The goal is to use it like that: (defadvice debugger-record-expression (around use-eldoc-eval activate) (interactive (with-eldoc-in-minibuffer ad-do-interactive)) ad-do-it) Regards, Michael. In GNU Emacs 24.2.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.4.2) of 2012-11-01 on dex, modified by Debian (emacs-snapshot package, version 2:20121101-1) Windowing system distributor `The X.Org Foundation', version 11.0.10707000 System Description: Debian GNU/Linux testing (wheezy) Configured using: `configure '--build' 'x86_64-linux-gnu' '--host' 'x86_64-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs-snapshot:/etc/emacs:/usr/local/share/emacs/24.2.50/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.2.50/site-lisp:/usr/share/emacs/site-lisp' '--without-compress-info' '--with-crt-dir=/usr/lib/x86_64-linux-gnu/' '--with-x=yes' '--with-x-toolkit=gtk3' '--with-imagemagick=yes' 'build_alias=x86_64-linux-gnu' 'host_alias=x86_64-linux-gnu' 'CFLAGS=-DDEBIAN -DSITELOAD_PURESIZE_EXTRA=5000 -g -O2' 'LDFLAGS=-g -Wl,--as-needed -znocombreloc' 'CPPFLAGS=-D_FORTIFY_SOURCE=2'' Important settings: value of $LC_ALL: de_DE.utf8 value of $LC_TIME: C value of $LANG: de_DE.utf8 locale-coding-system: utf-8-unix default enable-multibyte-characters: t From unknown Thu Sep 11 06:33:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#12844: 24.2.50; feature request: advice.el: implement `ad-do-interactive'? Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 09 Nov 2012 19:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 12844 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Michael Heerdegen Cc: 12844@debbugs.gnu.org Received: via spool by 12844-submit@debbugs.gnu.org id=B12844.135248955811905 (code B ref 12844); Fri, 09 Nov 2012 19:33:02 +0000 Received: (at 12844) by debbugs.gnu.org; 9 Nov 2012 19:32:38 +0000 Received: from localhost ([127.0.0.1]:58367 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TWuJh-00035t-R9 for submit@debbugs.gnu.org; Fri, 09 Nov 2012 14:32:38 -0500 Received: from chene.dit.umontreal.ca ([132.204.246.20]:54367) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TWuJe-00035f-OY; Fri, 09 Nov 2012 14:32:36 -0500 Received: from faina.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id qA9JWNgs020202; Fri, 9 Nov 2012 14:32:23 -0500 Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id C1DE9B4278; Fri, 9 Nov 2012 14:32:23 -0500 (EST) From: Stefan Monnier Message-ID: References: <87k3tuvfnr.fsf@web.de> Date: Fri, 09 Nov 2012 14:32:23 -0500 In-Reply-To: <87k3tuvfnr.fsf@web.de> (Michael Heerdegen's message of "Fri, 09 Nov 2012 18:40:08 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV4396=0 X-NAI-Spam-Version: 2.2.0.9309 : core <4396> : streams <854620> : uri <1263854> X-Spam-Score: -1.2 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.0 (--) severity 12844 wishlist thanks > `defadvice' provides a pseudo variable `ad-do-it' which we all know, it [...] > Now I ask if we could do the same for the `interactive' specification. [...] > (defadvice debugger-record-expression (around use-eldoc-eval activate) > (interactive (with-eldoc-in-minibuffer ad-do-interactive)) > ad-do-it) Interesting! I have a new advice facility waiting to be installed into trunk (not a replacement for advice.el, instead something much less ambitious but which should still cover the needs currently satisfied by `defadvice'). So to tell you the truth, I see advice.el as "on the slow way out" and am not really interested in developing it further. But my new advice facility suffers from the same shortcoming you mention, and I agree it would make sense to try and address it. So, I don't have a solution to offer yet, but I'll keep it in mind. Stefan From unknown Thu Sep 11 06:33:33 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.428 (Entity 5.428) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Michael Heerdegen Subject: bug#12844: closed (Re: bug#12844: 24.2.50; feature request: advice.el: implement `ad-do-interactive'?) Message-ID: References: <87k3tuvfnr.fsf@web.de> X-Gnu-PR-Message: they-closed 12844 X-Gnu-PR-Package: emacs Reply-To: 12844@debbugs.gnu.org Date: Wed, 14 Nov 2012 20:40:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1352925602-23394-1" This is a multi-part message in MIME format... ------------=_1352925602-23394-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #12844: 24.2.50; feature request: advice.el: implement `ad-do-interactive'? 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 12844@debbugs.gnu.org. --=20 12844: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D12844 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1352925602-23394-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 12844-done) by debbugs.gnu.org; 14 Nov 2012 20:39:38 +0000 Received: from localhost ([127.0.0.1]:42771 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TYjkI-00064g-Cc for submit@debbugs.gnu.org; Wed, 14 Nov 2012 15:39:38 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:62211) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TYjkH-00064Z-2Q for 12844-done@debbugs.gnu.org; Wed, 14 Nov 2012 15:39:37 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ai0FAG6Zu09sr+ZY/2dsb2JhbABEsEiDSYEIghUBAQQBViMFCws0EhQYDSQuh24FugmQRAOIQppxgViDBw X-IronPort-AV: E=Sophos;i="4.75,637,1330923600"; d="scan'208";a="207625399" Received: from 108-175-230-88.dsl.teksavvy.com (HELO pastel.home) ([108.175.230.88]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 14 Nov 2012 15:38:59 -0500 Received: by pastel.home (Postfix, from userid 20848) id 99424594C8; Wed, 14 Nov 2012 15:38:58 -0500 (EST) From: Stefan Monnier To: Michael Heerdegen Subject: Re: bug#12844: 24.2.50; feature request: advice.el: implement `ad-do-interactive'? Message-ID: References: <87k3tuvfnr.fsf@web.de> Date: Wed, 14 Nov 2012 15:38:58 -0500 In-Reply-To: (Stefan Monnier's message of "Fri, 09 Nov 2012 14:32:23 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.8 (/) X-Debbugs-Envelope-To: 12844-done Cc: 12844-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: 0.8 (/) > So, I don't have a solution to offer yet, but I'll keep it in mind. Actually, it was easy enough to implement. So you can try it out on the trunk: (defun sm-test-advice (&rest _args) (interactive (lambda (spec) (with-eldoc-in-minibuffer (advice-eval-interactive-spec spec)))) nil) (advice-add 'debugger-record-expression :before #'sm-test-advice) -- Stefan ------------=_1352925602-23394-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 9 Nov 2012 17:54:24 +0000 Received: from localhost ([127.0.0.1]:58270 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TWsme-0008OR-1k for submit@debbugs.gnu.org; Fri, 09 Nov 2012 12:54:24 -0500 Received: from eggs.gnu.org ([208.118.235.92]:51305) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TWsmb-0008OI-MP for submit@debbugs.gnu.org; Fri, 09 Nov 2012 12:54:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TWsmR-0003J5-Tx for submit@debbugs.gnu.org; Fri, 09 Nov 2012 12:54:13 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI,RCVD_IN_XBL autolearn=ham version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:55058) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TWsmR-0003In-Py for submit@debbugs.gnu.org; Fri, 09 Nov 2012 12:54:11 -0500 Received: from eggs.gnu.org ([208.118.235.92]:36953) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TWsmQ-0007YU-33 for bug-gnu-emacs@gnu.org; Fri, 09 Nov 2012 12:54:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TWsYU-0007Ab-3u for bug-gnu-emacs@gnu.org; Fri, 09 Nov 2012 12:39:46 -0500 Received: from mout.web.de ([212.227.17.11]:63833) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TWsYT-0007AU-QI for bug-gnu-emacs@gnu.org; Fri, 09 Nov 2012 12:39:46 -0500 Received: from drachen.dragon ([89.204.130.15]) by smtp.web.de (mrweb003) with ESMTPSA (Nemesis) id 0MgfH5-1TjISm15kd-00NyMv; Fri, 09 Nov 2012 18:39:43 +0100 From: Michael Heerdegen To: bug-gnu-emacs@gnu.org Subject: 24.2.50; feature request: advice.el: implement `ad-do-interactive'? Date: Fri, 09 Nov 2012 18:40:08 +0100 Message-ID: <87k3tuvfnr.fsf@web.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V02:K0:GevC3bNdI69gJs6wNMHSdQooXygBXcpoESxFehfj97K 7DO44nGxwnxl93Xq54knM8V7184VqjtaDHy3FB9bAzhL9ZMYgB 2ojQEjPUFuLuNM/qgsJIk2f4gyMhDyOCLE2h14xtk7C0OqspjX J7ChbYZgiMdsevWEbzRQ8BqcrQEuArSbAF9Uf42V8BCDUkbMfb 3r5mk8TztsVGnNR47aYvNXVxt8vy/soyc5GJnuUMws= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) Hello, I faced this situation too often - that's why I decided to file a bug report now. `defadvice' provides a pseudo variable `ad-do-it' which we all know, it is very practical. It makes it often unnecessary to copy and paste code from the original function if we only want to bind some vars to certain values etc. Now I ask if we could do the same for the `interactive' specification. `defadvice' allows to redefine the interactive spec of the original function - but if it is a (maybe very complicated) list expression, there's currently no way to refer to it in `defadvice'. I want to give an example why this would be useful: The package `eldoc-eval' by Thierry Volpiatto implements a macro `with-eldoc-in-minibuffer' that enables displaying eldoc information in the mode-line while an expression is read from the minibuffer. I wanted to use this for `debugger-record-expression'. So I tried: (defadvice debugger-record-expression (around use-eldoc-eval activate) "Use eldoc-eval when reading the expression." (with-eldoc-in-minibuffer ad-do-it)) But that doesn't work, because the expression is read in by the interactive spec of `debugger-record-expression'. I now have this solution: (require 'debug) (defvar debugger-record-expression-orig-interactive-form (cdr (interactive-form 'debugger-record-expression))) (eval `(defadvice debugger-record-expression (around use-eldoc-eval activate) "Use eldoc-eval when reading the expression." (interactive (with-eldoc-in-minibuffer (list ,@debugger-record-expression-orig-interactive-form))) ad-do-it)) Looks not very nice, but works, and it screams for automation. Dunno if it's really that easy in general, but it would be a good feature. I often missed something like `ad-do-interactive'. The goal is to use it like that: (defadvice debugger-record-expression (around use-eldoc-eval activate) (interactive (with-eldoc-in-minibuffer ad-do-interactive)) ad-do-it) Regards, Michael. In GNU Emacs 24.2.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.4.2) of 2012-11-01 on dex, modified by Debian (emacs-snapshot package, version 2:20121101-1) Windowing system distributor `The X.Org Foundation', version 11.0.10707000 System Description: Debian GNU/Linux testing (wheezy) Configured using: `configure '--build' 'x86_64-linux-gnu' '--host' 'x86_64-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs-snapshot:/etc/emacs:/usr/local/share/emacs/24.2.50/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.2.50/site-lisp:/usr/share/emacs/site-lisp' '--without-compress-info' '--with-crt-dir=/usr/lib/x86_64-linux-gnu/' '--with-x=yes' '--with-x-toolkit=gtk3' '--with-imagemagick=yes' 'build_alias=x86_64-linux-gnu' 'host_alias=x86_64-linux-gnu' 'CFLAGS=-DDEBIAN -DSITELOAD_PURESIZE_EXTRA=5000 -g -O2' 'LDFLAGS=-g -Wl,--as-needed -znocombreloc' 'CPPFLAGS=-D_FORTIFY_SOURCE=2'' Important settings: value of $LC_ALL: de_DE.utf8 value of $LC_TIME: C value of $LANG: de_DE.utf8 locale-coding-system: utf-8-unix default enable-multibyte-characters: t ------------=_1352925602-23394-1--