GNU bug report logs -
#36227
26.1; sgml-mode indents as comment inside of -- text blocks
Previous Next
Reported by: Akkana Peck <akkana <at> shallowsky.com>
Date: Sat, 15 Jun 2019 18:03:01 UTC
Severity: minor
Tags: confirmed, fixed
Found in version 26.1
Fixed in version 28.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #8 received at 36227 <at> debbugs.gnu.org (full text, mbox):
severity 36227 minor
tags 36227 + confirmed
quit
Akkana Peck <akkana <at> 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).
This bug report was last modified 4 years and 170 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.