From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jeremy Bryant Newsgroups: gmane.emacs.devel Subject: Re: Incorporate package macrostep into Emacs core Date: Mon, 29 Apr 2024 22:38:27 +0100 Message-ID: <878r0valyk.fsf@jeremybryant.net> References: <87zfvl8r4e.fsf@jeremybryant.net> <874jdspsqb.fsf@bernoul.li> <877cio8fzf.fsf@jeremybryant.net> <87y1b46vhg.fsf@jeremybryant.net> <878r336lvb.fsf@jeremybryant.net> <86y1b1p1ni.fsf@gnu.org> <87y1b0mi4b.fsf@jeremybryant.net> <8734sobkdj.fsf@jeremybryant.net> <86sf0n4sfq.fsf@gnu.org> <87plume5cn.fsf@jeremybryant.net> <867cgtdfhg.fsf@gnu.org> <87edb1duax.fsf@jeremybryant.net> <86pluka80r.fsf@gnu.org> <875xw7ep5d.fsf@jeremybryant.net> <86bk5x1mvb.fsf@gnu.org> <87ttjpceub.fsf@jeremybryant.net> <868r0zw2si.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4320"; mail-complaints-to="usenet@ciao.gmane.io" Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Apr 29 23:39:34 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1s1Yij-0000vC-IX for ged-emacs-devel@m.gmane-mx.org; Mon, 29 Apr 2024 23:39:34 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s1Yi1-0008CM-R0; Mon, 29 Apr 2024 17:38:49 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s1Yhv-0008C5-Aq for emacs-devel@gnu.org; Mon, 29 Apr 2024 17:38:45 -0400 Original-Received: from out-183.mta1.migadu.com ([2001:41d0:203:375::b7]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s1Yhp-0004Vc-Cd for emacs-devel@gnu.org; Mon, 29 Apr 2024 17:38:42 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jeremybryant.net; s=key1; t=1714426710; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=0l53wzfDS+UVbVVn1g2/nSM7sDaMw+gFjAnap3FO0vM=; b=DRj6bwEr7mSIlIVk07UOKoAtZorVWtjfsHVJe3eadpIn+K/JVd1GSAMt89GAGpx1nUezn3 YTyXbdOLYixVrVWgXCd1TAfCmuqI4g9+JQ4Jiwp+xR9X69kBxe3xAykGUOfBJ5sBR6VbNX PGBx1Mb84NGpkAe/0yVAerB7AHBn4SmaZibTZki7XZSOMXpq/lHg/Bwld+6QM2jaUMgUvx NoIKhMEBb5dKbxn27OQ2yIfc9bYfrx5zY1lyAevCgSIVIxbsWtFEJtiJNCcwxaojGO78FQ Yd/UGO1xPyJG3NcyNWPBqa+iH8KQuMPgAdfDswYJwDzajpz9Z5EB9lG2hL4ieg== In-Reply-To: <868r0zw2si.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 27 Apr 2024 12:52:29 +0300") X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=2001:41d0:203:375::b7; envelope-from=jb@jeremybryant.net; helo=out-183.mta1.migadu.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:318387 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> From: Jeremy Bryant >> Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org >> Date: Thu, 25 Apr 2024 22:27:56 +0100 >> >> Absolutely, sorry, attached is the revised patch I have worked on. > > Thanks, a few minor comments below. > >> Subject: [PATCH] Add Macrostep section in manual >> >> Macrostep is an Emacs Lisp macro-expander useful for exploring and >> writing macros. This is based on Jonathan's Oddie's documentation >> in the macrostep package. >> >> * doc/emacs/programs.texi (Programs): Add Macrostep section. >> * doc/emacs/emacs.texi (Top): Add detailed menu reference. > ^^^^^^^ ^^^ > Those TABs should not be there in the commit log message. > >> +You can use @code{macrostep-mode} to explore Lisp macro definitions, and >> +help write new macros, using @kbd{M-x macrostep-expand} when point is >> +over a macro. > > We say "when point is in a macro". "Over" is reserved for mouse > pointer. > >> +@kbd{macrostep} is a minor mode for interactively stepping through the > ^^^^^^^^^ > "macrostep-mode", I guess? And why @kbd? is that something the user > is supposed to type? > >> +The standard keybindings in @code{macrostep-mode} are the following: >> +@table @kbd >> +@item e >> +@itemx = >> +@itemx RET >> +@findex macrostep-expand > > Please move the index entries to _before_ the corresponding @item's, > so that following the index entry lands you on the @item, not after > it. > > Otherwise, this LGTM, thanks. OK - Attached is a revised patch incorporating the ideas above (as well as a refinement from Eshel on clarifying this is for Emacs Lisp). --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Add-Macrostep-section-in-manual.patch >From 4be7abaa0af33936b62119732609a1d4ff8ee1b4 Mon Sep 17 00:00:00 2001 From: Jeremy Bryant Date: Tue, 23 Apr 2024 22:21:07 +0100 Subject: [PATCH] Add Macrostep section in manual Macrostep is an Emacs Lisp macro-expander useful for exploring and writing macros. This is based on Jonathan's Oddie's documentation in the macrostep package. * doc/emacs/programs.texi (Programs): Add Macrostep section. * doc/emacs/emacs.texi (Top): Add detailed menu reference. --- doc/emacs/emacs.texi | 3 ++ doc/emacs/programs.texi | 61 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/doc/emacs/emacs.texi b/doc/emacs/emacs.texi index 7d77f13ab21..2ce47dd6e5e 100644 --- a/doc/emacs/emacs.texi +++ b/doc/emacs/emacs.texi @@ -694,6 +694,9 @@ Top @ifnottex * Fortran:: Fortran mode and its special features. @end ifnottex +@ifnottex +* Macrostep:: Interactive Emacs Lisp macro-expander. +@end ifnottex Top-Level Definitions, or Defuns diff --git a/doc/emacs/programs.texi b/doc/emacs/programs.texi index de28a9f1dd4..8c8542cc374 100644 --- a/doc/emacs/programs.texi +++ b/doc/emacs/programs.texi @@ -45,6 +45,10 @@ Programs @ifnottex * Fortran:: Fortran mode and its special features. @end ifnottex +@ifnottex +* Macrostep:: Interactive Emacs Lisp macro-expander. +@end ifnottex + @end menu @node Program Modes @@ -2235,3 +2239,60 @@ Asm Mode @ifnottex @include fortran-xtra.texi @end ifnottex + +@ifnottex +@node Macrostep +@section Macrostep: interactive Emacs Lisp macro-expander + +You can use @code{macrostep-mode} to explore Lisp macro definitions, and +help write new macros, using @kbd{M-x macrostep-expand} when point is +in a macro. + +@code{macrostep-mode} is a minor mode for interactively stepping through the +expansion of macros in Emacs Lisp source code. It lets you see exactly +what happens at each step of the expansion process by pretty-printing +the expanded forms inline in the source buffer, which is temporarily +read-only while macro expansions are visible. You can expand and +collapse macro forms one step at a time, and evaluate or instrument the +expansions for debugging with Edebug as usual. Single-stepping through +the expansion is particularly useful for debugging macros that expand +into another macro form. These can be difficult to debug with +@code{macroexpand}, which continues expansion until the top-level form +is no longer a macro call. + +The standard keybindings in @code{macrostep-mode} are the following: +@table @kbd +@findex macrostep-expand +@item e +@itemx = +@itemx RET +Expand the macro form following point one step (@code{macrostep-expand}). +@findex macrostep-collapse +@item c +@itemx u +@itemx DEL +Collapse the form following point (@code{macrostep-collapse}). +@findex macrostep-next-macro +@item n +@itemx TAB +Jump to the next macro form in the expansion (@code{macrostep-next-macro}). +@findex macrostep-previous-macro +@item p +@itemx M-TAB +Jump to the previous macro form in the expansion (@code{macrostep-previous-macro}). +@findex macrostep-collapse-all +@item q +@itemx C-c C-c +Collapse all expanded forms and exit macrostep-mode (@code{macrostep-collapse-all}). +@end table + +It's not very useful to enable and disable macrostep-mode directly. +Instead, bind @code{macrostep-expand} to a key in +@code{emacs-lisp-mode-map}, for example @kbd{C-c e}. + +You can then enter @code{macrostep-mode} and expand a macro form +completely by typing @kbd{C-c e e e@dots{}} as many times as necessary. + +Exit macrostep-mode by typing @kbd{q} or @kbd{C-c C-c}, or by +successively typing @kbd{c} to collapse all surrounding expansions. +@end ifnottex -- 2.42.0 --=-=-=--