all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Noam Postavsky <npostavs@gmail.com>
To: Akkana Peck <akkana@shallowsky.com>
Cc: 36227@debbugs.gnu.org
Subject: bug#36227: 26.1; sgml-mode indents as comment inside of -- text blocks
Date: Sat, 15 Jun 2019 19:59:29 -0400	[thread overview]
Message-ID: <87sgsaxuvy.fsf@gmail.com> (raw)
In-Reply-To: <20190615180218.GC1232@shallowsky.com> (Akkana Peck's message of "Sat, 15 Jun 2019 12:02:18 -0600")

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	other threads:[~2019-06-15 23:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-15 18:02 bug#36227: 26.1; sgml-mode indents as comment inside of -- text blocks Akkana Peck
2019-06-15 23:59 ` Noam Postavsky [this message]
2021-02-01  9:42   ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sgsaxuvy.fsf@gmail.com \
    --to=npostavs@gmail.com \
    --cc=36227@debbugs.gnu.org \
    --cc=akkana@shallowsky.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.