* How to avoid newline insertion / reindentation by sgml-tag (C-c C-t) in html-mode
@ 2019-01-02 0:18 David Madore
2019-01-02 13:14 ` Stephen Berman
0 siblings, 1 reply; 2+ messages in thread
From: David Madore @ 2019-01-02 0:18 UTC (permalink / raw)
To: help-gnu-emacs
Dear group,
I only recently upgraded from Emacs 24.5 to 25.1. One of the changes
which is causing me considerable pain is that the html-mode (which I use
a lot to edit XHTML files) now tries to perform some kind of
reindentation whenever a tag is inserted by the sgml-tag (C-c C-t)
function. In particular, a line break appears to be inserted whenever
there is a following closed tag.
I would like no such reindentation to occur. For example, if I type
"C-c C-t em" between <p> and </p> (say), I would just like for "<em>" to
be inserted before the point and "</em>" after, with no changes to
indentation or anything else, and certainly no extra newline character.
I tried understanding sgml-mode.el but it is way beyond my knowledge of
Emacs Lisp; and I don't see in the diff between the 24.5 and 25.1
versions anything pertaining to identation that would explain the
difference. I even tried using the 24.5 version of sgml-mode.el but it
did not revert to the previous behavior (so I assume the difference
comes from somewhere else but I don't even know where to start looking).
Does anybody know how I can revert to the previous behaviour and avoid
the spurious insertion of newlines by the sgml-tag function?
Failing that, can anybody suggest some way to get help on this
particular issue?
Many thanks in advance for any advice,
--
David A. Madore
WWW: http://www.madore.org/~david/
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: How to avoid newline insertion / reindentation by sgml-tag (C-c C-t) in html-mode
2019-01-02 0:18 How to avoid newline insertion / reindentation by sgml-tag (C-c C-t) in html-mode David Madore
@ 2019-01-02 13:14 ` Stephen Berman
0 siblings, 0 replies; 2+ messages in thread
From: Stephen Berman @ 2019-01-02 13:14 UTC (permalink / raw)
To: David Madore; +Cc: help-gnu-emacs
On Wed, 2 Jan 2019 01:18:45 +0100 David Madore <david+news@madore.org> wrote:
> Dear group,
>
> I only recently upgraded from Emacs 24.5 to 25.1. One of the changes which is
> causing me considerable pain is that the html-mode (which I use a lot to edit
> XHTML files) now tries to perform some kind of reindentation whenever a tag is
> inserted by the sgml-tag (C-c C-t) function. In particular, a line break
> appears to be inserted whenever there is a following closed tag.
>
> I would like no such reindentation to occur. For example, if I type "C-c C-t
> em" between <p> and </p> (say), I would just like for "<em>" to be inserted
> before the point and "</em>" after, with no changes to indentation or anything
> else, and certainly no extra newline character.
>
> I tried understanding sgml-mode.el but it is way beyond my knowledge of Emacs
> Lisp; and I don't see in the diff between the 24.5 and 25.1 versions anything
> pertaining to identation that would explain the difference. I even tried
> using the 24.5 version of sgml-mode.el but it did not revert to the previous
> behavior (so I assume the difference comes from somewhere else but I don't
> even know where to start looking).
>
> Does anybody know how I can revert to the previous behaviour and avoid the
> spurious insertion of newlines by the sgml-tag function?
You can suppress the line break by setting skeleton-end-newline to nil.
To have this work for any file in html-mode you should add a
corresponding function to sgml-mode-hook in your init file, e.g.:
(add-hook 'sgml-mode-hook (lambda nil (setq skeleton-end-newline nil)))
You can also do this via `M-x customize RET sgml-mode-hook RET'.
Steve Berman
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-01-02 13:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-02 0:18 How to avoid newline insertion / reindentation by sgml-tag (C-c C-t) in html-mode David Madore
2019-01-02 13:14 ` Stephen Berman
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).