diff options
| author | Eli Zaretskii | 2014-06-20 11:47:10 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2014-06-20 11:47:10 +0300 |
| commit | 58b9840b352eeb11ee1d09f0f3224c4b9ce22fad (patch) | |
| tree | 325bf0a08a5f2c216e66e3369bfebf3dc6596506 | |
| parent | 0b20117e9624412004e4309228dcc54756ddfd50 (diff) | |
| download | emacs-58b9840b352eeb11ee1d09f0f3224c4b9ce22fad.tar.gz emacs-58b9840b352eeb11ee1d09f0f3224c4b9ce22fad.zip | |
Fix bug #17801 with extraneous newlines after inserting markup in Texinfo mode.
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.
| -rw-r--r-- | lisp/ChangeLog | 9 | ||||
| -rw-r--r-- | lisp/textmodes/texinfo.el | 15 |
2 files changed, 20 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7fdc6478979..b7cd062d15c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,12 @@ | |||
| 1 | 2014-06-20 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * textmodes/texinfo.el (texinfo-mode): Set skeleton-end-newline | ||
| 4 | locally to nil. | ||
| 5 | (texinfo-insert-block, texinfo-insert-@end) | ||
| 6 | (texinfo-insert-@example, texinfo-insert-@quotation): Adjust to | ||
| 7 | local setting of skeleton-end-newline by adding an explicit \n to | ||
| 8 | the skeletons where appropriate. (Bug#17801) | ||
| 9 | |||
| 1 | 2014-06-20 Stefan Monnier <monnier@iro.umontreal.ca> | 10 | 2014-06-20 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 11 | ||
| 3 | * emacs-lisp/smie.el (smie--hanging-eolp-function): New var. | 12 | * emacs-lisp/smie.el (smie--hanging-eolp-function): New var. |
diff --git a/lisp/textmodes/texinfo.el b/lisp/textmodes/texinfo.el index e1e2656275c..6f441d67b3c 100644 --- a/lisp/textmodes/texinfo.el +++ b/lisp/textmodes/texinfo.el | |||
| @@ -44,6 +44,8 @@ | |||
| 44 | 44 | ||
| 45 | (defvar outline-heading-alist) | 45 | (defvar outline-heading-alist) |
| 46 | 46 | ||
| 47 | (defvar skeleton-end-newline) | ||
| 48 | |||
| 47 | (defgroup texinfo nil | 49 | (defgroup texinfo nil |
| 48 | "Texinfo Mode." | 50 | "Texinfo Mode." |
| 49 | :link '(custom-group-link :tag "Font Lock Faces group" font-lock-faces) | 51 | :link '(custom-group-link :tag "Font Lock Faces group" font-lock-faces) |
| @@ -626,6 +628,11 @@ value of `texinfo-mode-hook'." | |||
| 626 | (setq-local tex-first-line-header-regexp "^\\\\input") | 628 | (setq-local tex-first-line-header-regexp "^\\\\input") |
| 627 | (setq-local tex-trailer "@bye\n") | 629 | (setq-local tex-trailer "@bye\n") |
| 628 | 630 | ||
| 631 | ;; Prevent skeleton.el from adding a newline to each inserted | ||
| 632 | ;; skeleton. Those which do want a newline do that explicitly in | ||
| 633 | ;; their define-skeleton form. | ||
| 634 | (setq-local skeleton-end-newline nil) | ||
| 635 | |||
| 629 | ;; Prevent filling certain lines, in addition to ones specified by | 636 | ;; Prevent filling certain lines, in addition to ones specified by |
| 630 | ;; the user. | 637 | ;; the user. |
| 631 | (setq-local auto-fill-inhibit-regexp | 638 | (setq-local auto-fill-inhibit-regexp |
| @@ -653,7 +660,7 @@ Puts point on a blank line between them." | |||
| 653 | (if (or (string-match "\\`def" str) | 660 | (if (or (string-match "\\`def" str) |
| 654 | (member str '("table" "ftable" "vtable"))) | 661 | (member str '("table" "ftable" "vtable"))) |
| 655 | '(nil " " -)) | 662 | '(nil " " -)) |
| 656 | \n _ \n "@end " str \n) | 663 | \n _ \n "@end " str \n \n) |
| 657 | 664 | ||
| 658 | (defun texinfo-inside-macro-p (macro &optional bound) | 665 | (defun texinfo-inside-macro-p (macro &optional bound) |
| 659 | "Non-nil if inside a macro matching the regexp MACRO." | 666 | "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 \"." | |||
| 732 | (backward-word 1) | 739 | (backward-word 1) |
| 733 | (texinfo-last-unended-begin) | 740 | (texinfo-last-unended-begin) |
| 734 | (or (match-string 1) '-))) | 741 | (or (match-string 1) '-))) |
| 735 | \n "@end " str \n) | 742 | \n "@end " str \n \n) |
| 736 | 743 | ||
| 737 | (define-skeleton texinfo-insert-braces | 744 | (define-skeleton texinfo-insert-braces |
| 738 | "Make a pair of braces and be poised to type inside of them. | 745 | "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." | |||
| 771 | (define-skeleton texinfo-insert-@example | 778 | (define-skeleton texinfo-insert-@example |
| 772 | "Insert the string `@example' in a Texinfo buffer." | 779 | "Insert the string `@example' in a Texinfo buffer." |
| 773 | nil | 780 | nil |
| 774 | \n "@example" \n) | 781 | \n "@example" \n \n) |
| 775 | 782 | ||
| 776 | (define-skeleton texinfo-insert-@file | 783 | (define-skeleton texinfo-insert-@file |
| 777 | "Insert a `@file{...}' command in a Texinfo buffer. | 784 | "Insert a `@file{...}' command in a Texinfo buffer. |
| @@ -816,7 +823,7 @@ Leave point after `@node'." | |||
| 816 | 823 | ||
| 817 | (define-skeleton texinfo-insert-@quotation | 824 | (define-skeleton texinfo-insert-@quotation |
| 818 | "Insert the string `@quotation' in a Texinfo buffer." | 825 | "Insert the string `@quotation' in a Texinfo buffer." |
| 819 | \n "@quotation" \n) | 826 | \n "@quotation" \n _ \n) |
| 820 | 827 | ||
| 821 | (define-skeleton texinfo-insert-@samp | 828 | (define-skeleton texinfo-insert-@samp |
| 822 | "Insert a `@samp{...}' command in a Texinfo buffer. | 829 | "Insert a `@samp{...}' command in a Texinfo buffer. |