unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#6822: comment-padding skips first char in html-mode
@ 2010-08-07 21:35 Lennart Borgman
  2010-08-08 23:37 ` Chong Yidong
  2021-07-18 12:51 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 4+ messages in thread
From: Lennart Borgman @ 2010-08-07 21:35 UTC (permalink / raw)
  To: 6822

(setq comment-padding "xy")

gives

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


Trunk 2010-08-04.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#6822: comment-padding skips first char in html-mode
  2010-08-07 21:35 bug#6822: comment-padding skips first char in html-mode Lennart Borgman
@ 2010-08-08 23:37 ` Chong Yidong
  2010-08-09  8:35   ` Stefan Monnier
  2021-07-18 12:51 ` Lars Ingebrigtsen
  1 sibling, 1 reply; 4+ messages in thread
From: Chong Yidong @ 2010-08-08 23:37 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 6822

Lennart Borgman <lennart.borgman@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?





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#6822: comment-padding skips first char in html-mode
  2010-08-08 23:37 ` Chong Yidong
@ 2010-08-09  8:35   ` Stefan Monnier
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2010-08-09  8:35 UTC (permalink / raw)
  To: Chong Yidong; +Cc: 6822

>> (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





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#6822: comment-padding skips first char in html-mode
  2010-08-07 21:35 bug#6822: comment-padding skips first char in html-mode Lennart Borgman
  2010-08-08 23:37 ` Chong Yidong
@ 2021-07-18 12:51 ` Lars Ingebrigtsen
  1 sibling, 0 replies; 4+ messages in thread
From: Lars Ingebrigtsen @ 2021-07-18 12:51 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: 6822

Lennart Borgman <lennart.borgman@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





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-07-18 12:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-07 21:35 bug#6822: comment-padding skips first char in html-mode Lennart Borgman
2010-08-08 23:37 ` Chong Yidong
2010-08-09  8:35   ` Stefan Monnier
2021-07-18 12:51 ` Lars Ingebrigtsen

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).