Subject: Re: bug#17801: 24.3.91; Regression: Texinfo Mode inserts newline after markup
From: Eli Zaretskii <[email-masked]>
To: Stefan Monnier <[email-masked]>
Cc: [email-masked]
Date: Fri, 20 Jun 2014 11:54:58 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

> From: Stefan Monnier <[email-masked]>
> Cc: [email-masked]
> Date: Thu, 19 Jun 2014 11:44:22 -0400
> 
> >> Indeed, there isn't any.  But really skeleton shouldn't insert a newline
> >> by default (since it offers no way for individual skeletons to override
> >> it).  Instead, each skeleton that needs it should end with a \n.
> > But this will probably cause massive breakage in users of skeleton.
> 
> Indeed, that's why I haven't made such a change.

Should we make such a change on the trunk at this time?

> > For the branch, is it OK to make skeleton-end-newline buffer-local in
> > Texinfo buffers, and then give it a nil value?
> 
> Yes.

Done as r117265 on the emacs-24 branch.

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))

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.

Is this a feature or a bug?  If a feature, does the code assume that
skeleton-end-newline is non-nil?  That is, should the condition
above also test skeleton-end-newline?