]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix bug #17801 with extraneous newlines after inserting markup in Texinfo mode.
authorEli Zaretskii <eliz@gnu.org>
Fri, 20 Jun 2014 08:47:10 +0000 (11:47 +0300)
committerEli Zaretskii <eliz@gnu.org>
Fri, 20 Jun 2014 08:47:10 +0000 (11:47 +0300)
 lisp/textmodes/texinfo.el (texinfo-mode): Set skeleton-end-newline
 locally to nil.
 (texinfo-insert-block, texinfo-insert-@end)
 (texinfo-insert-@example, texinfo-insert-@quotation): Adjust to
 local setting of skeleton-end-newline by adding an explicit \n to
 the skeletons where appropriate.

lisp/ChangeLog
lisp/textmodes/texinfo.el

index 7fdc6478979f8c3a69c6e4bb6377b857afff3b77..b7cd062d15c350531c52dd18bac996bb36108612 100644 (file)
@@ -1,3 +1,12 @@
+2014-06-20  Eli Zaretskii  <eliz@gnu.org>
+
+       * textmodes/texinfo.el (texinfo-mode): Set skeleton-end-newline
+       locally to nil.
+       (texinfo-insert-block, texinfo-insert-@end)
+       (texinfo-insert-@example, texinfo-insert-@quotation): Adjust to
+       local setting of skeleton-end-newline by adding an explicit \n to
+       the skeletons where appropriate.  (Bug#17801)
+
 2014-06-20  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * emacs-lisp/smie.el (smie--hanging-eolp-function): New var.
index e1e2656275ceca32f97f5ab443398bc3e7b710b1..6f441d67b3c72f41887dceadad278b2bfe218901 100644 (file)
@@ -44,6 +44,8 @@
 
 (defvar outline-heading-alist)
 
+(defvar skeleton-end-newline)
+
 (defgroup texinfo nil
   "Texinfo Mode."
   :link '(custom-group-link :tag "Font Lock Faces group" font-lock-faces)
@@ -626,6 +628,11 @@ value of `texinfo-mode-hook'."
   (setq-local tex-first-line-header-regexp "^\\\\input")
   (setq-local tex-trailer "@bye\n")
 
+  ;; 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)
+
   ;; Prevent filling certain lines, in addition to ones specified by
   ;; the user.
   (setq-local auto-fill-inhibit-regexp
@@ -653,7 +660,7 @@ Puts point on a blank line between them."
   (if (or (string-match "\\`def" str)
           (member str '("table" "ftable" "vtable")))
       '(nil " " -))
-  \n _ \n "@end " str \n)
+  \n _ \n "@end " str \n \n)
 
 (defun texinfo-inside-macro-p (macro &optional bound)
   "Non-nil if inside a macro matching the regexp MACRO."
@@ -732,7 +739,7 @@ With prefix argument or inside @code or @example, inserts a plain \"."
       (backward-word 1)
             (texinfo-last-unended-begin)
       (or (match-string 1) '-)))
-  \n "@end " str \n)
+  \n "@end " str \n \n)
 
 (define-skeleton texinfo-insert-braces
   "Make a pair of braces and be poised to type inside of them.
@@ -771,7 +778,7 @@ The default is not to surround any existing words with the braces."
 (define-skeleton texinfo-insert-@example
   "Insert the string `@example' in a Texinfo buffer."
   nil
-  \n "@example" \n)
+  \n "@example" \n \n)
 
 (define-skeleton texinfo-insert-@file
   "Insert a `@file{...}' command in a Texinfo buffer.
@@ -816,7 +823,7 @@ Leave point after `@node'."
 
 (define-skeleton texinfo-insert-@quotation
   "Insert the string `@quotation' in a Texinfo buffer."
-  \n "@quotation" \n)
+  \n "@quotation" \n _ \n)
 
 (define-skeleton texinfo-insert-@samp
   "Insert a `@samp{...}' command in a Texinfo buffer.