GNU bug report logs - #6822
comment-padding skips first char in html-mode

Previous Next

Package: emacs;

Reported by: Lennart Borgman <lennart.borgman <at> gmail.com>

Date: Sun, 8 Aug 2010 17:10:03 UTC

Severity: normal

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 6822 in the body.
You can then email your comments to 6822 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6822; Package emacs. (Sun, 08 Aug 2010 17:10:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Lennart Borgman <lennart.borgman <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 08 Aug 2010 17:10:04 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Lennart Borgman <lennart.borgman <at> gmail.com>
To: Emacs Bugs <bug-gnu-emacs <at> gnu.org>
Subject: comment-padding skips first char in html-mode
Date: Sat, 7 Aug 2010 23:35:14 +0200
(setq comment-padding "xy")

gives

<!-- yy --> - html-mode


Trunk 2010-08-04.




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6822; Package emacs. (Sun, 08 Aug 2010 23:37:01 GMT) Full text and rfc822 format available.

Message #8 received at 6822 <at> debbugs.gnu.org (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Stefan Monnier  <monnier <at> iro.umontreal.ca>
Cc: 6822 <at> debbugs.gnu.org, Lennart Borgman <lennart.borgman <at> gmail.com>
Subject: Re: bug#6822: comment-padding skips first char in html-mode
Date: Sun, 08 Aug 2010 19:37:07 -0400
Lennart Borgman <lennart.borgman <at> gmail.com> writes:

> (setq comment-padding "xy")
>
> gives
>
> <!-- yy --> - html-mode

This is because of this behavior in comment-padright and
comment-padleft:

  If STR already contains padding, the corresponding amount is
  ignored from `comment-padding'.

I'm not sure what the reason is.  Stefan?




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6822; Package emacs. (Mon, 09 Aug 2010 15:30:05 GMT) Full text and rfc822 format available.

Message #11 received at 6822 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Chong Yidong <cyd <at> stupidchicken.com>
Cc: 6822 <at> debbugs.gnu.org, Lennart Borgman <lennart.borgman <at> gmail.com>
Subject: Re: bug#6822: comment-padding skips first char in html-mode
Date: Mon, 09 Aug 2010 10:35:06 +0200
>> (setq comment-padding "xy")
>> gives
>> <!-- yy --> - html-mode

> This is because of this behavior in comment-padright and
> comment-padleft:

>   If STR already contains padding, the corresponding amount is
>   ignored from `comment-padding'.

> I'm not sure what the reason is.  Stefan?

IIRC the issue is that comment-padding interacts with comment-start and
comment-end in otherwise unexpected ways.  E.g. often "comment-start"
includes a trailing space, since this string is used as-is when you
insert a comment via comment-indent.  But if you set comment-padding to
2, you usually don't want the resulting spacing to be 3 spaces when
you do comment-region.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#6822; Package emacs. (Sun, 18 Jul 2021 12:52:02 GMT) Full text and rfc822 format available.

Message #14 received at 6822 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Lennart Borgman <lennart.borgman <at> gmail.com>
Cc: 6822 <at> debbugs.gnu.org
Subject: Re: bug#6822: comment-padding skips first char in html-mode
Date: Sun, 18 Jul 2021 14:51:30 +0200
Lennart Borgman <lennart.borgman <at> gmail.com> writes:

> (setq comment-padding "xy")
>
> gives
>
> <!-- yy --> - html-mode

This should now be fixed in Emacs 28.  I think the current logic of
shortening the padding when it's spaces is fine -- we're a bit sloppy
when defining comments, so they're "<!-- " in html-mode, and the padding
is " ", but we don't want extra padding in that case, so
comment-padright/left shortens it.

But if the padding isn't spaces, then it shouldn't do the shortening, so
I've made that exact change.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug marked as fixed in version 28.1, send any further explanations to 6822 <at> debbugs.gnu.org and Lennart Borgman <lennart.borgman <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 18 Jul 2021 12:52:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 16 Aug 2021 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 303 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.