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

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

Re: How to avoid newline insertion / reindentation by sgml-tag (C-c C-t)


From: Stephen Berman
Subject: Re: How to avoid newline insertion / reindentation by sgml-tag (C-c C-t) in html-mode
Date: Wed, 02 Jan 2019 14:14:48 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

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



reply via email to

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