emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Replace trivial pcase occurrences in the Emacs sources


From: Michael Heerdegen
Subject: Re: Replace trivial pcase occurrences in the Emacs sources
Date: Mon, 05 Nov 2018 02:43:56 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Michael Heerdegen <address@hidden> writes:

> > I'm pretty sure the *-loaddefs files are also generated.
>
> Oh, indeed.  But git clean -xf or so should all remove these - right?

Ok, I did that in my repo to exclude the generated files.  I also kept
in mind that some files are distributed via Gnu Elpa and 'SOMETHING may
not be used there as a pcase pattern.

I decided to not perform the 'DOESNT-HAVE-TO-BE-QUOTED replacement:
while browsing the matches, I found that this seems to touch personal
preferences and personal styles in too many cases.  I wouldn't want that
somebody would treat my code in such a way.

The `DOESNT-UNQUOTE thing is a bit different.  It also touches stylistic
reasoning, but OTOH confuses people because when the backquote is
followed by a list than it's not clear that it's actually just a
constant list and not something constructed.  Replacing the backquote
with a quote can improve readability.

OTOH, some people seem to prefer that the body of a macro is always a
backquote expression.  And that, also recursively in unquoted parts that
need to be quoted.  Likewise, there are lots of backquoted :type
defcustom expressions, and lots of backquoted menu specifications.  Of
course, lots were also pcase patterns.

I tried to filter out those very few cases that could not be replaced
with quotes.  Hope I found all.

For now, I attach a patch were I replaced nearly everything where it was
possible.  Comments welcome.  If we are sure which changes we want to
keep, I'll do the final fine-tuning (fixing indentation and comments, if
some were shifted, etc.)

BTW, some files use backquotes very excessively, mainly
lisp/progmodes/verilog-mode.el.  I guess verilog consists mainly of
backquotes?

There were some backquoted function names and lambdas.  I replaced the
backquote with #' (symbols), and most of the time nothing (lambdas in
lexical binding files).  I was very conservative with lambdas in files
that didn't use lexbind.

Finally, the thing I found in lisp/calendar/time-date.el looked like a
bug to me I found by accident.

I'm attaching the patch.


Michael.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]