unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 52864@debbugs.gnu.org, "積丹尼 Dan Jacobson" <jidanni@jidanni.org>
Subject: bug#52864: sgml-tag inserts newlines
Date: Wed, 29 Dec 2021 19:58:50 +0200	[thread overview]
Message-ID: <865yr7z411.fsf@mail.linkov.net> (raw)
In-Reply-To: <87wnjn5suv.fsf@gnus.org> (Lars Ingebrigtsen's message of "Wed, 29 Dec 2021 16:32:56 +0100")

>>   (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	other threads:[~2021-12-29 17:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-29  2:06 bug#52864: sgml-tag inserts newlines 積丹尼 Dan Jacobson
2021-12-29  8:38 ` Juri Linkov
2021-12-29  8:53   ` Juri Linkov
2021-12-29 15:32     ` Lars Ingebrigtsen
2021-12-29 17:58       ` Juri Linkov [this message]
2021-12-29 18:06         ` Lars Ingebrigtsen
2021-12-29 18:52           ` Juri Linkov

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=865yr7z411.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=52864@debbugs.gnu.org \
    --cc=jidanni@jidanni.org \
    --cc=larsi@gnus.org \
    /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 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).