unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Matt Armstrong <matt@rfc20.org>
To: "Basil L. Contovounesios" <contovob@tcd.ie>
Cc: 46364@debbugs.gnu.org, Lars Ingebrigtsen <larsi@gnus.org>
Subject: bug#46364: regression in lm-commentary
Date: Sun, 07 Feb 2021 16:19:14 -0800	[thread overview]
Message-ID: <m2h7mnmmwt.fsf@matts-mbp-2016.lan> (raw)
In-Reply-To: <878s7z1urq.fsf@tcd.ie> (Basil L. Contovounesios's message of "Sun, 07 Feb 2021 20:35:05 +0000")

"Basil L. Contovounesios" <contovob@tcd.ie> writes:

> I attach the file in question, diredc.el.  Here's the recipe:
>
> 0. emacs -Q
> 1. (require 'lisp-mnt) C-j
> 2. (lm-commentary "/path/to/diredc.el") C-j
>
> In Emacs 27, the resulting string includes leading semicolons and
> indentation.  In Emacs 28, it doesn't.  Version info follows my
> signature.

Thanks Basil. I investigated this too and filed a new bug with the
information below (because I don't know debbugs well). My investigation
belongs here instead.

Lars asked about MELPA. Answer: MELPA is relevant only because in some
cases MELPA code calls `lm-commentary' to form user-facing description
of a package.

The issue is a behavior change in `lm-commentary' that probably deserves
some consideration, because it seems suboptimal in this example. The
behavior change is most likely caused by commit
963a9ffd66cb29f0370e9a4b854dddda242c54a6.

Prior to that commit, and in Emacs 27.1, the function returns the file's
commentary as an verbatim substring of the elisp source, including the
elisp comment characters, commentary headline, etc. E.g. a string like
this (I'll quote the string for email sanity):

> ";;; Commentary:
> ;;
> ;; This package extends and configures `dired' with features found in
> ;; almost all 'file managers', and also some unique features:
> ;;
> ;;   * Resilient dedicated dual-pane frame.
> ;;     * similar look to 'midnight commander'.
> ;;     * intelligent recovery of manually altered frame configuration
> ;;     * exit diredc/dired cleanly and totally
[...]

After that commit, the function returns a "sanitized" version of the
same content, such as:

> "
> This package extends and configures `dired' with features found in
> almost all 'file managers', and also some unique features:
> 
> * Resilient dedicated dual-pane frame.
> * similar look to 'midnight commander'.
> * intelligent recovery of manually altered frame configuration
> * exit diredc/dired cleanly and totally
[...]

It seems `lm-commentary' now strips all leading whitespace from every
line, as a "sanitization" step, and this has the unsatisfying side
effect of ruining any indentation formatting in the original commentary.

We need not go farther than Emacs' own lisp/align.el to see a similar
problem.

In Emacs 27, (lm-commentary "align.el") returns:

> ";;; Commentary:
> 
> ;; This mode allows you to align regions in a context-sensitive fashion.
> ;; The classic use is to align assignments:
> ;;
> ;;    int a = 1;
> ;;    short foo = 2;
> ;;    double blah = 4;
> ;;
> ;; becomes
> ;;
> ;;    int    a    = 1;
> ;;    short  foo  = 2;
> ;;    double blah = 4;
> 
> "

And in Emacs 28 (mainline):

> "This mode allows you to align regions in a context-sensitive fashion.
> The classic use is to align assignments:
> 
> int a = 1;
> short foo = 2;
> double blah = 4;
> 
> becomes
> 
> int    a    = 1;
> short  foo  = 2;
> double blah = 4;"

Perhaps this should be re-thought?





  reply	other threads:[~2021-02-08  0:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-07 14:01 bug#46364: regression in lm-commentary Boruch Baum
2021-02-07 18:38 ` Lars Ingebrigtsen
2021-02-07 18:55   ` Boruch Baum
2021-02-07 20:35   ` Basil L. Contovounesios
2021-02-08  0:19     ` Matt Armstrong [this message]
2021-02-08  6:39       ` Lars Ingebrigtsen
2021-02-08 18:59         ` Matt Armstrong
2021-02-08 20:51           ` Basil L. Contovounesios
2021-02-09  0:11             ` Matt Armstrong
2021-02-09  8:11           ` Lars Ingebrigtsen

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=m2h7mnmmwt.fsf@matts-mbp-2016.lan \
    --to=matt@rfc20.org \
    --cc=46364@debbugs.gnu.org \
    --cc=contovob@tcd.ie \
    --cc=larsi@gnus.org \
    /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).