unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Thuna <thuna.cing@gmail.com>
To: "Mattias Engdegård" <mattias.engdegard@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: Quality of life improvements to macroexp.el
Date: Thu, 18 Jul 2024 15:42:32 +0200	[thread overview]
Message-ID: <87msme6cl3.fsf@gmail.com> (raw)
In-Reply-To: <5421CEBD-571B-4C1C-9B55-F72DC4C89E5A@gmail.com>

Mattias Engdegård <mattias.engdegard@gmail.com> writes:

> Hello Thuna,
>
>> I was just looking into using macroexp.el and found some features that I
>> felt were lacking.  These were: 1. accepting multiple forms in
>> `macroexp-if' and `macroexp-let*', 2. flattening of `progn's in
>> `macroexp-progn' and `macroexp-unprogn', 3. getting rid of branches in
>> `macroexp-if' in case the TEST is constant (and consequently a way to
>> tell whether a constant form is nil or non-nil).  I've went through the
>> rest of macroexp.el and haven't found anything else that stood out,
>> though I might change my mind as I keep using it.
>
> If they aren't in Emacs, it may be because nobody else has felt the need for them.
>
> Perhaps there is a misunderstanding of macros like `macroexp-progn`: their purpose is not to produce 'short' or 'neat' output, but to avoid consing more than necessary during the macro-expansion phase. It's just a (compilation) performance hack, and not a very important one either.

I expect that a non-insignificant number of people use packages such as
macrostep (or plain-old `macroexpand-1') to view expansions of forms
while debugging issues.  To that end I would consider keeping a 'neat'
output a desirable if not significant goal.  Of course, it should not
come at massive costs, so I would consider my sample implementations of
`macroexp-progn' and `macroexp-unprogn' as discardable, given the heavy
recursion.



      parent reply	other threads:[~2024-07-18 13:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-16  1:57 Quality of life improvements to macroexp.el Thuna
2024-07-17 20:38 ` Jeremy Bryant
2024-07-17 20:43   ` Thuna
2024-07-18  0:19   ` Thuna
2024-07-18 13:04   ` Po Lu
2024-07-18 20:40     ` Jeremy Bryant
     [not found]   ` <5421CEBD-571B-4C1C-9B55-F72DC4C89E5A@gmail.com>
2024-07-18 13:42     ` Thuna [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87msme6cl3.fsf@gmail.com \
    --to=thuna.cing@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=mattias.engdegard@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).