bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#46364: regression in lm-commentary


From: Matt Armstrong
Subject: bug#46364: regression in lm-commentary
Date: Mon, 08 Feb 2021 10:59:28 -0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (darwin)

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.

>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 via email to

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