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

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

bug#36227: 26.1; sgml-mode indents as comment inside of -- text blocks


From: Noam Postavsky
Subject: bug#36227: 26.1; sgml-mode indents as comment inside of -- text blocks
Date: Sat, 15 Jun 2019 19:59:29 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux)

severity 36227 minor
tags 36227 + confirmed
quit

Akkana Peck <akkana@shallowsky.com> writes:

> In emacs -Q, edit a file in html-mode (derived from sgml-mode),
> e.g. visit /tmp/foo.html.
>
> M-x auto-fill-mode <RET>
>
> Type some nonsense words with ' -- ' in the middle, like this:
>
> asd shdf ladshjkl sjdk -- asdfh jklsdfh
>
> and keep typing until it wraps.
>
> sgml-mode will wrap adding unwanted extra dashes and indentations,
> like this:
>
> asd shdf ladshjkl sjdk -- asdfh jklsdfh jasdklf hjsdkl hjsdaklf sdf --
>                      -- jkldsfhj kalshfjkasdlfh jaksd

> The problematic behavior seems to come from comment-line-break-function.
> One workaround I've found is to add this in my html-mode and sgml-mode
> hooks to prevent the special processing of line breaks inside comments:
>
>     (kill-local-variable 'comment-line-break-function)
>
> Maybe comment-line-break-function should check sgml-specials and return
> without doing anything if - isn't one of the specials?

It's not to do with the sgml-specials, the problem is that the standard
auto-fill-function, `do-auto-fill', calls `default-indent-new-line'
which calls `comment-line-break-function' regardless of whether point is
inside a comment or not.  As far as I can tell, it works in most modes
because they disable auto-filling outside of comments in the first
place.  sgml-mode doesn't, because most of its non-comment text is just
plain text that should be filled normally.

So I think there should be a sgml-mode specific
comment-line-break-function, which checks whether it's in a comment or
not (presumably using syntax-ppss).





reply via email to

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