unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Matt Armstrong <matt@rfc20.org>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: "Basil L. Contovounesios" <contovob@tcd.ie>,
	46364@debbugs.gnu.org,
	"Bruno Félix Rezende Ribeiro" <oitofelix@gnu.org>
Subject: bug#46364: regression in lm-commentary
Date: Mon, 08 Feb 2021 10:59:28 -0800	[thread overview]
Message-ID: <m2k0ril71r.fsf@matts-mbp-2016.lan> (raw)
In-Reply-To: <87wnvjm5ad.fsf@gnus.org> (Lars Ingebrigtsen's message of "Mon, 08 Feb 2021 07:39:54 +0100")

[-- Attachment #1: Type: text/plain, Size: 697 bytes --]

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Matt Armstrong <matt@rfc20.org> writes:

[...]

>> 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.
>
> Is the removal of the leading white-space the only problem with the
> sanitization?  Then perhaps that bit could be tweaked?

I noticed that Basil's commit 963a9ffd66cb29f0370e9a4b854dddda242c54a6
consolidated normalization logic but also changed the regex slightly
such that all leading whitespace was erased. I've attached a patch to go
back to the old ways. It seems to work.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: preserve leading whitespace --]
[-- Type: text/x-patch, Size: 1045 bytes --]

From eecfa79644edbda5830f77664379a0df59b76929 Mon Sep 17 00:00:00 2001
From: Matt Armstrong <matt@rfc20.org>
Date: Mon, 8 Feb 2021 10:44:34 -0800
Subject: [PATCH] Preserve leading whitespace in `lm-commentary'.

* lisp/emacs-lisp/lisp-mnt.el (lm-commentary): Preserve leading
whitespace. (Bug#46364)
---
 lisp/emacs-lisp/lisp-mnt.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/lisp-mnt.el b/lisp/emacs-lisp/lisp-mnt.el
index adb9cb2372..6d9c8c3279 100644
--- a/lisp/emacs-lisp/lisp-mnt.el
+++ b/lisp/emacs-lisp/lisp-mnt.el
@@ -495,7 +495,7 @@ lm-commentary
                   (concat "^;;;[[:blank:]]*\\("
                           lm-commentary-header
                           "\\):[[:blank:]\n]*")
-                  "^;;[[:blank:]]*"     ; double semicolon prefix
+                  "^;;[[:blank:]]?"     ; double semicolon prefix
                   "[[:blank:]\n]*\\'")  ; trailing new-lines
           "" (buffer-substring-no-properties
               start (lm-commentary-end))))))))
-- 
2.30.0


  reply	other threads:[~2021-02-08 18:59 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
2021-02-08  6:39       ` Lars Ingebrigtsen
2021-02-08 18:59         ` Matt Armstrong [this message]
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=m2k0ril71r.fsf@matts-mbp-2016.lan \
    --to=matt@rfc20.org \
    --cc=46364@debbugs.gnu.org \
    --cc=contovob@tcd.ie \
    --cc=larsi@gnus.org \
    --cc=oitofelix@gnu.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).