From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eshel Yaron Newsgroups: gmane.emacs.devel Subject: Re: Incorporate package macrostep into Emacs core Date: Fri, 26 Apr 2024 10:15:12 +0200 Message-ID: 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> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25436"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Eli Zaretskii , monnier@iro.umontreal.ca, emacs-devel@gnu.org To: Jeremy Bryant Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Apr 26 10:15:59 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 1s0GkR-0006Of-8t for ged-emacs-devel@m.gmane-mx.org; Fri, 26 Apr 2024 10:15:59 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s0Gjz-0005JE-L6; Fri, 26 Apr 2024 04:15:31 -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 1s0Gjx-0005In-4Y for emacs-devel@gnu.org; Fri, 26 Apr 2024 04:15:30 -0400 Original-Received: from mail.eshelyaron.com ([107.175.124.16] helo=eshelyaron.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s0Gjk-0004aw-Sz; Fri, 26 Apr 2024 04:15:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eshelyaron.com; s=mail; t=1714119314; bh=3VOkYnGGy7tfTyutkX7sPu+JCSMgrwJhwidYHIvwOQQ=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=xJwdZYMz83aELlDIBFN0gLXWp1j7XhYBntwdVywrHypzi+TPGjflZp1HXyI7rtFD9 ll+4lY7X1/SN3sjQlXwwcVjPj4XgxpVQFQQEh+bj6+eXHUjiGQq3SzVyHE9WUEO4jo 6113/0pXVsdwi1ehshbGu02BhxybiswfrLxTfhcRia8M5TXrCfqkymxhgiBq3Xj8Qr 5dZOvllM4NeN/jeZ3lSJVMnz2JwX4r+Hb0rvlkFBn1yz91g79Xgrus5VB6iSC+yrGb zAlM4yNjQdoKCwwDsyp/OZoYIn4t3H8gSaYn99kTDx+jCOnE86o4Cqexh+h+RGXgOG y9e4znX/S7XBA== In-Reply-To: <87ttjpceub.fsf@jeremybryant.net> (Jeremy Bryant's message of "Thu, 25 Apr 2024 22:27:56 +0100") Received-SPF: pass client-ip=107.175.124.16; envelope-from=me@eshelyaron.com; helo=eshelyaron.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no 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:318113 Archived-At: Hello Jeremy, Jeremy Bryant writes: > ...attached is the revised patch I have worked on. A few minor comments: > 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. IIUC, this is specific to Emacs Lisp, right? If so, I suggest writing "Elisp" or "Emacs Lisp" instead of "Lisp" here, for clarity. > +@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. Likewise here. > +@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 > + I'd open with a few more words of motivation, e.g. "Emacs Lisp code that you read and write often makes use of macros (@pxref{Macros,,,elisp})." > +You can use @code{macrostep-mode} to explore Lisp macro definitions, and > +help write new macros... Since macrostep-mode is not intended to be enabled directly, I suggest putting less emphasis on the minor mode and more on the feature itself, so maybe something like "Emacs comes with a feature called @dfn{Macrostep} that helps you explore and write new macros" > ...using @kbd{M-x macrostep-expand} when point is > +over a macro. Here I think that "when point is over a macro" could be made a little more precise. How about "when point is inside a macro form" or something along these lines? > +@kbd{macrostep} is a minor mode for interactively stepping through the > +expansion of macros in Emacs Lisp source code. "Macrostep lets you step through the expansion of macros interactively." > 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. Maybe add a reference to Edebug? > 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 comparison with macroexpand seems a bit like a straw-man argument in favor of Macrostep, what about macroexpand-1? IMO, we can just remove these two sentences. The utility of Macrostep is clear enough as is. > + > +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}). "following point"? ISTM that this command expands the first macro form containing point, no? > +@item c > +@itemx u > +@itemx DEL > +@findex macrostep-collapse > +Collapse the form following point (@code{macrostep-collapse}). Likewise. > +@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. This sentence isn't necessary IMO. > +Instead, bind @code{macrostep-expand} to a key in > +@code{emacs-lisp-mode-map}, for example @kbd{C-c e}. Maybe add example code for how to do that? Or just refer to some relevant part of the manual for defining key bindings. > + > +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 Best regards, Eshel