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: Thu, 25 Apr 2024 22:27:56 +0100 Message-ID: <87ttjpceub.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> 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="20271"; 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 Thu Apr 25 23:29:07 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 1s06eO-0004wA-Vj for ged-emacs-devel@m.gmane-mx.org; Thu, 25 Apr 2024 23:29:05 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s06dU-0005wY-CC; Thu, 25 Apr 2024 17:28:08 -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 1s06dS-0005w4-33 for emacs-devel@gnu.org; Thu, 25 Apr 2024 17:28:06 -0400 Original-Received: from out-180.mta1.migadu.com ([2001:41d0:203:375::b4]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s06dO-0006Rf-Ju for emacs-devel@gnu.org; Thu, 25 Apr 2024 17:28:05 -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=1714080478; 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=SL20Xnaxbq6+6iBkAxGr9GW0WgCD6CBgQZr/acfuF+g=; b=F4ON4jx0MmJVrKNEeprEd1940g+I4qA+4w3UYUjxnHoIoSnmAcYQ0RS7xP/rAYQCMSLtos 7Lh+WxW2gaCCo5nVPgR5tAtjKBfnizsWea6Jko3ORD8x1xonI6orvJ5QoY1z0T87twy7LZ ahp/oMprtCFfpi/84NAsWdyVgSthw5gweEl8FIWoKJJSxgy9v+HJddKsP1YzIyykK7cGFY cCLU85X0I0W8r17Sp2C+MQ0esXxR9FDiFSkkvvxnJ/bIFPpWGkOT+RWU8dT6kh3rQKtnii G9cYMAa9Y1qCAILXZePd0uxKMEwfMQTchSv0JNp52+lQxI1rK7fl0O04fjyURw== In-Reply-To: <86bk5x1mvb.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 25 Apr 2024 18:30:00 +0300") X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=2001:41d0:203:375::b4; envelope-from=jb@jeremybryant.net; helo=out-180.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:318101 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> From: Jeremy Bryant >> Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org >> Date: Tue, 23 Apr 2024 22:37:50 +0100 >> >> Eli Zaretskii writes: >> >> >> From: Jeremy Bryant >> >> Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org >> >> Date: Fri, 19 Apr 2024 20:30:30 +0100 >> >> >> >> > . should this be in the user manual instead? it sounds like a >> >> > user-level feature, not Lisp programming level feature >> >> >> >> Sure, perhaps this is more suited. >> >> >> >> I initially followed your confirmation to write in the Emacs Lisp manual >> >> (top of this message), but indeed this may belong more appropriately in >> >> the Emacs manual. How about in "(emacs) Programs"? >> > >> > Yes, a section under "Programs" sounds good. >> > >> > Thanks. >> >> Please find attached a revised patch for consideration. Any feedback on >> style and conventions welcome. >> >> Text is adapted from the macrostep package - I believe Jonathan's FSF >> paperwork is still outstanding but is expected soon. > > Thanks, but it looks like you attached the wrong patch? It seems like > it's the same patch you sent the first time, not a revised one after > all the comments above, where we agreed to have this in the Emacs user > manual instead. Absolutely, sorry, attached is the revised patch I have worked on. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Add-Macrostep-section-in-manual.patch >From 0ed5971e7a54abe299386ce53e681b16cdb135c5 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..d4d0a753576 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 Lisp macro-expander. +@end ifnottex Top-Level Definitions, or Defuns diff --git a/doc/emacs/programs.texi b/doc/emacs/programs.texi index de28a9f1dd4..15cfffc289b 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 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 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 +over a macro. + +@kbd{macrostep} 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 +@item e +@itemx = +@itemx RET +@findex macrostep-expand +Expand the macro form following point one step (@code{macrostep-expand}). +@item c +@itemx u +@itemx DEL +@findex macrostep-collapse +Collapse the form following point (@code{macrostep-collapse}). +@item n +@itemx TAB +@findex macrostep-next-macro +Jump to the next macro form in the expansion (@code{macrostep-next-macro}). +@item p +@itemx M-TAB +@findex macrostep-previous-macro +Jump to the previous macro form in the expansion (@code{macrostep-previous-macro}). +@item q +@itemx C-c C-c +@findex macrostep-collapse-all +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 --=-=-=--