diff options
| -rw-r--r-- | lisp/textmodes/texinfo.el | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/lisp/textmodes/texinfo.el b/lisp/textmodes/texinfo.el index 5067b629ee9..dbdd532a1d9 100644 --- a/lisp/textmodes/texinfo.el +++ b/lisp/textmodes/texinfo.el | |||
| @@ -399,15 +399,11 @@ value of texinfo-mode-hook." | |||
| 399 | (defconst texinfo-environment-regexp | 399 | (defconst texinfo-environment-regexp |
| 400 | "^@\\(f?table\\|enumerate\\|itemize\\|ifinfo\\|iftex\\|ifset\\|ifclear\ | 400 | "^@\\(f?table\\|enumerate\\|itemize\\|ifinfo\\|iftex\\|ifset\\|ifclear\ |
| 401 | \\|example\\|quotation\\|lisp\\|smallexample\\|smalllisp\\|display\\|format\ | 401 | \\|example\\|quotation\\|lisp\\|smallexample\\|smalllisp\\|display\\|format\ |
| 402 | \\|flushleft\\|flushright\\|ignore\\|group\\|tex\\|cartouche\\|end\ | 402 | \\|flushleft\\|flushright\\|ignore\\|group\\|tex\\|cartouche\\|menu\ |
| 403 | \\|def[a-z]*\\)" | 403 | \\|titlepage\\|end\\|def[a-z]*[a-wyz]\\>\\)" |
| 404 | "Regexp for environment-like Texinfo list commands. | 404 | "Regexp for environment-like Texinfo list commands. |
| 405 | Subexpression 1 is what goes into the corresponding `@end' statement.") | 405 | Subexpression 1 is what goes into the corresponding `@end' statement.") |
| 406 | 406 | ||
| 407 | ;; The following texinfo-insert-@end command not only inserts a SPC | ||
| 408 | ;; after the @end, but tries to find out what belongs there. It is | ||
| 409 | ;; not very smart: it does not understand nested lists. | ||
| 410 | |||
| 411 | (defun texinfo-insert-@end () | 407 | (defun texinfo-insert-@end () |
| 412 | "Insert the matching `@end' for the last Texinfo command that needs one." | 408 | "Insert the matching `@end' for the last Texinfo command that needs one." |
| 413 | (interactive) | 409 | (interactive) |
| @@ -419,9 +415,10 @@ Subexpression 1 is what goes into the corresponding `@end' statement.") | |||
| 419 | (setq depth (1+ depth)) | 415 | (setq depth (1+ depth)) |
| 420 | (setq depth (1- depth))))) | 416 | (setq depth (1- depth))))) |
| 421 | (looking-at texinfo-environment-regexp) | 417 | (looking-at texinfo-environment-regexp) |
| 422 | (setq string | 418 | (if (zerop depth) |
| 423 | (buffer-substring (match-beginning 1) | 419 | (setq string |
| 424 | (match-end 1)))) | 420 | (buffer-substring (match-beginning 1) |
| 421 | (match-end 1))))) | ||
| 425 | (insert "@end ") | 422 | (insert "@end ") |
| 426 | (if string (insert string "\n")))) | 423 | (if string (insert string "\n")))) |
| 427 | 424 | ||