Subject: bug#17801: 24.3.91; Regression: Texinfo Mode inserts newline after markup

From: Stefan Monnier <[email-masked]>
Date: Fri, 20 Jun 2014 09:19:59 -0400

>> Indeed, that's why I haven't made such a change.
> Should we make such a change on the trunk at this time?

We could try, yes.  I bumped into this problem many years ago and didn't
dare to make such a change back then (instead, I added the
skeleton-end-newline variable, so that at least you can get rid of these
newlines without having to remove a lambda expression from a hook).

> Btw, while working on this, I bumped into some strange feature: the
> last \n element in a skeleton is only obeyed when it would be inserted
> not at end of line.  This is explicitly coded in skeleton.el:

>        ;; \n as last element only inserts \n if not at eol.
>        ((and (null (cdr skeleton-il)) (not recursive) (eolp))

Right, this is specifically so you can write skeletons which do the same
regardless of skeleton-end-newline.  I.e. so that after changing the
default of skeleton-end-newline, you can tell people they can fix their
skeletons by simply adding a final \n rather than having to test Emacs
version or the value of skeleton-end-newline.

> For this reason, if a skeleton wants to always insert a newline at the
> end, it quite embarrassingly must end with 2 \n elements, and risk
> inserting an extra newline in some cases.

Right, but this need is very rare in my experience.  You can always use
some other element, like "\n" instead.

        Stefan