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

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

bug#52864: sgml-tag inserts newlines


From: Juri Linkov
Subject: bug#52864: sgml-tag inserts newlines
Date: Wed, 29 Dec 2021 19:58:50 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu)

>>   (defcustom sgml-tag-end-newline skeleton-end-newline
>
> Doesn't it depend on what tag you're inserting whether it's likely you
> want to have a newline at the end, though?  The more "block"-like tags
> would normally be preferably have a newline at the end, while others
> don't.

All necessary newlines are explicitly defined in skeletons,
e.g. a block-like div:

  (define-skeleton html-div
    "HTML div tag."
    nil
    "<div>" > \n _ \n "</div>" >)

where ‘>’ at the end inserts a newline too and indents.

But non-block tags are defined without newlines, e.g.:

  (define-skeleton html-span
    "HTML span tag."
    nil
    "<span>" > _ "</span>")

and skeleton-end-newline inserts an unrequested newline.

> On the other hand, if you're inserting a tag in the middle of the line,
> you probably don't want to insert a newline, I think?  So perhaps just
> adding that defcustom is the right option...

Given the examples above, I don't know what the default value should it have,
maybe nil?  For example, 'texinfo-mode' does this:

  ;; Prevent skeleton.el from adding a newline to each inserted
  ;; skeleton.  Those which do want a newline do that explicitly in
  ;; their define-skeleton form.
  (setq-local skeleton-end-newline nil)





reply via email to

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