diff options
| -rw-r--r-- | lisp/textmodes/texinfmt.el | 1391 |
1 files changed, 1173 insertions, 218 deletions
diff --git a/lisp/textmodes/texinfmt.el b/lisp/textmodes/texinfmt.el index 7e6dcd57c25..df897e9b340 100644 --- a/lisp/textmodes/texinfmt.el +++ b/lisp/textmodes/texinfmt.el | |||
| @@ -1,9 +1,10 @@ | |||
| 1 | ;;; texinfmt.el --- format Texinfo files into Info files. | 1 | ;;; texinfmt.el --- format Texinfo files into Info files. |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993 Free Software | 3 | ;; Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, |
| 4 | ;; Foundation, Inc. | 4 | ;; 1994, 1995, 1996, 1997 Free Software Foundation, Inc. |
| 5 | 5 | ||
| 6 | ;; Maintainer: Robert J. Chassell <bug-texinfo@prep.ai.mit.edu> | 6 | ;; Maintainer: Robert J. Chassell <bug-texinfo@prep.ai.mit.edu> |
| 7 | ;; Keywords: maint, tex, docs | ||
| 7 | 8 | ||
| 8 | ;; This file is part of GNU Emacs. | 9 | ;; This file is part of GNU Emacs. |
| 9 | 10 | ||
| @@ -26,7 +27,20 @@ | |||
| 26 | 27 | ||
| 27 | ;;; Emacs lisp functions to convert Texinfo files to Info files. | 28 | ;;; Emacs lisp functions to convert Texinfo files to Info files. |
| 28 | 29 | ||
| 29 | (defvar texinfmt-version "2.32 of 19 November 1993") | 30 | (defvar texinfmt-version "2.37 of 24 May 1997") |
| 31 | |||
| 32 | (defun texinfmt-version (&optional here) | ||
| 33 | "Show the version of texinfmt.el in the minibuffer. | ||
| 34 | If optional argument HERE is non-nil, insert info at point." | ||
| 35 | (interactive "P") | ||
| 36 | (let ((version-string | ||
| 37 | (format "Version of \`texinfmt.el\': %s" texinfmt-version))) | ||
| 38 | (if here | ||
| 39 | (insert version-string) | ||
| 40 | (if (interactive-p) | ||
| 41 | (message "%s" version-string) | ||
| 42 | version-string)))) | ||
| 43 | |||
| 30 | 44 | ||
| 31 | ;;; Variable definitions | 45 | ;;; Variable definitions |
| 32 | 46 | ||
| @@ -85,7 +99,7 @@ | |||
| 85 | (defun texinfo-format-buffer (&optional notagify) | 99 | (defun texinfo-format-buffer (&optional notagify) |
| 86 | "Process the current buffer as texinfo code, into an Info file. | 100 | "Process the current buffer as texinfo code, into an Info file. |
| 87 | The Info file output is generated in a buffer visiting the Info file | 101 | The Info file output is generated in a buffer visiting the Info file |
| 88 | names specified in the @setfilename command. | 102 | name specified in the @setfilename command. |
| 89 | 103 | ||
| 90 | Non-nil argument (prefix, if interactive) means don't make tag table | 104 | Non-nil argument (prefix, if interactive) means don't make tag table |
| 91 | and don't split the file if large. You can use Info-tagify and | 105 | and don't split the file if large. You can use Info-tagify and |
| @@ -283,6 +297,33 @@ converted to Info is stored in a temporary buffer." | |||
| 283 | 297 | ||
| 284 | (message "Done."))) | 298 | (message "Done."))) |
| 285 | 299 | ||
| 300 | ;;;###autoload | ||
| 301 | (defun texi2info (&optional notagify) | ||
| 302 | "Convert the current buffer (written in Texinfo code) into an Info file. | ||
| 303 | The Info file output is generated in a buffer visiting the Info file | ||
| 304 | names specified in the @setfilename command. | ||
| 305 | |||
| 306 | This function automatically updates all node pointers and menus, and | ||
| 307 | creates a master menu. This work is done on a temporary buffer that | ||
| 308 | is automatically removed when the Info file is created. The original | ||
| 309 | Texinfo source buffer is not changed. | ||
| 310 | |||
| 311 | Non-nil argument (prefix, if interactive) means don't make tag table | ||
| 312 | and don't split the file if large. You can use Info-tagify and | ||
| 313 | Info-split to do these manually." | ||
| 314 | (interactive "P") | ||
| 315 | (let ((temp-buffer (concat "*--" (buffer-name) "--temporary-buffer*" ))) | ||
| 316 | (message "First updating nodes and menus, then creating Info file.") | ||
| 317 | ;; (sit-for 2) | ||
| 318 | (copy-to-buffer temp-buffer (point-min) (point-max)) | ||
| 319 | (switch-to-buffer temp-buffer) | ||
| 320 | (texinfo-master-menu t) | ||
| 321 | (message "Now creating Info file.") | ||
| 322 | (sit-for 2) | ||
| 323 | (texinfo-format-buffer notagify) | ||
| 324 | (save-buffer) | ||
| 325 | (kill-buffer temp-buffer))) | ||
| 326 | |||
| 286 | 327 | ||
| 287 | ;;; Primary internal formatting function for the whole buffer. | 328 | ;;; Primary internal formatting function for the whole buffer. |
| 288 | 329 | ||
| @@ -395,12 +436,102 @@ converted to Info is stored in a temporary buffer." | |||
| 395 | 436 | ||
| 396 | ;;; Handle paragraph filling | 437 | ;;; Handle paragraph filling |
| 397 | 438 | ||
| 439 | ;; Keep as concatinated lists for ease of maintenance | ||
| 440 | |||
| 398 | (defvar texinfo-no-refill-regexp | 441 | (defvar texinfo-no-refill-regexp |
| 399 | "^@\\(example\\|smallexample\\|lisp\\|smalllisp\\|display\\|format\\|flushleft\\|flushright\\|menu\\|titlepage\\|iftex\\|ifhtml\\|tex\\|html\\)" | 442 | (concat |
| 443 | "^@" | ||
| 444 | "\\(" | ||
| 445 | "example\\|" | ||
| 446 | "smallexample\\|" | ||
| 447 | "lisp\\|" | ||
| 448 | "smalllisp\\|" | ||
| 449 | "display\\|" | ||
| 450 | "format\\|" | ||
| 451 | "flushleft\\|" | ||
| 452 | "flushright\\|" | ||
| 453 | "menu\\|" | ||
| 454 | "multitable\\|" | ||
| 455 | "titlepage\\|" | ||
| 456 | "iftex\\|" | ||
| 457 | "ifhtml\\|" | ||
| 458 | "tex\\|" | ||
| 459 | "html" | ||
| 460 | "\\)") | ||
| 400 | "Regexp specifying environments in which paragraphs are not filled.") | 461 | "Regexp specifying environments in which paragraphs are not filled.") |
| 401 | 462 | ||
| 463 | (defvar texinfo-accent-commands | ||
| 464 | (concat | ||
| 465 | "@^\\|" | ||
| 466 | "@`\\|" | ||
| 467 | "@'\\|" | ||
| 468 | "@\"\\|" | ||
| 469 | "@,\\|" | ||
| 470 | "@=\\|" | ||
| 471 | "@~\\|" | ||
| 472 | "@OE{\\|" | ||
| 473 | "@oe{\\|" | ||
| 474 | "@AA{\\|" | ||
| 475 | "@aa{\\|" | ||
| 476 | "@AE{\\|" | ||
| 477 | "@ae{\\|" | ||
| 478 | "@ss{\\|" | ||
| 479 | "@questiondown{\\|" | ||
| 480 | "@exclamdown{\\|" | ||
| 481 | "@L{\\|" | ||
| 482 | "@l{\\|" | ||
| 483 | "@O{\\|" | ||
| 484 | "@o{\\|" | ||
| 485 | "@dotaccent{\\|" | ||
| 486 | "@ubaraccent{\\|" | ||
| 487 | "@d{\\|" | ||
| 488 | "@H{\\|" | ||
| 489 | "@ringaccent{\\|" | ||
| 490 | "@tieaccent{\\|" | ||
| 491 | "@u{\\|" | ||
| 492 | "@v{\\|" | ||
| 493 | "@dotless{" | ||
| 494 | )) | ||
| 495 | |||
| 402 | (defvar texinfo-part-of-para-regexp | 496 | (defvar texinfo-part-of-para-regexp |
| 403 | "^@\\(b{\\|bullet{\\|cite{\\|code{\\|emph{\\|equiv{\\|error{\\|expansion{\\|file{\\|i{\\|inforef{\\|kbd{\\|key{\\|lisp{\\|minus{\\|point{\\|print{\\|pxref{\\|r{\\|ref{\\|result{\\|samp{\\|sc{\\|t{\\|TeX{\\|today{\\|var{\\|w{\\|xref{\\)" | 497 | (concat |
| 498 | "^@" | ||
| 499 | "\\(" | ||
| 500 | "b{\\|" | ||
| 501 | "bullet{\\|" | ||
| 502 | "cite{\\|" | ||
| 503 | "code{\\|" | ||
| 504 | "email{\\|" | ||
| 505 | "emph{\\|" | ||
| 506 | "equiv{\\|" | ||
| 507 | "error{\\|" | ||
| 508 | "expansion{\\|" | ||
| 509 | "file{\\|" | ||
| 510 | "i{\\|" | ||
| 511 | "inforef{\\|" | ||
| 512 | "kbd{\\|" | ||
| 513 | "key{\\|" | ||
| 514 | "lisp{\\|" | ||
| 515 | "minus{\\|" | ||
| 516 | "point{\\|" | ||
| 517 | "print{\\|" | ||
| 518 | "pxref{\\|" | ||
| 519 | "r{\\|" | ||
| 520 | "ref{\\|" | ||
| 521 | "result{\\|" | ||
| 522 | "samp{\\|" | ||
| 523 | "sc{\\|" | ||
| 524 | "t{\\|" | ||
| 525 | "TeX{\\|" | ||
| 526 | "today{\\|" | ||
| 527 | "url{\\|" | ||
| 528 | "var{\\|" | ||
| 529 | "w{\\|" | ||
| 530 | "xref{\\|" | ||
| 531 | "@-\\|" ; @- is a descretionary hyphen (not an accent) (a noop). | ||
| 532 | texinfo-accent-commands | ||
| 533 | "\\)" | ||
| 534 | ) | ||
| 404 | "Regexp specifying @-commands found within paragraphs.") | 535 | "Regexp specifying @-commands found within paragraphs.") |
| 405 | 536 | ||
| 406 | (defun texinfo-append-refill () | 537 | (defun texinfo-append-refill () |
| @@ -437,11 +568,17 @@ Do not append @refill to paragraphs containing @w{TEXT} or @*." | |||
| 437 | (buffer-substring (match-beginning 1) (match-end 1)))) | 568 | (buffer-substring (match-beginning 1) (match-end 1)))) |
| 438 | (progn (re-search-forward (concat "^@end " environment) nil t) | 569 | (progn (re-search-forward (concat "^@end " environment) nil t) |
| 439 | (forward-line 1))) | 570 | (forward-line 1))) |
| 440 | ;; 3. Do not refill a paragraph containing @w or @* | 571 | ;; Else |
| 572 | ;; 3. Do not refill a paragraph containing @w or @*, or ending | ||
| 573 | ;; with @<newline> followed by a newline. | ||
| 441 | (if (or | 574 | (if (or |
| 442 | (>= (point) (point-max)) | 575 | (>= (point) (point-max)) |
| 443 | (re-search-forward | 576 | (re-search-forward |
| 444 | "@w{\\|@\\*" (save-excursion (forward-paragraph) (point)) t)) | 577 | "@w{\\|@\\*\\|@\n\n" |
| 578 | (save-excursion | ||
| 579 | (forward-paragraph) | ||
| 580 | (forward-line 1) | ||
| 581 | (point)) t)) | ||
| 445 | ;; Go to end of paragraph and do nothing. | 582 | ;; Go to end of paragraph and do nothing. |
| 446 | (forward-paragraph) | 583 | (forward-paragraph) |
| 447 | ;; 4. Else go to end of paragraph and insert @refill | 584 | ;; 4. Else go to end of paragraph and insert @refill |
| @@ -585,6 +722,7 @@ commands." | |||
| 585 | (defvar texinfo-raisesections-alist | 722 | (defvar texinfo-raisesections-alist |
| 586 | '((@chapter . @chapter) ; Cannot go higher | 723 | '((@chapter . @chapter) ; Cannot go higher |
| 587 | (@unnumbered . @unnumbered) | 724 | (@unnumbered . @unnumbered) |
| 725 | (@centerchap . @unnumbered) | ||
| 588 | 726 | ||
| 589 | (@majorheading . @majorheading) | 727 | (@majorheading . @majorheading) |
| 590 | (@chapheading . @chapheading) | 728 | (@chapheading . @chapheading) |
| @@ -613,6 +751,7 @@ higher types.") | |||
| 613 | (defvar texinfo-lowersections-alist | 751 | (defvar texinfo-lowersections-alist |
| 614 | '((@chapter . @section) | 752 | '((@chapter . @section) |
| 615 | (@unnumbered . @unnumberedsec) | 753 | (@unnumbered . @unnumberedsec) |
| 754 | (@centerchap . @unnumberedsec) | ||
| 616 | (@majorheading . @heading) | 755 | (@majorheading . @heading) |
| 617 | (@chapheading . @heading) | 756 | (@chapheading . @heading) |
| 618 | (@appendix . @appendixsec) | 757 | (@appendix . @appendixsec) |
| @@ -646,19 +785,57 @@ lower types.") | |||
| 646 | ;; Scan for @-commands. | 785 | ;; Scan for @-commands. |
| 647 | (goto-char (point-min)) | 786 | (goto-char (point-min)) |
| 648 | (while (search-forward "@" nil t) | 787 | (while (search-forward "@" nil t) |
| 649 | (if (looking-at "[@{}^'` *\"?!]") | 788 | ;; |
| 650 | ;; Handle a few special @-followed-by-one-char commands. | 789 | ;; These are the single-character accent commands: @^ @` @' @" @= @~ |
| 651 | (if (= (following-char) ?*) | 790 | ;; In Info, they are simply quoted and the @ deleted. |
| 652 | (progn | 791 | ;; Other single-character commands: |
| 653 | ;; remove command | 792 | ;; @* forces a line break, |
| 654 | (delete-region (1- (point)) (1+ (point))) | 793 | ;; @- is a discretionary hyphenation point; does nothing in Info. |
| 655 | ;; insert return if not at end of line; | 794 | ;; @<space>, @<tab>, @<newline> each produce a single space, |
| 656 | ;; else line is already broken. | 795 | ;; unless followed by a newline. |
| 657 | (if (not (= (following-char) ?\n)) | 796 | ;; |
| 658 | (insert ?\n))) | 797 | ;; Old version 2.34 expression: (looking-at "[@{}^'` *\"?!]") |
| 659 | ;; The other characters are simply quoted. Delete the @. | 798 | (if (looking-at "[@{}^'`\"=~ \t\n*?!-]") |
| 660 | (delete-char -1) | 799 | ;; @*, causes a line break. |
| 661 | (forward-char 1)) | 800 | (cond |
| 801 | ;; @*, a line break | ||
| 802 | ((= (following-char) ?*) | ||
| 803 | ;; remove command | ||
| 804 | (delete-region (1- (point)) (1+ (point))) | ||
| 805 | ;; insert return if not at end of line; | ||
| 806 | ;; else line is already broken. | ||
| 807 | (if (not (= (following-char) ?\n)) | ||
| 808 | (insert ?\n))) | ||
| 809 | ;; @-, deleted | ||
| 810 | ((= (following-char) ?-) | ||
| 811 | (delete-region (1- (point)) (1+ (point)))) | ||
| 812 | ;; @<space>, @<tab>, @<newline>: produce a single space, | ||
| 813 | ;; unless followed by a newline. | ||
| 814 | ((= (following-char) ? ) | ||
| 815 | (delete-region (1- (point)) (1+ (point))) | ||
| 816 | ;; insert single space if not at end of line; | ||
| 817 | ;; else line is already broken. | ||
| 818 | (if (not (= (following-char) ?\n)) | ||
| 819 | (insert ? ))) | ||
| 820 | ((= (following-char) ?\t) | ||
| 821 | (delete-region (1- (point)) (1+ (point))) | ||
| 822 | ;; insert single space if not at end of line; | ||
| 823 | ;; else line is already broken. | ||
| 824 | (if (not (= (following-char) ?\n)) | ||
| 825 | (insert ? ))) | ||
| 826 | ;; following char is a carriage return | ||
| 827 | ((= (following-char) ? | ||
| 828 | ) | ||
| 829 | ;; remove command | ||
| 830 | (delete-region (1- (point)) (1+ (point))) | ||
| 831 | ;; insert single space if not at end of line; | ||
| 832 | ;; else line is already broken. | ||
| 833 | (if (not (= (following-char) ?\n)) | ||
| 834 | (insert ? ))) | ||
| 835 | ;; Otherwise: the other characters are simply quoted. Delete the @. | ||
| 836 | (t | ||
| 837 | (delete-char -1) | ||
| 838 | (forward-char 1))) | ||
| 662 | ;; @ is followed by a command-word; find the end of the word. | 839 | ;; @ is followed by a command-word; find the end of the word. |
| 663 | (setq texinfo-command-start (1- (point))) | 840 | (setq texinfo-command-start (1- (point))) |
| 664 | (if (= (char-syntax (following-char)) ?w) | 841 | (if (= (char-syntax (following-char)) ?w) |
| @@ -710,6 +887,11 @@ lower types.") | |||
| 710 | ;;; Parsing functions | 887 | ;;; Parsing functions |
| 711 | 888 | ||
| 712 | (defun texinfo-parse-line-arg () | 889 | (defun texinfo-parse-line-arg () |
| 890 | "Return argument of @-command as string. | ||
| 891 | Argument is separated from command either by a space or by a brace. | ||
| 892 | If a space, return rest of line, with beginning and ending white | ||
| 893 | space removed. If a brace, return string between braces. | ||
| 894 | Leave point after argument." | ||
| 713 | (goto-char texinfo-command-end) | 895 | (goto-char texinfo-command-end) |
| 714 | (let ((start (point))) | 896 | (let ((start (point))) |
| 715 | (cond ((looking-at " ") | 897 | (cond ((looking-at " ") |
| @@ -763,6 +945,7 @@ lower types.") | |||
| 763 | (goto-char (point-max)))) | 945 | (goto-char (point-max)))) |
| 764 | 946 | ||
| 765 | (defun texinfo-parse-arg-discard () | 947 | (defun texinfo-parse-arg-discard () |
| 948 | "Delete command and argument; return argument of command." | ||
| 766 | (prog1 (texinfo-parse-line-arg) | 949 | (prog1 (texinfo-parse-line-arg) |
| 767 | (texinfo-discard-command))) | 950 | (texinfo-discard-command))) |
| 768 | 951 | ||
| @@ -892,6 +1075,9 @@ lower types.") | |||
| 892 | (insert "Info file: " | 1075 | (insert "Info file: " |
| 893 | texinfo-format-filename ", -*-Text-*-\n" | 1076 | texinfo-format-filename ", -*-Text-*-\n" |
| 894 | "produced by `texinfo-format-buffer'\n" | 1077 | "produced by `texinfo-format-buffer'\n" |
| 1078 | ;; Date string removed so that regression testing is easier. | ||
| 1079 | ;; "on " | ||
| 1080 | ;; (insert (format-time-string "%e %b %Y")) " " | ||
| 895 | "from file" | 1081 | "from file" |
| 896 | (if (buffer-file-name input-buffer) | 1082 | (if (buffer-file-name input-buffer) |
| 897 | (concat " `" | 1083 | (concat " `" |
| @@ -904,7 +1090,7 @@ lower types.") | |||
| 904 | texinfmt-version | 1090 | texinfmt-version |
| 905 | ".\n\n"))) | 1091 | ".\n\n"))) |
| 906 | 1092 | ||
| 907 | ;;; @node, @menu | 1093 | ;;; @node, @menu, @detailmenu |
| 908 | 1094 | ||
| 909 | (put 'node 'texinfo-format 'texinfo-format-node) | 1095 | (put 'node 'texinfo-format 'texinfo-format-node) |
| 910 | (put 'nwnode 'texinfo-format 'texinfo-format-node) | 1096 | (put 'nwnode 'texinfo-format 'texinfo-format-node) |
| @@ -940,26 +1126,43 @@ lower types.") | |||
| 940 | 1126 | ||
| 941 | (put 'menu 'texinfo-end 'texinfo-discard-command) | 1127 | (put 'menu 'texinfo-end 'texinfo-discard-command) |
| 942 | 1128 | ||
| 1129 | ;; The @detailmenu should be removed eventually. | ||
| 1130 | |||
| 1131 | ;; According to Karl Berry, 31 August 1996: | ||
| 1132 | ;; | ||
| 1133 | ;; You don't like, I don't like it. I agree, it would be better just to | ||
| 1134 | ;; fix the bug [in `makeinfo']. .. At this point, since inserting those | ||
| 1135 | ;; two commands in the Elisp fn is trivial, I don't especially want to | ||
| 1136 | ;; expend more effort... | ||
| 1137 | ;; | ||
| 1138 | ;; I added a couple sentences of documentation to the manual (putting the | ||
| 1139 | ;; blame on makeinfo where it belongs :-(). | ||
| 1140 | |||
| 1141 | (put 'detailmenu 'texinfo-format 'texinfo-discard-line) | ||
| 1142 | (put 'detailmenu 'texinfo-end 'texinfo-discard-command) | ||
| 1143 | |||
| 1144 | ;; (Also see `texnfo-upd.el') | ||
| 1145 | |||
| 943 | 1146 | ||
| 944 | ;;; Cross references | 1147 | ;;; Cross references |
| 945 | 1148 | ||
| 946 | ; @xref {NODE, FNAME, NAME, FILE, DOCUMENT} | 1149 | ;; @xref {NODE, FNAME, NAME, FILE, DOCUMENT} |
| 947 | ; -> *Note FNAME: (FILE)NODE | 1150 | ;; -> *Note FNAME: (FILE)NODE |
| 948 | ; If FILE is missing, | 1151 | ;; If FILE is missing, |
| 949 | ; *Note FNAME: NODE | 1152 | ;; *Note FNAME: NODE |
| 950 | ; If FNAME is empty and NAME is present | 1153 | ;; If FNAME is empty and NAME is present |
| 951 | ; *Note NAME: Node | 1154 | ;; *Note NAME: Node |
| 952 | ; If both NAME and FNAME are missing | 1155 | ;; If both NAME and FNAME are missing |
| 953 | ; *Note NODE:: | 1156 | ;; *Note NODE:: |
| 954 | ; texinfo ignores the DOCUMENT argument. | 1157 | ;; texinfo ignores the DOCUMENT argument. |
| 955 | ; -> See section <xref to NODE> [NAME, else NODE], page <xref to NODE> | 1158 | ;; -> See section <xref to NODE> [NAME, else NODE], page <xref to NODE> |
| 956 | ; If FILE is specified, (FILE)NODE is used for xrefs. | 1159 | ;; If FILE is specified, (FILE)NODE is used for xrefs. |
| 957 | ; If fifth argument DOCUMENT is specified, produces | 1160 | ;; If fifth argument DOCUMENT is specified, produces |
| 958 | ; See section <xref to NODE> [NAME, else NODE], page <xref to NODE> | 1161 | ;; See section <xref to NODE> [NAME, else NODE], page <xref to NODE> |
| 959 | ; of DOCUMENT | 1162 | ;; of DOCUMENT |
| 960 | 1163 | ||
| 961 | ; @ref a reference that does not put `See' or `see' in | 1164 | ;; @ref a reference that does not put `See' or `see' in |
| 962 | ; the hardcopy and is the same as @xref in Info | 1165 | ;; the hardcopy and is the same as @xref in Info |
| 963 | (put 'ref 'texinfo-format 'texinfo-format-xref) | 1166 | (put 'ref 'texinfo-format 'texinfo-format-xref) |
| 964 | 1167 | ||
| 965 | (put 'xref 'texinfo-format 'texinfo-format-xref) | 1168 | (put 'xref 'texinfo-format 'texinfo-format-xref) |
| @@ -983,9 +1186,9 @@ lower types.") | |||
| 983 | (looking-at "::")) | 1186 | (looking-at "::")) |
| 984 | (insert "."))) | 1187 | (insert "."))) |
| 985 | 1188 | ||
| 986 | ;@inforef{NODE, FNAME, FILE} | 1189 | ;; @inforef{NODE, FNAME, FILE} |
| 987 | ;Like @xref{NODE, FNAME,,FILE} in texinfo. | 1190 | ;; Like @xref{NODE, FNAME,,FILE} in texinfo. |
| 988 | ;In Tex, generates "See Info file FILE, node NODE" | 1191 | ;; In Tex, generates "See Info file FILE, node NODE" |
| 989 | (put 'inforef 'texinfo-format 'texinfo-format-inforef) | 1192 | (put 'inforef 'texinfo-format 'texinfo-format-inforef) |
| 990 | (defun texinfo-format-inforef () | 1193 | (defun texinfo-format-inforef () |
| 991 | (let ((args (texinfo-format-parse-args))) | 1194 | (let ((args (texinfo-format-parse-args))) |
| @@ -1006,6 +1209,7 @@ lower types.") | |||
| 1006 | (put 'iunnumbered 'texinfo-format 'texinfo-format-chapter) | 1209 | (put 'iunnumbered 'texinfo-format 'texinfo-format-chapter) |
| 1007 | (put 'top 'texinfo-format 'texinfo-format-chapter) | 1210 | (put 'top 'texinfo-format 'texinfo-format-chapter) |
| 1008 | (put 'unnumbered 'texinfo-format 'texinfo-format-chapter) | 1211 | (put 'unnumbered 'texinfo-format 'texinfo-format-chapter) |
| 1212 | (put 'centerchap 'texinfo-format 'texinfo-format-chapter) | ||
| 1009 | (defun texinfo-format-chapter () | 1213 | (defun texinfo-format-chapter () |
| 1010 | (texinfo-format-chapter-1 ?*)) | 1214 | (texinfo-format-chapter-1 ?*)) |
| 1011 | 1215 | ||
| @@ -1108,29 +1312,29 @@ If used within a line, follow `@br' with braces." | |||
| 1108 | 1312 | ||
| 1109 | ;;; @footnote and @footnotestyle | 1313 | ;;; @footnote and @footnotestyle |
| 1110 | 1314 | ||
| 1111 | ; In Texinfo, footnotes are created with the `@footnote' command. | 1315 | ;; In Texinfo, footnotes are created with the `@footnote' command. |
| 1112 | ; This command is followed immediately by a left brace, then by the text of | 1316 | ;; This command is followed immediately by a left brace, then by the text of |
| 1113 | ; the footnote, and then by a terminating right brace. The | 1317 | ;; the footnote, and then by a terminating right brace. The |
| 1114 | ; template for a footnote is: | 1318 | ;; template for a footnote is: |
| 1115 | ; | 1319 | ;; |
| 1116 | ; @footnote{TEXT} | 1320 | ;; @footnote{TEXT} |
| 1117 | ; | 1321 | ;; |
| 1118 | ; Info has two footnote styles: | 1322 | ;; Info has two footnote styles: |
| 1119 | ; | 1323 | ;; |
| 1120 | ; * In the End of node style, all the footnotes for a single node | 1324 | ;; * In the End of node style, all the footnotes for a single node |
| 1121 | ; are placed at the end of that node. The footnotes are | 1325 | ;; are placed at the end of that node. The footnotes are |
| 1122 | ; separated from the rest of the node by a line of dashes with | 1326 | ;; separated from the rest of the node by a line of dashes with |
| 1123 | ; the word `Footnotes' within it. | 1327 | ;; the word `Footnotes' within it. |
| 1124 | ; | 1328 | ;; |
| 1125 | ; * In the Separate node style, all the footnotes for a single node | 1329 | ;; * In the Separate node style, all the footnotes for a single node |
| 1126 | ; are placed in an automatically constructed node of their own. | 1330 | ;; are placed in an automatically constructed node of their own. |
| 1127 | 1331 | ||
| 1128 | ; Footnote style is specified by the @footnotestyle command, either | 1332 | ;; Footnote style is specified by the @footnotestyle command, either |
| 1129 | ; @footnotestyle separate | 1333 | ;; @footnotestyle separate |
| 1130 | ; or | 1334 | ;; or |
| 1131 | ; @footnotestyle end | 1335 | ;; @footnotestyle end |
| 1132 | ; | 1336 | ;; |
| 1133 | ; The default is separate | 1337 | ;; The default is separate |
| 1134 | 1338 | ||
| 1135 | (defvar texinfo-footnote-style "separate" | 1339 | (defvar texinfo-footnote-style "separate" |
| 1136 | "Footnote style, either separate or end.") | 1340 | "Footnote style, either separate or end.") |
| @@ -1412,7 +1616,7 @@ Used by @refill indenting command to avoid indenting within lists, etc.") | |||
| 1412 | 1616 | ||
| 1413 | ;;; @table | 1617 | ;;; @table |
| 1414 | 1618 | ||
| 1415 | ; The `@table' command produces two-column tables. | 1619 | ;; The `@table' command produces two-column tables. |
| 1416 | 1620 | ||
| 1417 | (put 'table 'texinfo-format 'texinfo-table) | 1621 | (put 'table 'texinfo-format 'texinfo-table) |
| 1418 | (defun texinfo-table () | 1622 | (defun texinfo-table () |
| @@ -1453,9 +1657,9 @@ Used by @refill indenting command to avoid indenting within lists, etc.") | |||
| 1453 | 1657 | ||
| 1454 | ;;; @ftable, @vtable | 1658 | ;;; @ftable, @vtable |
| 1455 | 1659 | ||
| 1456 | ; The `@ftable' and `@vtable' commands are like the `@table' command | 1660 | ;; The `@ftable' and `@vtable' commands are like the `@table' command |
| 1457 | ; but they also insert each entry in the first column of the table | 1661 | ;; but they also insert each entry in the first column of the table |
| 1458 | ; into the function or variable index. | 1662 | ;; into the function or variable index. |
| 1459 | 1663 | ||
| 1460 | ;; Handle the @ftable and @vtable commands: | 1664 | ;; Handle the @ftable and @vtable commands: |
| 1461 | 1665 | ||
| @@ -1504,6 +1708,353 @@ Used by @refill indenting command to avoid indenting within lists, etc.") | |||
| 1504 | (texinfo-do-itemize (nth 1 stacktop)))) | 1708 | (texinfo-do-itemize (nth 1 stacktop)))) |
| 1505 | 1709 | ||
| 1506 | 1710 | ||
| 1711 | ;;; @multitable ... @end multitable | ||
| 1712 | |||
| 1713 | ;; Produce a multi-column table, with as many columns as desired. | ||
| 1714 | ;; | ||
| 1715 | ;; A multi-column table has this template: | ||
| 1716 | ;; | ||
| 1717 | ;; @multitable {A1} {A2} {A3} | ||
| 1718 | ;; @item A1 @tab A2 @tab A3 | ||
| 1719 | ;; @item B1 @tab B2 @tab B3 | ||
| 1720 | ;; @item C1 @tab C2 @tab C3 | ||
| 1721 | ;; @end multitable | ||
| 1722 | ;; | ||
| 1723 | ;; where the width of the text in brackets specifies the width of the | ||
| 1724 | ;; respective column. | ||
| 1725 | ;; | ||
| 1726 | ;; Or else: | ||
| 1727 | ;; | ||
| 1728 | ;; @multitable @columnfractions .25 .3 .45 | ||
| 1729 | ;; @item A1 @tab A2 @tab A3 | ||
| 1730 | ;; @item B1 @tab B2 @tab B3 | ||
| 1731 | ;; @end multitable | ||
| 1732 | ;; | ||
| 1733 | ;; where the fractions specify the width of each column as a percent | ||
| 1734 | ;; of the current width of the text (i.e., of the fill-column). | ||
| 1735 | ;; | ||
| 1736 | ;; Long lines of text are filled within columns. | ||
| 1737 | ;; | ||
| 1738 | ;; Using the Emacs Lisp formatter, texinfmt.el, | ||
| 1739 | ;; the whitespace between columns can be increased by setting | ||
| 1740 | ;; `extra-inter-column-width' to a value greater than 0. By default, | ||
| 1741 | ;; there is at least one blank space between columns. | ||
| 1742 | ;; | ||
| 1743 | ;; The Emacs Lisp formatter, texinfmt.el, ignores the following four | ||
| 1744 | ;; commands that are defined in texinfo.tex for printed output. | ||
| 1745 | ;; | ||
| 1746 | ;; @multitableparskip, | ||
| 1747 | ;; @multitableparindent, | ||
| 1748 | ;; @multitablecolmargin, | ||
| 1749 | ;; @multitablelinespace. | ||
| 1750 | |||
| 1751 | ;; How @multitable works. | ||
| 1752 | ;; ===================== | ||
| 1753 | ;; | ||
| 1754 | ;; `texinfo-multitable' reads the @multitable line and determines from it | ||
| 1755 | ;; how wide each column should be. | ||
| 1756 | ;; | ||
| 1757 | ;; Also, it pushes this information, along with an identifying symbol, | ||
| 1758 | ;; onto the `texinfo-stack'. At the @end multitable command, the stack | ||
| 1759 | ;; is checked for its matching @multitable command, and then popped, or | ||
| 1760 | ;; else an error is signaled. Also, this command pushes the location of | ||
| 1761 | ;; the start of the table onto the stack. | ||
| 1762 | ;; | ||
| 1763 | ;; `texinfo-end-multitable' checks the `texinfo-stack' that the @end | ||
| 1764 | ;; multitable truly is ending a corresponding beginning, and if it is, | ||
| 1765 | ;; pops the stack. | ||
| 1766 | ;; | ||
| 1767 | ;; `texinfo-multitable-widths' is called by `texinfo-multitable'. | ||
| 1768 | ;; The function returns a list of the widths of each column in a | ||
| 1769 | ;; multi-column table, based on the information supplied by the arguments | ||
| 1770 | ;; to the @multitable command (by arguments, I mean the text on the rest | ||
| 1771 | ;; of the @multitable line, not the remainder of the multi-column table | ||
| 1772 | ;; environment). | ||
| 1773 | ;; | ||
| 1774 | ;; `texinfo-multitable-item' formats a row within a multicolumn table. | ||
| 1775 | ;; This command is executed when texinfmt sees @item inside @multitable. | ||
| 1776 | ;; Cells in row are separated by `@tab's. Widths of cells are specified | ||
| 1777 | ;; by the arguments in the @multitable line. Cells are filled. All cells | ||
| 1778 | ;; are made to be the same height by padding their bottoms, as needed, | ||
| 1779 | ;; with blanks. | ||
| 1780 | ;; | ||
| 1781 | ;; `texinfo-multitable-extract-row' is called by `texinfo-multitable-item'. | ||
| 1782 | ;; This function returns the text in a multitable row, as a string. | ||
| 1783 | ;; The start of a row is marked by an @item and the end of row is the | ||
| 1784 | ;; beginning of next @item or beginning of the @end multitable line. | ||
| 1785 | ;; Cells within a row are separated by @tab. | ||
| 1786 | ;; | ||
| 1787 | ;; Note that @tab, the cell separators, are not treated as independent | ||
| 1788 | ;; Texinfo commands. | ||
| 1789 | |||
| 1790 | (defvar extra-inter-column-width 0 | ||
| 1791 | "*Insert NUMBER of additional columns of whitespace between entries of | ||
| 1792 | a multi-column table.") | ||
| 1793 | |||
| 1794 | (defvar multitable-temp-buffer-name "*multitable-temporary-buffer*") | ||
| 1795 | (defvar multitable-temp-rectangle-name "texinfo-multitable-temp-") | ||
| 1796 | |||
| 1797 | ;; These commands are defined in texinfo.tex for printed output. | ||
| 1798 | (put 'multitableparskip 'texinfo-format 'texinfo-discard-line-with-args) | ||
| 1799 | (put 'multitableparindent 'texinfo-format 'texinfo-discard-line-with-args) | ||
| 1800 | (put 'multitablecolmargin 'texinfo-format 'texinfo-discard-line-with-args) | ||
| 1801 | (put 'multitablelinespace 'texinfo-format 'texinfo-discard-line-with-args) | ||
| 1802 | |||
| 1803 | (put 'multitable 'texinfo-format 'texinfo-multitable) | ||
| 1804 | (defun texinfo-multitable () | ||
| 1805 | "Produce multi-column tables. | ||
| 1806 | |||
| 1807 | A multi-column table has this template: | ||
| 1808 | |||
| 1809 | @multitable {A1} {A2} {A3} | ||
| 1810 | @item A1 @tab A2 @tab A3 | ||
| 1811 | @item B1 @tab B2 @tab B3 | ||
| 1812 | @item C1 @tab C2 @tab C3 | ||
| 1813 | @end multitable | ||
| 1814 | |||
| 1815 | where the width of the text in brackets specifies the width of the | ||
| 1816 | respective column. | ||
| 1817 | |||
| 1818 | Or else: | ||
| 1819 | |||
| 1820 | @multitable @columnfractions .25 .3 .45 | ||
| 1821 | @item A1 @tab A2 @tab A3 | ||
| 1822 | @item B1 @tab B2 @tab B3 | ||
| 1823 | @end multitable | ||
| 1824 | |||
| 1825 | where the fractions specify the width of each column as a percent | ||
| 1826 | of the current width of the text (i.e., of the fill-column). | ||
| 1827 | |||
| 1828 | Long lines of text are filled within columns. | ||
| 1829 | |||
| 1830 | Using the Emacs Lisp formatter, texinfmt.el, | ||
| 1831 | the whitespace between columns can be increased by setting | ||
| 1832 | `extra-inter-column-width' to a value greater than 0. By default, | ||
| 1833 | there is at least one blank space between columns. | ||
| 1834 | |||
| 1835 | The Emacs Lisp formatter, texinfmt.el, ignores the following four | ||
| 1836 | commands that are defined in texinfo.tex for printed output. | ||
| 1837 | |||
| 1838 | @multitableparskip, | ||
| 1839 | @multitableparindent, | ||
| 1840 | @multitablecolmargin, | ||
| 1841 | @multitablelinespace." | ||
| 1842 | |||
| 1843 | ;; This function pushes information onto the `texinfo-stack'. | ||
| 1844 | ;; A stack element consists of: | ||
| 1845 | ;; - type-of-command, i.e., multitable | ||
| 1846 | ;; - the information about column widths, and | ||
| 1847 | ;; - the position of texinfo-command-start. | ||
| 1848 | ;; e.g., ('multitable (1 2 3 4) 123) | ||
| 1849 | ;; The command line is then deleted. | ||
| 1850 | (texinfo-push-stack | ||
| 1851 | 'multitable | ||
| 1852 | ;; push width information on stack | ||
| 1853 | (texinfo-multitable-widths)) | ||
| 1854 | (texinfo-discard-line-with-args)) | ||
| 1855 | |||
| 1856 | (put 'multitable 'texinfo-end 'texinfo-end-multitable) | ||
| 1857 | (defun texinfo-end-multitable () | ||
| 1858 | "Discard the @end multitable line and pop the stack of multitable." | ||
| 1859 | (texinfo-discard-command) | ||
| 1860 | (texinfo-pop-stack 'multitable)) | ||
| 1861 | |||
| 1862 | (defun texinfo-multitable-widths () | ||
| 1863 | "Return list of widths of each column in a multi-column table." | ||
| 1864 | (let (texinfo-multitable-width-list) | ||
| 1865 | ;; Fractions format: | ||
| 1866 | ;; @multitable @columnfractions .25 .3 .45 | ||
| 1867 | ;; | ||
| 1868 | ;; Template format: | ||
| 1869 | ;; @multitable {Column 1 template} {Column 2} {Column 3 example} | ||
| 1870 | ;; Place point before first argument | ||
| 1871 | (skip-chars-forward " \t") | ||
| 1872 | (cond | ||
| 1873 | ;; Check for common misspelling | ||
| 1874 | ((looking-at "@columnfraction ") | ||
| 1875 | (error "In @multitable, @columnfractions misspelled")) | ||
| 1876 | ;; Case 1: @columnfractions .25 .3 .45 | ||
| 1877 | ((looking-at "@columnfractions") | ||
| 1878 | (forward-word 1) | ||
| 1879 | (while (not (eolp)) | ||
| 1880 | (setq texinfo-multitable-width-list | ||
| 1881 | (cons | ||
| 1882 | (truncate | ||
| 1883 | (1- | ||
| 1884 | (* fill-column (read (get-buffer (current-buffer)))))) | ||
| 1885 | texinfo-multitable-width-list)))) | ||
| 1886 | ;; | ||
| 1887 | ;; Case 2: {Column 1 template} {Column 2} {Column 3 example} | ||
| 1888 | ((looking-at "{") | ||
| 1889 | (let ((start-of-templates (point))) | ||
| 1890 | (while (not (eolp)) | ||
| 1891 | (skip-chars-forward " \t") | ||
| 1892 | (let* ((start-of-template (1+ (point))) | ||
| 1893 | (end-of-template | ||
| 1894 | ;; forward-sexp works with braces in Texinfo mode | ||
| 1895 | (progn (forward-sexp 1) (1- (point))))) | ||
| 1896 | (setq texinfo-multitable-width-list | ||
| 1897 | (cons (- end-of-template start-of-template) | ||
| 1898 | texinfo-multitable-width-list)) | ||
| 1899 | ;; Remove carriage return from within a template, if any. | ||
| 1900 | ;; This helps those those who want to use more than | ||
| 1901 | ;; one line's worth of words in @multitable line. | ||
| 1902 | (narrow-to-region start-of-template end-of-template) | ||
| 1903 | (goto-char (point-min)) | ||
| 1904 | (while (search-forward " | ||
| 1905 | " nil t) | ||
| 1906 | (delete-char -1)) | ||
| 1907 | (goto-char (point-max)) | ||
| 1908 | (widen) | ||
| 1909 | (forward-char 1))))) | ||
| 1910 | ;; | ||
| 1911 | ;; Case 3: Trouble | ||
| 1912 | (t | ||
| 1913 | (error | ||
| 1914 | "You probably need to specify column widths for @multitable correctly."))) | ||
| 1915 | ;; Check whether columns fit on page. | ||
| 1916 | (let ((desired-columns | ||
| 1917 | (+ | ||
| 1918 | ;; between column spaces | ||
| 1919 | (length texinfo-multitable-width-list) | ||
| 1920 | ;; additional between column spaces, if any | ||
| 1921 | extra-inter-column-width | ||
| 1922 | ;; sum of spaces for each entry | ||
| 1923 | (apply '+ texinfo-multitable-width-list)))) | ||
| 1924 | (if (> desired-columns fill-column) | ||
| 1925 | (error | ||
| 1926 | (format | ||
| 1927 | "Multi-column table width, %d chars, is greater than page width, %d chars." | ||
| 1928 | desired-columns fill-column)))) | ||
| 1929 | texinfo-multitable-width-list)) | ||
| 1930 | |||
| 1931 | ;; @item A1 @tab A2 @tab A3 | ||
| 1932 | (defun texinfo-multitable-extract-row () | ||
| 1933 | "Return multitable row, as a string. | ||
| 1934 | End of row is beginning of next @item or beginning of @end. | ||
| 1935 | Cells within rows are separated by @tab." | ||
| 1936 | (skip-chars-forward " \t") | ||
| 1937 | (let* ((start (point)) | ||
| 1938 | (end (progn | ||
| 1939 | (re-search-forward "@item\\|@end") | ||
| 1940 | (match-beginning 0))) | ||
| 1941 | (row (progn (goto-char end) | ||
| 1942 | (skip-chars-backward " ") | ||
| 1943 | ;; remove whitespace at end of argument | ||
| 1944 | (delete-region (point) end) | ||
| 1945 | (buffer-substring start (point))))) | ||
| 1946 | (delete-region texinfo-command-start end) | ||
| 1947 | row)) | ||
| 1948 | |||
| 1949 | (put 'multitable 'texinfo-item 'texinfo-multitable-item) | ||
| 1950 | (defun texinfo-multitable-item () | ||
| 1951 | "Format a row within a multicolumn table. | ||
| 1952 | Cells in row are separated by @tab. | ||
| 1953 | Widths of cells are specified by the arguments in the @multitable line. | ||
| 1954 | All cells are made to be the same height. | ||
| 1955 | This command is executed when texinfmt sees @item inside @multitable." | ||
| 1956 | (let ((original-buffer (current-buffer)) | ||
| 1957 | (table-widths (reverse (car (cdr (car texinfo-stack))))) | ||
| 1958 | (existing-fill-column fill-column) | ||
| 1959 | start | ||
| 1960 | end | ||
| 1961 | (table-column 0) | ||
| 1962 | (table-entry-height 0) | ||
| 1963 | ;; unformatted row looks like: A1 @tab A2 @tab A3 | ||
| 1964 | ;; extract-row command deletes the source line in the table. | ||
| 1965 | (unformated-row (texinfo-multitable-extract-row))) | ||
| 1966 | ;; Use a temporary buffer | ||
| 1967 | (set-buffer (get-buffer-create multitable-temp-buffer-name)) | ||
| 1968 | (delete-region (point-min) (point-max)) | ||
| 1969 | (insert unformated-row) | ||
| 1970 | (goto-char (point-min)) | ||
| 1971 | ;; 1. Check for correct number of @tab in line. | ||
| 1972 | (let ((tab-number 1)) ; one @tab between two columns | ||
| 1973 | (while (search-forward "@tab" nil t) | ||
| 1974 | (setq tab-number (1+ tab-number))) | ||
| 1975 | (if (/= tab-number (length table-widths)) | ||
| 1976 | (error "Wrong number of @tab's in a @multitable row."))) | ||
| 1977 | (goto-char (point-min)) | ||
| 1978 | ;; 2. Format each cell, and copy to a rectangle | ||
| 1979 | ;; buffer looks like this: A1 @tab A2 @tab A3 | ||
| 1980 | ;; Cell #1: format up to @tab | ||
| 1981 | ;; Cell #2: format up to @tab | ||
| 1982 | ;; Cell #3: format up to eob | ||
| 1983 | (while (not (eobp)) | ||
| 1984 | (setq start (point)) | ||
| 1985 | (setq end (save-excursion | ||
| 1986 | (if (search-forward "@tab" nil 'move) | ||
| 1987 | ;; Delete the @tab command, including the @-sign | ||
| 1988 | (delete-region | ||
| 1989 | (point) | ||
| 1990 | (progn (forward-word -1) (1- (point))))) | ||
| 1991 | (point))) | ||
| 1992 | ;; Set fill-column *wider* than needed to produce inter-column space | ||
| 1993 | (setq fill-column (+ 1 | ||
| 1994 | extra-inter-column-width | ||
| 1995 | (nth table-column table-widths))) | ||
| 1996 | (narrow-to-region start end) | ||
| 1997 | ;; Remove whitespace before and after entry. | ||
| 1998 | (skip-chars-forward " ") | ||
| 1999 | (delete-region (point) (save-excursion (beginning-of-line) (point))) | ||
| 2000 | (goto-char (point-max)) | ||
| 2001 | (skip-chars-backward " ") | ||
| 2002 | (delete-region (point) (save-excursion (end-of-line) (point))) | ||
| 2003 | ;; Temorarily set texinfo-stack to nil so texinfo-format-scan | ||
| 2004 | ;; does not see an unterminated @multitable. | ||
| 2005 | (let (texinfo-stack) ; nil | ||
| 2006 | (texinfo-format-scan)) | ||
| 2007 | (let (fill-prefix) ; no fill prefix | ||
| 2008 | (fill-region (point-min) (point-max))) | ||
| 2009 | (setq table-entry-height | ||
| 2010 | (max table-entry-height (count-lines (point-min) (point-max)))) | ||
| 2011 | ;; 3. Move point to end of bottom line, and pad that line to fill column. | ||
| 2012 | (goto-char (point-min)) | ||
| 2013 | (forward-line (1- table-entry-height)) | ||
| 2014 | (let* ((beg (point)) ; beginning of line | ||
| 2015 | ;; add one more space for inter-column spacing | ||
| 2016 | (needed-whitespace | ||
| 2017 | (1+ | ||
| 2018 | (- fill-column | ||
| 2019 | (- | ||
| 2020 | (progn (end-of-line) (point)) ; end of existing line | ||
| 2021 | beg))))) | ||
| 2022 | (insert (make-string | ||
| 2023 | (if (> needed-whitespace 0) needed-whitespace 1) | ||
| 2024 | ? ))) | ||
| 2025 | ;; now, put formatted cell into a rectangle | ||
| 2026 | (set (intern (concat multitable-temp-rectangle-name | ||
| 2027 | (int-to-string table-column))) | ||
| 2028 | (extract-rectangle (point-min) (point))) | ||
| 2029 | (delete-region (point-min) (point)) | ||
| 2030 | (goto-char (point-max)) | ||
| 2031 | (setq table-column (1+ table-column)) | ||
| 2032 | (widen)) | ||
| 2033 | ;; 4. Add extra lines to rectangles so all are of same height | ||
| 2034 | (let ((total-number-of-columns table-column) | ||
| 2035 | (column-number 0) | ||
| 2036 | here) | ||
| 2037 | (while (> table-column 0) | ||
| 2038 | (let ((this-rectangle (int-to-string table-column))) | ||
| 2039 | (while (< (length this-rectangle) table-entry-height) | ||
| 2040 | (setq this-rectangle (append this-rectangle '(""))))) | ||
| 2041 | (setq table-column (1- table-column))) | ||
| 2042 | ;; 5. Insert formatted rectangles in original buffer | ||
| 2043 | (switch-to-buffer original-buffer) | ||
| 2044 | (open-line table-entry-height) | ||
| 2045 | (while (< column-number total-number-of-columns) | ||
| 2046 | (setq here (point)) | ||
| 2047 | (insert-rectangle | ||
| 2048 | (eval (intern | ||
| 2049 | (concat multitable-temp-rectangle-name | ||
| 2050 | (int-to-string column-number))))) | ||
| 2051 | (goto-char here) | ||
| 2052 | (end-of-line) | ||
| 2053 | (setq column-number (1+ column-number)))) | ||
| 2054 | (kill-buffer multitable-temp-buffer-name) | ||
| 2055 | (setq fill-column existing-fill-column))) | ||
| 2056 | |||
| 2057 | |||
| 1507 | ;;; @ifinfo, @iftex, @tex, @ifhtml, @html | 2058 | ;;; @ifinfo, @iftex, @tex, @ifhtml, @html |
| 1508 | 2059 | ||
| 1509 | (put 'ifinfo 'texinfo-format 'texinfo-discard-line) | 2060 | (put 'ifinfo 'texinfo-format 'texinfo-discard-line) |
| @@ -1544,7 +2095,7 @@ Used by @refill indenting command to avoid indenting within lists, etc.") | |||
| 1544 | 2095 | ||
| 1545 | (put 'endtitlepage 'texinfo-format 'texinfo-discard-line) | 2096 | (put 'endtitlepage 'texinfo-format 'texinfo-discard-line) |
| 1546 | 2097 | ||
| 1547 | ; @titlespec an alternative titling command; ignored by Info | 2098 | ;; @titlespec an alternative titling command; ignored by Info |
| 1548 | 2099 | ||
| 1549 | (put 'titlespec 'texinfo-format 'texinfo-format-titlespec) | 2100 | (put 'titlespec 'texinfo-format 'texinfo-format-titlespec) |
| 1550 | (defun texinfo-format-titlespec () | 2101 | (defun texinfo-format-titlespec () |
| @@ -1559,13 +2110,27 @@ Used by @refill indenting command to avoid indenting within lists, etc.") | |||
| 1559 | 2110 | ||
| 1560 | (put 'today 'texinfo-format 'texinfo-format-today) | 2111 | (put 'today 'texinfo-format 'texinfo-format-today) |
| 1561 | 2112 | ||
| 1562 | ; Produces Day Month Year style of output. eg `1 Jan 1900' | 2113 | ;; Produces Day Month Year style of output. eg `1 Jan 1900' |
| 1563 | ; The `@today{}' command requires a pair of braces, like `@dots{}'. | 2114 | ;; The `@today{}' command requires a pair of braces, like `@dots{}'. |
| 1564 | (defun texinfo-format-today () | 2115 | (defun texinfo-format-today () |
| 1565 | (texinfo-parse-arg-discard) | 2116 | (texinfo-parse-arg-discard) |
| 1566 | (insert (format-time-string "%e %b %Y"))) | 2117 | (insert (format-time-string "%e %b %Y"))) |
| 1567 | 2118 | ||
| 1568 | 2119 | ||
| 2120 | ;;; @timestamp{} | ||
| 2121 | ;; Produce `Day Month Year Hour:Min' style of output. | ||
| 2122 | ;; eg `1 Jan 1900 13:52' | ||
| 2123 | |||
| 2124 | (put 'timestamp 'texinfo-format 'texinfo-format-timestamp) | ||
| 2125 | |||
| 2126 | ;; The `@timestamp{}' command requires a pair of braces, like `@dots{}'. | ||
| 2127 | (defun texinfo-format-timestamp () | ||
| 2128 | "Insert the current local time and date." | ||
| 2129 | (texinfo-parse-arg-discard) | ||
| 2130 | ;; For seconds and time zone, replace format string with "%e %b %Y %T %Z" | ||
| 2131 | (insert (format-time-string "%e %b %Y %R"))) | ||
| 2132 | |||
| 2133 | |||
| 1569 | ;;; @ignore | 2134 | ;;; @ignore |
| 1570 | 2135 | ||
| 1571 | (put 'ignore 'texinfo-format 'texinfo-format-ignore) | 2136 | (put 'ignore 'texinfo-format 'texinfo-format-ignore) |
| @@ -1579,64 +2144,64 @@ Used by @refill indenting command to avoid indenting within lists, etc.") | |||
| 1579 | 2144 | ||
| 1580 | ;;; Define the Info enclosure command: @definfoenclose | 2145 | ;;; Define the Info enclosure command: @definfoenclose |
| 1581 | 2146 | ||
| 1582 | ; A `@definfoenclose' command may be used to define a highlighting | 2147 | ;; A `@definfoenclose' command may be used to define a highlighting |
| 1583 | ; command for Info, but not for TeX. A command defined using | 2148 | ;; command for Info, but not for TeX. A command defined using |
| 1584 | ; `@definfoenclose' marks text by enclosing it in strings that precede | 2149 | ;; `@definfoenclose' marks text by enclosing it in strings that precede |
| 1585 | ; and follow the text. | 2150 | ;; and follow the text. |
| 1586 | ; | 2151 | ;; |
| 1587 | ; Presumably, if you define a command with `@definfoenclose` for Info, | 2152 | ;; Presumably, if you define a command with `@definfoenclose` for Info, |
| 1588 | ; you will also define the same command in the TeX definitions file, | 2153 | ;; you will also define the same command in the TeX definitions file, |
| 1589 | ; `texinfo.tex' in a manner appropriate for typesetting. | 2154 | ;; `texinfo.tex' in a manner appropriate for typesetting. |
| 1590 | ; | 2155 | ;; |
| 1591 | ; Write a `@definfoenclose' command on a line and follow it with three | 2156 | ;; Write a `@definfoenclose' command on a line and follow it with three |
| 1592 | ; arguments separated by commas (commas are used as separators in an | 2157 | ;; arguments separated by commas (commas are used as separators in an |
| 1593 | ; `@node' line in the same way). The first argument to | 2158 | ;; `@node' line in the same way). The first argument to |
| 1594 | ; `@definfoenclose' is the @-command name \(without the `@'\); the | 2159 | ;; `@definfoenclose' is the @-command name \(without the `@'\); the |
| 1595 | ; second argument is the Info start delimiter string; and the third | 2160 | ;; second argument is the Info start delimiter string; and the third |
| 1596 | ; argument is the Info end delimiter string. The latter two arguments | 2161 | ;; argument is the Info end delimiter string. The latter two arguments |
| 1597 | ; enclose the highlighted text in the Info file. A delimiter string | 2162 | ;; enclose the highlighted text in the Info file. A delimiter string |
| 1598 | ; may contain spaces. Neither the start nor end delimiter is | 2163 | ;; may contain spaces. Neither the start nor end delimiter is |
| 1599 | ; required. However, if you do not provide a start delimiter, you | 2164 | ;; required. However, if you do not provide a start delimiter, you |
| 1600 | ; must follow the command name with two commas in a row; otherwise, | 2165 | ;; must follow the command name with two commas in a row; otherwise, |
| 1601 | ; the Info formatting commands will misinterpret the end delimiter | 2166 | ;; the Info formatting commands will misinterpret the end delimiter |
| 1602 | ; string as a start delimiter string. | 2167 | ;; string as a start delimiter string. |
| 1603 | ; | 2168 | ;; |
| 1604 | ; If you do a @definfoenclose{} on the name of a pre-defined macro (such | 2169 | ;; If you do a @definfoenclose{} on the name of a pre-defined macro (such |
| 1605 | ; as @emph{}, @strong{}, @tt{}, or @i{}) the enclosure definition will | 2170 | ;; as @emph{}, @strong{}, @tt{}, or @i{}) the enclosure definition will |
| 1606 | ; override the built-in definition. | 2171 | ;; override the built-in definition. |
| 1607 | ; | 2172 | ;; |
| 1608 | ; An enclosure command defined this way takes one argument in braces. | 2173 | ;; An enclosure command defined this way takes one argument in braces. |
| 1609 | ; | 2174 | ;; |
| 1610 | ; For example, you can write: | 2175 | ;; For example, you can write: |
| 1611 | ; | 2176 | ;; |
| 1612 | ; @ifinfo | 2177 | ;; @ifinfo |
| 1613 | ; @definfoenclose phoo, //, \\ | 2178 | ;; @definfoenclose phoo, //, \\ |
| 1614 | ; @end ifinfo | 2179 | ;; @end ifinfo |
| 1615 | ; | 2180 | ;; |
| 1616 | ; near the beginning of a Texinfo file at the beginning of the lines | 2181 | ;; near the beginning of a Texinfo file at the beginning of the lines |
| 1617 | ; to define `@phoo' as an Info formatting command that inserts `//' | 2182 | ;; to define `@phoo' as an Info formatting command that inserts `//' |
| 1618 | ; before and `\\' after the argument to `@phoo'. You can then write | 2183 | ;; before and `\\' after the argument to `@phoo'. You can then write |
| 1619 | ; `@phoo{bar}' wherever you want `//bar\\' highlighted in Info. | 2184 | ;; `@phoo{bar}' wherever you want `//bar\\' highlighted in Info. |
| 1620 | ; | 2185 | ;; |
| 1621 | ; Also, for TeX formatting, you could write | 2186 | ;; Also, for TeX formatting, you could write |
| 1622 | ; | 2187 | ;; |
| 1623 | ; @iftex | 2188 | ;; @iftex |
| 1624 | ; @global@let@phoo=@i | 2189 | ;; @global@let@phoo=@i |
| 1625 | ; @end iftex | 2190 | ;; @end iftex |
| 1626 | ; | 2191 | ;; |
| 1627 | ; to define `@phoo' as a command that causes TeX to typeset | 2192 | ;; to define `@phoo' as a command that causes TeX to typeset |
| 1628 | ; the argument to `@phoo' in italics. | 2193 | ;; the argument to `@phoo' in italics. |
| 1629 | ; | 2194 | ;; |
| 1630 | ; Note that each definition applies to its own formatter: one for TeX, | 2195 | ;; Note that each definition applies to its own formatter: one for TeX, |
| 1631 | ; the other for texinfo-format-buffer or texinfo-format-region. | 2196 | ;; the other for texinfo-format-buffer or texinfo-format-region. |
| 1632 | ; | 2197 | ;; |
| 1633 | ; Here is another example: write | 2198 | ;; Here is another example: write |
| 1634 | ; | 2199 | ;; |
| 1635 | ; @definfoenclose headword, , : | 2200 | ;; @definfoenclose headword, , : |
| 1636 | ; | 2201 | ;; |
| 1637 | ; near the beginning of the file, to define `@headword' as an Info | 2202 | ;; near the beginning of the file, to define `@headword' as an Info |
| 1638 | ; formatting command that inserts nothing before and a colon after the | 2203 | ;; formatting command that inserts nothing before and a colon after the |
| 1639 | ; argument to `@headword'. | 2204 | ;; argument to `@headword'. |
| 1640 | 2205 | ||
| 1641 | (put 'definfoenclose 'texinfo-format 'texinfo-define-info-enclosure) | 2206 | (put 'definfoenclose 'texinfo-format 'texinfo-define-info-enclosure) |
| 1642 | (defun texinfo-define-info-enclosure () | 2207 | (defun texinfo-define-info-enclosure () |
| @@ -1657,32 +2222,16 @@ Used by @refill indenting command to avoid indenting within lists, etc.") | |||
| 1657 | ;;; @var, @code and the like | 2222 | ;;; @var, @code and the like |
| 1658 | 2223 | ||
| 1659 | (put 'var 'texinfo-format 'texinfo-format-var) | 2224 | (put 'var 'texinfo-format 'texinfo-format-var) |
| 1660 | ; @sc a small caps font for TeX; formatted as `var' in Info | 2225 | ;; @sc a small caps font for TeX; formatted as `var' in Info |
| 1661 | (put 'sc 'texinfo-format 'texinfo-format-var) | 2226 | (put 'sc 'texinfo-format 'texinfo-format-var) |
| 1662 | (defun texinfo-format-var () | 2227 | (defun texinfo-format-var () |
| 1663 | (insert (upcase (texinfo-parse-arg-discard))) | 2228 | (insert (upcase (texinfo-parse-arg-discard))) |
| 1664 | (goto-char texinfo-command-start)) | 2229 | (goto-char texinfo-command-start)) |
| 1665 | 2230 | ||
| 1666 | ; various noops | 2231 | (put 'url 'texinfo-format 'texinfo-format-code) |
| 1667 | |||
| 1668 | (put 'b 'texinfo-format 'texinfo-format-noop) | ||
| 1669 | (put 'i 'texinfo-format 'texinfo-format-noop) | ||
| 1670 | (put 'r 'texinfo-format 'texinfo-format-noop) | ||
| 1671 | (put 't 'texinfo-format 'texinfo-format-noop) | ||
| 1672 | (put 'w 'texinfo-format 'texinfo-format-noop) | ||
| 1673 | (put 'asis 'texinfo-format 'texinfo-format-noop) | ||
| 1674 | (put 'dmn 'texinfo-format 'texinfo-format-noop) | ||
| 1675 | (put 'key 'texinfo-format 'texinfo-format-noop) | ||
| 1676 | (put 'math 'texinfo-format 'texinfo-format-noop) | ||
| 1677 | (put 'titlefont 'texinfo-format 'texinfo-format-noop) | ||
| 1678 | (defun texinfo-format-noop () | ||
| 1679 | (insert (texinfo-parse-arg-discard)) | ||
| 1680 | (goto-char texinfo-command-start)) | ||
| 1681 | |||
| 1682 | (put 'cite 'texinfo-format 'texinfo-format-code) | 2232 | (put 'cite 'texinfo-format 'texinfo-format-code) |
| 1683 | (put 'code 'texinfo-format 'texinfo-format-code) | 2233 | (put 'code 'texinfo-format 'texinfo-format-code) |
| 1684 | (put 'file 'texinfo-format 'texinfo-format-code) | 2234 | (put 'file 'texinfo-format 'texinfo-format-code) |
| 1685 | (put 'kbd 'texinfo-format 'texinfo-format-code) | ||
| 1686 | (put 'samp 'texinfo-format 'texinfo-format-code) | 2235 | (put 'samp 'texinfo-format 'texinfo-format-code) |
| 1687 | (defun texinfo-format-code () | 2236 | (defun texinfo-format-code () |
| 1688 | (insert "`" (texinfo-parse-arg-discard) "'") | 2237 | (insert "`" (texinfo-parse-arg-discard) "'") |
| @@ -1700,6 +2249,12 @@ Used by @refill indenting command to avoid indenting within lists, etc.") | |||
| 1700 | (insert "\"" (texinfo-parse-arg-discard) "\"") | 2249 | (insert "\"" (texinfo-parse-arg-discard) "\"") |
| 1701 | (goto-char texinfo-command-start)) | 2250 | (goto-char texinfo-command-start)) |
| 1702 | 2251 | ||
| 2252 | (put 'email 'texinfo-format 'texinfo-format-key) | ||
| 2253 | (put 'key 'texinfo-format 'texinfo-format-key) | ||
| 2254 | (defun texinfo-format-key () | ||
| 2255 | (insert "<" (texinfo-parse-arg-discard) ">") | ||
| 2256 | (goto-char texinfo-command-start)) | ||
| 2257 | |||
| 1703 | (put 'bullet 'texinfo-format 'texinfo-format-bullet) | 2258 | (put 'bullet 'texinfo-format 'texinfo-format-bullet) |
| 1704 | (defun texinfo-format-bullet () | 2259 | (defun texinfo-format-bullet () |
| 1705 | "Insert an asterisk. | 2260 | "Insert an asterisk. |
| @@ -1708,6 +2263,66 @@ If used within a line, follow `@bullet' with braces." | |||
| 1708 | (insert "*")) | 2263 | (insert "*")) |
| 1709 | 2264 | ||
| 1710 | 2265 | ||
| 2266 | ;;; @kbd | ||
| 2267 | |||
| 2268 | ;; Inside of @example ... @end example and similar environments, | ||
| 2269 | ;; @kbd does nothing; but outside of such environments, it places | ||
| 2270 | ;; single quotation markes around its argument. | ||
| 2271 | |||
| 2272 | (defvar texinfo-format-kbd-regexp | ||
| 2273 | (concat | ||
| 2274 | "^@" | ||
| 2275 | "\\(" | ||
| 2276 | "example\\|" | ||
| 2277 | "smallexample\\|" | ||
| 2278 | "lisp\\|" | ||
| 2279 | "smalllisp" | ||
| 2280 | "\\)") | ||
| 2281 | "Regexp specifying environments in which @kbd does not put `...' | ||
| 2282 | around argument.") | ||
| 2283 | |||
| 2284 | (defvar texinfo-format-kbd-end-regexp | ||
| 2285 | (concat | ||
| 2286 | "^@end " | ||
| 2287 | "\\(" | ||
| 2288 | "example\\|" | ||
| 2289 | "smallexample\\|" | ||
| 2290 | "lisp\\|" | ||
| 2291 | "smalllisp" | ||
| 2292 | "\\)") | ||
| 2293 | "Regexp specifying end of environments in which @kbd does not put `...' | ||
| 2294 | around argument. (See `texinfo-format-kbd-regexp')") | ||
| 2295 | |||
| 2296 | (put 'kbd 'texinfo-format 'texinfo-format-kbd) | ||
| 2297 | (defun texinfo-format-kbd () | ||
| 2298 | "Place single quote marks around arg, except in @example and similar." | ||
| 2299 | ;; Search forward for @end example closer than an @example. | ||
| 2300 | ;; Can stop search at nearest @node or texinfo-section-types-regexp | ||
| 2301 | (let* ((stop | ||
| 2302 | (save-excursion | ||
| 2303 | (re-search-forward | ||
| 2304 | (concat "^@node\\|\\(" texinfo-section-types-regexp "\\)") | ||
| 2305 | nil | ||
| 2306 | 'move-to-end) ; if necessary, return point at end of buffer | ||
| 2307 | (point))) | ||
| 2308 | (example-location | ||
| 2309 | (save-excursion | ||
| 2310 | (re-search-forward texinfo-format-kbd-regexp stop 'move-to-end) | ||
| 2311 | (point))) | ||
| 2312 | (end-example-location | ||
| 2313 | (save-excursion | ||
| 2314 | (re-search-forward texinfo-format-kbd-end-regexp stop 'move-to-end) | ||
| 2315 | (point)))) | ||
| 2316 | ;; If inside @example, @end example will be closer than @example | ||
| 2317 | ;; or end of search i.e., end-example-location less than example-location | ||
| 2318 | (if (>= end-example-location example-location) | ||
| 2319 | ;; outside an @example or equivalent | ||
| 2320 | (insert "`" (texinfo-parse-arg-discard) "'") | ||
| 2321 | ;; else, in @example; do not surround with `...' | ||
| 2322 | (insert (texinfo-parse-arg-discard))) | ||
| 2323 | (goto-char texinfo-command-start))) | ||
| 2324 | |||
| 2325 | |||
| 1711 | ;;; @example, @lisp, @quotation, @display, @smalllisp, @smallexample | 2326 | ;;; @example, @lisp, @quotation, @display, @smalllisp, @smallexample |
| 1712 | 2327 | ||
| 1713 | (put 'display 'texinfo-format 'texinfo-format-example) | 2328 | (put 'display 'texinfo-format 'texinfo-format-example) |
| @@ -1751,8 +2366,8 @@ If used within a line, follow `@bullet' with braces." | |||
| 1751 | 2366 | ||
| 1752 | ;;; @cartouche | 2367 | ;;; @cartouche |
| 1753 | 2368 | ||
| 1754 | ; The @cartouche command is a noop in Info; in a printed manual, | 2369 | ;; The @cartouche command is a noop in Info; in a printed manual, |
| 1755 | ; it makes a box with rounded corners. | 2370 | ;; it makes a box with rounded corners. |
| 1756 | 2371 | ||
| 1757 | (put 'cartouche 'texinfo-format 'texinfo-discard-line) | 2372 | (put 'cartouche 'texinfo-format 'texinfo-discard-line) |
| 1758 | (put 'cartouche 'texinfo-end 'texinfo-discard-command) | 2373 | (put 'cartouche 'texinfo-end 'texinfo-discard-command) |
| @@ -1760,12 +2375,12 @@ If used within a line, follow `@bullet' with braces." | |||
| 1760 | 2375 | ||
| 1761 | ;;; @flushleft and @format | 2376 | ;;; @flushleft and @format |
| 1762 | 2377 | ||
| 1763 | ; The @flushleft command left justifies every line but leaves the | 2378 | ;; The @flushleft command left justifies every line but leaves the |
| 1764 | ; right end ragged. As far as Info is concerned, @flushleft is a | 2379 | ;; right end ragged. As far as Info is concerned, @flushleft is a |
| 1765 | ; `do-nothing' command | 2380 | ;; `do-nothing' command |
| 1766 | 2381 | ||
| 1767 | ; The @format command is similar to @example except that it does not | 2382 | ;; The @format command is similar to @example except that it does not |
| 1768 | ; indent; this means that in Info, @format is similar to @flushleft. | 2383 | ;; indent; this means that in Info, @format is similar to @flushleft. |
| 1769 | 2384 | ||
| 1770 | (put 'format 'texinfo-format 'texinfo-format-flushleft) | 2385 | (put 'format 'texinfo-format 'texinfo-format-flushleft) |
| 1771 | (put 'flushleft 'texinfo-format 'texinfo-format-flushleft) | 2386 | (put 'flushleft 'texinfo-format 'texinfo-format-flushleft) |
| @@ -1780,9 +2395,9 @@ If used within a line, follow `@bullet' with braces." | |||
| 1780 | 2395 | ||
| 1781 | ;;; @flushright | 2396 | ;;; @flushright |
| 1782 | 2397 | ||
| 1783 | ; The @flushright command right justifies every line but leaves the | 2398 | ;; The @flushright command right justifies every line but leaves the |
| 1784 | ; left end ragged. Spaces and tabs at the right ends of lines are | 2399 | ;; left end ragged. Spaces and tabs at the right ends of lines are |
| 1785 | ; removed so that visible text lines up on the right side. | 2400 | ;; removed so that visible text lines up on the right side. |
| 1786 | 2401 | ||
| 1787 | (put 'flushright 'texinfo-format 'texinfo-format-flushright) | 2402 | (put 'flushright 'texinfo-format 'texinfo-format-flushright) |
| 1788 | (defun texinfo-format-flushright () | 2403 | (defun texinfo-format-flushright () |
| @@ -1815,7 +2430,7 @@ If used within a line, follow `@bullet' with braces." | |||
| 1815 | ? ))))) | 2430 | ? ))))) |
| 1816 | 2431 | ||
| 1817 | 2432 | ||
| 1818 | ;;; @ctrl, @TeX, @copyright, @minus, @dots | 2433 | ;;; @ctrl, @TeX, @copyright, @minus, @dots, @enddots, @pounds |
| 1819 | 2434 | ||
| 1820 | (put 'ctrl 'texinfo-format 'texinfo-format-ctrl) | 2435 | (put 'ctrl 'texinfo-format 'texinfo-format-ctrl) |
| 1821 | (defun texinfo-format-ctrl () | 2436 | (defun texinfo-format-ctrl () |
| @@ -1849,19 +2464,24 @@ If used within a line, follow `@minus' with braces." | |||
| 1849 | (texinfo-parse-arg-discard) | 2464 | (texinfo-parse-arg-discard) |
| 1850 | (insert "....")) | 2465 | (insert "....")) |
| 1851 | 2466 | ||
| 2467 | (put 'pounds 'texinfo-format 'texinfo-format-pounds) | ||
| 2468 | (defun texinfo-format-pounds () | ||
| 2469 | (texinfo-parse-arg-discard) | ||
| 2470 | (insert "#")) | ||
| 2471 | |||
| 1852 | 2472 | ||
| 1853 | ;;; Refilling and indenting: @refill, @paragraphindent, @noindent | 2473 | ;;; Refilling and indenting: @refill, @paragraphindent, @noindent |
| 1854 | 2474 | ||
| 1855 | ;;; Indent only those paragraphs that are refilled as a result of an | 2475 | ;;; Indent only those paragraphs that are refilled as a result of an |
| 1856 | ;;; @refill command. | 2476 | ;;; @refill command. |
| 1857 | 2477 | ||
| 1858 | ; * If the value is `asis', do not change the existing indentation at | 2478 | ;; * If the value is `asis', do not change the existing indentation at |
| 1859 | ; the starts of paragraphs. | 2479 | ;; the starts of paragraphs. |
| 1860 | 2480 | ||
| 1861 | ; * If the value zero, delete any existing indentation. | 2481 | ;; * If the value zero, delete any existing indentation. |
| 1862 | 2482 | ||
| 1863 | ; * If the value is greater than zero, indent each paragraph by that | 2483 | ;; * If the value is greater than zero, indent each paragraph by that |
| 1864 | ; number of spaces. | 2484 | ;; number of spaces. |
| 1865 | 2485 | ||
| 1866 | ;;; But do not refill paragraphs with an @refill command that are | 2486 | ;;; But do not refill paragraphs with an @refill command that are |
| 1867 | ;;; preceded by @noindent or are part of a table, list, or deffn. | 2487 | ;;; preceded by @noindent or are part of a table, list, or deffn. |
| @@ -1910,9 +2530,11 @@ Default is to leave paragraph indentation as is." | |||
| 1910 | ;; are used to underline it. This could occur if the line following | 2530 | ;; are used to underline it. This could occur if the line following |
| 1911 | ;; the underlining is not an index entry and has text within it. | 2531 | ;; the underlining is not an index entry and has text within it. |
| 1912 | (let* ((previous-paragraph-separate paragraph-separate) | 2532 | (let* ((previous-paragraph-separate paragraph-separate) |
| 1913 | (paragraph-separate (concat paragraph-separate "\\|[-=*.]+")) | 2533 | (paragraph-separate |
| 2534 | (concat paragraph-separate "\\|[-=.]+\\|\\*\\*+")) | ||
| 1914 | (previous-paragraph-start paragraph-start) | 2535 | (previous-paragraph-start paragraph-start) |
| 1915 | (paragraph-start (concat paragraph-start "\\|[-=*.]+"))) | 2536 | (paragraph-start |
| 2537 | (concat paragraph-start "\\|[-=.]+\\|\\*\\*+"))) | ||
| 1916 | (unwind-protect | 2538 | (unwind-protect |
| 1917 | (fill-paragraph nil) | 2539 | (fill-paragraph nil) |
| 1918 | (setq paragraph-separate previous-paragraph-separate) | 2540 | (setq paragraph-separate previous-paragraph-separate) |
| @@ -2149,6 +2771,245 @@ Default is to leave paragraph indentation as is." | |||
| 2149 | (insert "=>")) | 2771 | (insert "=>")) |
| 2150 | 2772 | ||
| 2151 | 2773 | ||
| 2774 | ;;; Accent commands | ||
| 2775 | |||
| 2776 | ;; Info presumes a plain ASCII output, so the accented characters do | ||
| 2777 | ;; not look as they would if typeset, or output with a different | ||
| 2778 | ;; character set. | ||
| 2779 | |||
| 2780 | ;; See the `texinfo-accent-commands' variable | ||
| 2781 | ;; in the section for `texinfo-append-refill'. | ||
| 2782 | ;; Also, see the defun for `texinfo-format-scan' | ||
| 2783 | ;; for single-character accent commands. | ||
| 2784 | |||
| 2785 | ;; Command Info output Name | ||
| 2786 | |||
| 2787 | ;; These do not have braces: | ||
| 2788 | ;; @^ ==> ^ circumflex accent | ||
| 2789 | ;; @` ==> ` grave accent | ||
| 2790 | ;; @' ==> ' acute accent | ||
| 2791 | ;; @" ==> " umlaut accent | ||
| 2792 | ;; @= ==> = overbar accent | ||
| 2793 | ;; @~ ==> ~ tilde accent | ||
| 2794 | |||
| 2795 | ;; These have braces, but take no argument: | ||
| 2796 | ;; @OE{} ==> OE French-OE-ligature | ||
| 2797 | ;; @oe{} ==> oe | ||
| 2798 | ;; @AA{} ==> AA Scandinavian-A-with-circle | ||
| 2799 | ;; @aa{} ==> aa | ||
| 2800 | ;; @AE{} ==> AE Latin-Scandinavian-AE | ||
| 2801 | ;; @ae{} ==> ae | ||
| 2802 | ;; @ss{} ==> ss German-sharp-S | ||
| 2803 | |||
| 2804 | ;; @questiondown{} ==> ? upside-down-question-mark | ||
| 2805 | ;; @exclamdown{} ==> ! upside-down-exclamation-mark | ||
| 2806 | ;; @L{} ==> L/ Polish suppressed-L (Lslash) | ||
| 2807 | ;; @l{} ==> l/ Polish suppressed-L (Lslash) (lower case) | ||
| 2808 | ;; @O{} ==> O/ Scandinavian O-with-slash | ||
| 2809 | ;; @o{} ==> o/ Scandinavian O-with-slash (lower case) | ||
| 2810 | |||
| 2811 | ;; These have braces, and take an argument: | ||
| 2812 | ;; @,{c} ==> c, cedilla accent | ||
| 2813 | ;; @dotaccent{o} ==> .o overdot-accent | ||
| 2814 | ;; @ubaraccent{o} ==> _o underbar-accent | ||
| 2815 | ;; @udotaccent{o} ==> o-. underdot-accent | ||
| 2816 | ;; @H{o} ==> ""o long Hungarian umlaut | ||
| 2817 | ;; @ringaccent{o} ==> *o ring accent | ||
| 2818 | ;; @tieaccent{oo} ==> [oo tie after accent | ||
| 2819 | ;; @u{o} ==> (o breve accent | ||
| 2820 | ;; @v{o} ==> <o hacek accent | ||
| 2821 | ;; @dotless{i} ==> i dotless i and dotless j | ||
| 2822 | |||
| 2823 | ;; ========== | ||
| 2824 | |||
| 2825 | ;; Note: The defun texinfo-format-scan | ||
| 2826 | ;; looks at "[@{}^'`\",=~ *?!-]" | ||
| 2827 | ;; In the case of @*, a line break is inserted; | ||
| 2828 | ;; in the other cases, the characters are simply quoted and the @ is deleted. | ||
| 2829 | ;; Thus, `texinfo-format-scan' handles the following | ||
| 2830 | ;; single-character accent commands: @^ @` @' @" @, @- @= @~ | ||
| 2831 | |||
| 2832 | ;; @^ ==> ^ circumflex accent | ||
| 2833 | ;; (put '^ 'texinfo-format 'texinfo-format-circumflex-accent) | ||
| 2834 | ;; (defun texinfo-format-circumflex-accent () | ||
| 2835 | ;; (texinfo-discard-command) | ||
| 2836 | ;; (insert "^")) | ||
| 2837 | ;; | ||
| 2838 | ;; @` ==> ` grave accent | ||
| 2839 | ;; (put '\` 'texinfo-format 'texinfo-format-grave-accent) | ||
| 2840 | ;; (defun texinfo-format-grave-accent () | ||
| 2841 | ;; (texinfo-discard-command) | ||
| 2842 | ;; (insert "\`")) | ||
| 2843 | ;; | ||
| 2844 | ;; @' ==> ' acute accent | ||
| 2845 | ;; (put '\' 'texinfo-format 'texinfo-format-acute-accent) | ||
| 2846 | ;; (defun texinfo-format-acute-accent () | ||
| 2847 | ;; (texinfo-discard-command) | ||
| 2848 | ;; (insert "'")) | ||
| 2849 | ;; | ||
| 2850 | ;; @" ==> " umlaut accent | ||
| 2851 | ;; (put '\" 'texinfo-format 'texinfo-format-umlaut-accent) | ||
| 2852 | ;; (defun texinfo-format-umlaut-accent () | ||
| 2853 | ;; (texinfo-discard-command) | ||
| 2854 | ;; (insert "\"")) | ||
| 2855 | ;; | ||
| 2856 | ;; @= ==> = overbar accent | ||
| 2857 | ;; (put '= 'texinfo-format 'texinfo-format-overbar-accent) | ||
| 2858 | ;; (defun texinfo-format-overbar-accent () | ||
| 2859 | ;; (texinfo-discard-command) | ||
| 2860 | ;; (insert "=")) | ||
| 2861 | ;; | ||
| 2862 | ;; @~ ==> ~ tilde accent | ||
| 2863 | ;; (put '~ 'texinfo-format 'texinfo-format-tilde-accent) | ||
| 2864 | ;; (defun texinfo-format-tilde-accent () | ||
| 2865 | ;; (texinfo-discard-command) | ||
| 2866 | ;; (insert "~")) | ||
| 2867 | |||
| 2868 | ;; @OE{} ==> OE French-OE-ligature | ||
| 2869 | (put 'OE 'texinfo-format 'texinfo-format-French-OE-ligature) | ||
| 2870 | (defun texinfo-format-French-OE-ligature () | ||
| 2871 | (insert "OE" (texinfo-parse-arg-discard)) | ||
| 2872 | (goto-char texinfo-command-start)) | ||
| 2873 | |||
| 2874 | ;; @oe{} ==> oe | ||
| 2875 | (put 'oe 'texinfo-format 'texinfo-format-French-oe-ligature) | ||
| 2876 | (defun texinfo-format-French-oe-ligature () ; lower case | ||
| 2877 | (insert "oe" (texinfo-parse-arg-discard)) | ||
| 2878 | (goto-char texinfo-command-start)) | ||
| 2879 | |||
| 2880 | ;; @AA{} ==> AA Scandinavian-A-with-circle | ||
| 2881 | (put 'AA 'texinfo-format 'texinfo-format-Scandinavian-A-with-circle) | ||
| 2882 | (defun texinfo-format-Scandinavian-A-with-circle () | ||
| 2883 | (insert "AA" (texinfo-parse-arg-discard)) | ||
| 2884 | (goto-char texinfo-command-start)) | ||
| 2885 | |||
| 2886 | ;; @aa{} ==> aa | ||
| 2887 | (put 'aa 'texinfo-format 'texinfo-format-Scandinavian-a-with-circle) | ||
| 2888 | (defun texinfo-format-Scandinavian-a-with-circle () ; lower case | ||
| 2889 | (insert "aa" (texinfo-parse-arg-discard)) | ||
| 2890 | (goto-char texinfo-command-start)) | ||
| 2891 | |||
| 2892 | ;; @AE{} ==> AE Latin-Scandinavian-AE | ||
| 2893 | (put 'AE 'texinfo-format 'texinfo-format-Latin-Scandinavian-AE) | ||
| 2894 | (defun texinfo-format-Latin-Scandinavian-AE () | ||
| 2895 | (insert "AE" (texinfo-parse-arg-discard)) | ||
| 2896 | (goto-char texinfo-command-start)) | ||
| 2897 | |||
| 2898 | ;; @ae{} ==> ae | ||
| 2899 | (put 'ae 'texinfo-format 'texinfo-format-Latin-Scandinavian-ae) | ||
| 2900 | (defun texinfo-format-Latin-Scandinavian-ae () ; lower case | ||
| 2901 | (insert "ae" (texinfo-parse-arg-discard)) | ||
| 2902 | (goto-char texinfo-command-start)) | ||
| 2903 | |||
| 2904 | ;; @ss{} ==> ss German-sharp-S | ||
| 2905 | (put 'ss 'texinfo-format 'texinfo-format-German-sharp-S) | ||
| 2906 | (defun texinfo-format-German-sharp-S () | ||
| 2907 | (insert "ss" (texinfo-parse-arg-discard)) | ||
| 2908 | (goto-char texinfo-command-start)) | ||
| 2909 | |||
| 2910 | ;; @questiondown{} ==> ? upside-down-question-mark | ||
| 2911 | (put 'questiondown 'texinfo-format 'texinfo-format-upside-down-question-mark) | ||
| 2912 | (defun texinfo-format-upside-down-question-mark () | ||
| 2913 | (insert "?" (texinfo-parse-arg-discard)) | ||
| 2914 | (goto-char texinfo-command-start)) | ||
| 2915 | |||
| 2916 | ;; @exclamdown{} ==> ! upside-down-exclamation-mark | ||
| 2917 | (put 'exclamdown 'texinfo-format 'texinfo-format-upside-down-exclamation-mark) | ||
| 2918 | (defun texinfo-format-upside-down-exclamation-mark () | ||
| 2919 | (insert "!" (texinfo-parse-arg-discard)) | ||
| 2920 | (goto-char texinfo-command-start)) | ||
| 2921 | |||
| 2922 | ;; @L{} ==> L/ Polish suppressed-L (Lslash) | ||
| 2923 | (put 'L 'texinfo-format 'texinfo-format-Polish-suppressed-L) | ||
| 2924 | (defun texinfo-format-Polish-suppressed-L () | ||
| 2925 | (insert (texinfo-parse-arg-discard) "/L") | ||
| 2926 | (goto-char texinfo-command-start)) | ||
| 2927 | |||
| 2928 | ;; @l{} ==> l/ Polish suppressed-L (Lslash) (lower case) | ||
| 2929 | (put 'l 'texinfo-format 'texinfo-format-Polish-suppressed-l-lower-case) | ||
| 2930 | (defun texinfo-format-Polish-suppressed-l-lower-case () | ||
| 2931 | (insert (texinfo-parse-arg-discard) "/l") | ||
| 2932 | (goto-char texinfo-command-start)) | ||
| 2933 | |||
| 2934 | |||
| 2935 | ;; @O{} ==> O/ Scandinavian O-with-slash | ||
| 2936 | (put 'O 'texinfo-format 'texinfo-format-Scandinavian-O-with-slash) | ||
| 2937 | (defun texinfo-format-Scandinavian-O-with-slash () | ||
| 2938 | (insert (texinfo-parse-arg-discard) "O/") | ||
| 2939 | (goto-char texinfo-command-start)) | ||
| 2940 | |||
| 2941 | ;; @o{} ==> o/ Scandinavian O-with-slash (lower case) | ||
| 2942 | (put 'o 'texinfo-format 'texinfo-format-Scandinavian-o-with-slash-lower-case) | ||
| 2943 | (defun texinfo-format-Scandinavian-o-with-slash-lower-case () | ||
| 2944 | (insert (texinfo-parse-arg-discard) "o/") | ||
| 2945 | (goto-char texinfo-command-start)) | ||
| 2946 | |||
| 2947 | ;; Take arguments | ||
| 2948 | |||
| 2949 | ;; @,{c} ==> c, cedilla accent | ||
| 2950 | (put ', 'texinfo-format 'texinfo-format-cedilla-accent) | ||
| 2951 | (defun texinfo-format-cedilla-accent () | ||
| 2952 | (insert (texinfo-parse-arg-discard) ",") | ||
| 2953 | (goto-char texinfo-command-start)) | ||
| 2954 | |||
| 2955 | |||
| 2956 | ;; @dotaccent{o} ==> .o overdot-accent | ||
| 2957 | (put 'dotaccent 'texinfo-format 'texinfo-format-overdot-accent) | ||
| 2958 | (defun texinfo-format-overdot-accent () | ||
| 2959 | (insert "." (texinfo-parse-arg-discard)) | ||
| 2960 | (goto-char texinfo-command-start)) | ||
| 2961 | |||
| 2962 | ;; @ubaraccent{o} ==> _o underbar-accent | ||
| 2963 | (put 'ubaraccent 'texinfo-format 'texinfo-format-underbar-accent) | ||
| 2964 | (defun texinfo-format-underbar-accent () | ||
| 2965 | (insert "_" (texinfo-parse-arg-discard)) | ||
| 2966 | (goto-char texinfo-command-start)) | ||
| 2967 | |||
| 2968 | ;; @udotaccent{o} ==> o-. underdot-accent | ||
| 2969 | (put 'udotaccent 'texinfo-format 'texinfo-format-underdot-accent) | ||
| 2970 | (defun texinfo-format-underdot-accent () | ||
| 2971 | (insert (texinfo-parse-arg-discard) "-.") | ||
| 2972 | (goto-char texinfo-command-start)) | ||
| 2973 | |||
| 2974 | ;; @H{o} ==> ""o long Hungarian umlaut | ||
| 2975 | (put 'H 'texinfo-format 'texinfo-format-long-Hungarian-umlaut) | ||
| 2976 | (defun texinfo-format-long-Hungarian-umlaut () | ||
| 2977 | (insert "\"\"" (texinfo-parse-arg-discard)) | ||
| 2978 | (goto-char texinfo-command-start)) | ||
| 2979 | |||
| 2980 | ;; @ringaccent{o} ==> *o ring accent | ||
| 2981 | (put 'ringaccent 'texinfo-format 'texinfo-format-ring-accent) | ||
| 2982 | (defun texinfo-format-ring-accent () | ||
| 2983 | (insert "*" (texinfo-parse-arg-discard)) | ||
| 2984 | (goto-char texinfo-command-start)) | ||
| 2985 | |||
| 2986 | ;; @tieaccent{oo} ==> [oo tie after accent | ||
| 2987 | (put 'tieaccent 'texinfo-format 'texinfo-format-tie-after-accent) | ||
| 2988 | (defun texinfo-format-tie-after-accent () | ||
| 2989 | (insert "[" (texinfo-parse-arg-discard)) | ||
| 2990 | (goto-char texinfo-command-start)) | ||
| 2991 | |||
| 2992 | |||
| 2993 | ;; @u{o} ==> (o breve accent | ||
| 2994 | (put 'u 'texinfo-format 'texinfo-format-breve-accent) | ||
| 2995 | (defun texinfo-format-breve-accent () | ||
| 2996 | (insert "(" (texinfo-parse-arg-discard)) | ||
| 2997 | (goto-char texinfo-command-start)) | ||
| 2998 | |||
| 2999 | ;; @v{o} ==> <o hacek accent | ||
| 3000 | (put 'v 'texinfo-format 'texinfo-format-hacek-accent) | ||
| 3001 | (defun texinfo-format-hacek-accent () | ||
| 3002 | (insert "<" (texinfo-parse-arg-discard)) | ||
| 3003 | (goto-char texinfo-command-start)) | ||
| 3004 | |||
| 3005 | |||
| 3006 | ;; @dotless{i} ==> i dotless i and dotless j | ||
| 3007 | (put 'dotless 'texinfo-format 'texinfo-format-dotless) | ||
| 3008 | (defun texinfo-format-dotless () | ||
| 3009 | (insert (texinfo-parse-arg-discard)) | ||
| 3010 | (goto-char texinfo-command-start)) | ||
| 3011 | |||
| 3012 | |||
| 2152 | ;;; Definition formatting: @deffn, @defun, etc | 3013 | ;;; Definition formatting: @deffn, @defun, etc |
| 2153 | 3014 | ||
| 2154 | ;; What definition formatting produces: | 3015 | ;; What definition formatting produces: |
| @@ -2880,6 +3741,60 @@ The command `@value{foo}' expands to the value." | |||
| 2880 | ())))) | 3741 | ())))) |
| 2881 | 3742 | ||
| 2882 | 3743 | ||
| 3744 | ;;; @ifeq | ||
| 3745 | |||
| 3746 | (put 'ifeq 'texinfo-format 'texinfo-format-ifeq) | ||
| 3747 | (defun texinfo-format-ifeq () | ||
| 3748 | "If ARG1 and ARG2 caselessly string compare to same string, performs COMMAND. | ||
| 3749 | Otherwise produces no output. | ||
| 3750 | |||
| 3751 | Thus: | ||
| 3752 | @ifeq{ arg1 , arg1 , @code{foo}} bar | ||
| 3753 | |||
| 3754 | ==> `foo' bar. | ||
| 3755 | but | ||
| 3756 | @ifeq{ arg1 , arg2 , @code{foo}} bar | ||
| 3757 | |||
| 3758 | ==> bar | ||
| 3759 | |||
| 3760 | Note that the Texinfo command and its arguments must be arguments to | ||
| 3761 | the @ifeq command." | ||
| 3762 | ;; compare-buffer-substrings does not exist in version 18; don't use | ||
| 3763 | (goto-char texinfo-command-end) | ||
| 3764 | (let* ((case-fold-search t) | ||
| 3765 | (stop (save-excursion (forward-sexp 1) (point))) | ||
| 3766 | start end | ||
| 3767 | ;; @ifeq{arg1, arg2, @command{optional-args}} | ||
| 3768 | (arg1 | ||
| 3769 | (progn | ||
| 3770 | (forward-char 1) | ||
| 3771 | (skip-chars-forward " ") | ||
| 3772 | (setq start (point)) | ||
| 3773 | (search-forward "," stop t) | ||
| 3774 | (skip-chars-backward ", ") | ||
| 3775 | (buffer-substring start (point)))) | ||
| 3776 | (arg2 | ||
| 3777 | (progn | ||
| 3778 | (search-forward "," stop t) | ||
| 3779 | (skip-chars-forward " ") | ||
| 3780 | (setq start (point)) | ||
| 3781 | (search-forward "," stop t) | ||
| 3782 | (skip-chars-backward ", ") | ||
| 3783 | (buffer-substring start (point)))) | ||
| 3784 | (texinfo-command | ||
| 3785 | (progn | ||
| 3786 | (search-forward "," stop t) | ||
| 3787 | (skip-chars-forward " ") | ||
| 3788 | (setq start (point)) | ||
| 3789 | (goto-char (1- stop)) | ||
| 3790 | (skip-chars-backward " ") | ||
| 3791 | (buffer-substring start (point))))) | ||
| 3792 | (delete-region texinfo-command-start stop) | ||
| 3793 | (if (equal arg1 arg2) | ||
| 3794 | (insert texinfo-command)) | ||
| 3795 | (goto-char texinfo-command-start))) | ||
| 3796 | |||
| 3797 | |||
| 2883 | ;;; Process included files: `@include' command | 3798 | ;;; Process included files: `@include' command |
| 2884 | 3799 | ||
| 2885 | ;; Updated 19 October 1990 | 3800 | ;; Updated 19 October 1990 |
| @@ -2906,67 +3821,105 @@ The command `@value{foo}' expands to the value." | |||
| 2906 | ;; is treated like other @-commands. | 3821 | ;; is treated like other @-commands. |
| 2907 | (put 'include 'texinfo-format 'texinfo-format-noop) | 3822 | (put 'include 'texinfo-format 'texinfo-format-noop) |
| 2908 | 3823 | ||
| 2909 | ; Original definition: | 3824 | ;; Original definition: |
| 2910 | ; (defun texinfo-format-include () | 3825 | ;; (defun texinfo-format-include () |
| 2911 | ; (let ((filename (texinfo-parse-arg-discard)) | 3826 | ;; (let ((filename (texinfo-parse-arg-discard)) |
| 2912 | ; (default-directory input-directory) | 3827 | ;; (default-directory input-directory) |
| 2913 | ; subindex) | 3828 | ;; subindex) |
| 2914 | ; (setq subindex | 3829 | ;; (setq subindex |
| 2915 | ; (save-excursion | 3830 | ;; (save-excursion |
| 2916 | ; (progn (find-file | 3831 | ;; (progn (find-file |
| 2917 | ; (cond ((file-readable-p (concat filename ".texinfo")) | 3832 | ;; (cond ((file-readable-p (concat filename ".texinfo")) |
| 2918 | ; (concat filename ".texinfo")) | 3833 | ;; (concat filename ".texinfo")) |
| 2919 | ; ((file-readable-p (concat filename ".texi")) | 3834 | ;; ((file-readable-p (concat filename ".texi")) |
| 2920 | ; (concat filename ".texi")) | 3835 | ;; (concat filename ".texi")) |
| 2921 | ; ((file-readable-p (concat filename ".tex")) | 3836 | ;; ((file-readable-p (concat filename ".tex")) |
| 2922 | ; (concat filename ".tex")) | 3837 | ;; (concat filename ".tex")) |
| 2923 | ; ((file-readable-p filename) | 3838 | ;; ((file-readable-p filename) |
| 2924 | ; filename) | 3839 | ;; filename) |
| 2925 | ; (t (error "@include'd file %s not found" | 3840 | ;; (t (error "@include'd file %s not found" |
| 2926 | ; filename)))) | 3841 | ;; filename)))) |
| 2927 | ; (texinfo-format-buffer-1)))) | 3842 | ;; (texinfo-format-buffer-1)))) |
| 2928 | ; (texinfo-subindex 'texinfo-vindex (car subindex) (nth 1 subindex)) | 3843 | ;; (texinfo-subindex 'texinfo-vindex (car subindex) (nth 1 subindex)) |
| 2929 | ; (texinfo-subindex 'texinfo-findex (car subindex) (nth 2 subindex)) | 3844 | ;; (texinfo-subindex 'texinfo-findex (car subindex) (nth 2 subindex)) |
| 2930 | ; (texinfo-subindex 'texinfo-cindex (car subindex) (nth 3 subindex)) | 3845 | ;; (texinfo-subindex 'texinfo-cindex (car subindex) (nth 3 subindex)) |
| 2931 | ; (texinfo-subindex 'texinfo-pindex (car subindex) (nth 4 subindex)) | 3846 | ;; (texinfo-subindex 'texinfo-pindex (car subindex) (nth 4 subindex)) |
| 2932 | ; (texinfo-subindex 'texinfo-tindex (car subindex) (nth 5 subindex)) | 3847 | ;; (texinfo-subindex 'texinfo-tindex (car subindex) (nth 5 subindex)) |
| 2933 | ; (texinfo-subindex 'texinfo-kindex (car subindex) (nth 6 subindex)))) | 3848 | ;; (texinfo-subindex 'texinfo-kindex (car subindex) (nth 6 subindex)))) |
| 2934 | ; | 3849 | ;; |
| 2935 | ;(defun texinfo-subindex (indexvar file content) | 3850 | ;;(defun texinfo-subindex (indexvar file content) |
| 2936 | ; (set indexvar (cons (list 'recurse file content) | 3851 | ;; (set indexvar (cons (list 'recurse file content) |
| 2937 | ; (symbol-value indexvar)))) | 3852 | ;; (symbol-value indexvar)))) |
| 2938 | 3853 | ||
| 2939 | ; Second definition: | 3854 | ;; Second definition: |
| 2940 | ; (put 'include 'texinfo-format 'texinfo-format-include) | 3855 | ;; (put 'include 'texinfo-format 'texinfo-format-include) |
| 2941 | ; (defun texinfo-format-include () | 3856 | ;; (defun texinfo-format-include () |
| 2942 | ; (let ((filename (concat input-directory | 3857 | ;; (let ((filename (concat input-directory |
| 2943 | ; (texinfo-parse-arg-discard))) | 3858 | ;; (texinfo-parse-arg-discard))) |
| 2944 | ; (default-directory input-directory)) | 3859 | ;; (default-directory input-directory)) |
| 2945 | ; (message "Reading: %s" filename) | 3860 | ;; (message "Reading: %s" filename) |
| 2946 | ; (save-excursion | 3861 | ;; (save-excursion |
| 2947 | ; (save-restriction | 3862 | ;; (save-restriction |
| 2948 | ; (narrow-to-region | 3863 | ;; (narrow-to-region |
| 2949 | ; (point) | 3864 | ;; (point) |
| 2950 | ; (+ (point) (car (cdr (insert-file-contents filename))))) | 3865 | ;; (+ (point) (car (cdr (insert-file-contents filename))))) |
| 2951 | ; (goto-char (point-min)) | 3866 | ;; (goto-char (point-min)) |
| 2952 | ; (texinfo-append-refill) | 3867 | ;; (texinfo-append-refill) |
| 2953 | ; (texinfo-format-convert (point-min) (point-max)))) | 3868 | ;; (texinfo-format-convert (point-min) (point-max)))) |
| 2954 | ; (setq last-input-buffer input-buffer) ; to bypass setfilename | 3869 | ;; (setq last-input-buffer input-buffer) ; to bypass setfilename |
| 2955 | ; )) | 3870 | ;; )) |
| 2956 | 3871 | ||
| 2957 | 3872 | ||
| 2958 | ;;; Numerous commands do nothing in Texinfo | 3873 | ;;; Numerous commands do nothing in Info |
| 2959 | |||
| 2960 | ;; These commands are defined in texinfo.tex for printed output. | 3874 | ;; These commands are defined in texinfo.tex for printed output. |
| 2961 | 3875 | ||
| 3876 | |||
| 3877 | ;;; various noops, such as @b{foo}, that take arguments in braces | ||
| 3878 | |||
| 3879 | (put 'b 'texinfo-format 'texinfo-format-noop) | ||
| 3880 | (put 'i 'texinfo-format 'texinfo-format-noop) | ||
| 3881 | (put 'r 'texinfo-format 'texinfo-format-noop) | ||
| 3882 | (put 't 'texinfo-format 'texinfo-format-noop) | ||
| 3883 | (put 'w 'texinfo-format 'texinfo-format-noop) | ||
| 3884 | (put 'asis 'texinfo-format 'texinfo-format-noop) | ||
| 3885 | (put 'dmn 'texinfo-format 'texinfo-format-noop) | ||
| 3886 | (put 'math 'texinfo-format 'texinfo-format-noop) | ||
| 3887 | (put 'titlefont 'texinfo-format 'texinfo-format-noop) | ||
| 3888 | (defun texinfo-format-noop () | ||
| 3889 | (insert (texinfo-parse-arg-discard)) | ||
| 3890 | (goto-char texinfo-command-start)) | ||
| 3891 | |||
| 3892 | ;; @hyphenation command discards an argument within braces | ||
| 3893 | (put 'hyphenation 'texinfo-format 'texinfo-discard-command-and-arg) | ||
| 3894 | (defun texinfo-discard-command-and-arg () | ||
| 3895 | "Discard both @-command and its argument in braces." | ||
| 3896 | (goto-char texinfo-command-end) | ||
| 3897 | (forward-list 1) | ||
| 3898 | (setq texinfo-command-end (point)) | ||
| 3899 | (delete-region texinfo-command-start texinfo-command-end)) | ||
| 3900 | |||
| 3901 | |||
| 3902 | ;;; Do nothing commands, such as @smallbook, that have no args and no braces | ||
| 3903 | ;; These must appear on a line of their own | ||
| 3904 | |||
| 2962 | (put 'bye 'texinfo-format 'texinfo-discard-line) | 3905 | (put 'bye 'texinfo-format 'texinfo-discard-line) |
| 3906 | (put 'smallbook 'texinfo-format 'texinfo-discard-line) | ||
| 3907 | (put 'finalout 'texinfo-format 'texinfo-discard-line) | ||
| 3908 | (put 'overfullrule 'texinfo-format 'texinfo-discard-line) | ||
| 3909 | (put 'smallbreak 'texinfo-format 'texinfo-discard-line) | ||
| 3910 | (put 'medbreak 'texinfo-format 'texinfo-discard-line) | ||
| 3911 | (put 'bigbreak 'texinfo-format 'texinfo-discard-line) | ||
| 3912 | |||
| 3913 | |||
| 3914 | ;;; These noop commands discard the rest of the line. | ||
| 3915 | |||
| 2963 | (put 'c 'texinfo-format 'texinfo-discard-line-with-args) | 3916 | (put 'c 'texinfo-format 'texinfo-discard-line-with-args) |
| 2964 | (put 'comment 'texinfo-format 'texinfo-discard-line-with-args) | 3917 | (put 'comment 'texinfo-format 'texinfo-discard-line-with-args) |
| 2965 | (put 'contents 'texinfo-format 'texinfo-discard-line-with-args) | 3918 | (put 'contents 'texinfo-format 'texinfo-discard-line-with-args) |
| 2966 | (put 'finalout 'texinfo-format 'texinfo-discard-line) | ||
| 2967 | (put 'group 'texinfo-end 'texinfo-discard-line-with-args) | 3919 | (put 'group 'texinfo-end 'texinfo-discard-line-with-args) |
| 2968 | (put 'group 'texinfo-format 'texinfo-discard-line-with-args) | 3920 | (put 'group 'texinfo-format 'texinfo-discard-line-with-args) |
| 2969 | (put 'headings 'texinfo-format 'texinfo-discard-line-with-args) | 3921 | (put 'headings 'texinfo-format 'texinfo-discard-line-with-args) |
| 3922 | (put 'setchapterstyle 'texinfo-format 'texinfo-discard-line-with-args) | ||
| 2970 | (put 'hsize 'texinfo-format 'texinfo-discard-line-with-args) | 3923 | (put 'hsize 'texinfo-format 'texinfo-discard-line-with-args) |
| 2971 | (put 'itemindent 'texinfo-format 'texinfo-discard-line-with-args) | 3924 | (put 'itemindent 'texinfo-format 'texinfo-discard-line-with-args) |
| 2972 | (put 'lispnarrowing 'texinfo-format 'texinfo-discard-line-with-args) | 3925 | (put 'lispnarrowing 'texinfo-format 'texinfo-discard-line-with-args) |
| @@ -2979,8 +3932,10 @@ The command `@value{foo}' expands to the value." | |||
| 2979 | (put 'settitle 'texinfo-format 'texinfo-discard-line-with-args) | 3932 | (put 'settitle 'texinfo-format 'texinfo-discard-line-with-args) |
| 2980 | (put 'setx 'texinfo-format 'texinfo-discard-line-with-args) | 3933 | (put 'setx 'texinfo-format 'texinfo-discard-line-with-args) |
| 2981 | (put 'shortcontents 'texinfo-format 'texinfo-discard-line-with-args) | 3934 | (put 'shortcontents 'texinfo-format 'texinfo-discard-line-with-args) |
| 2982 | (put 'smallbook 'texinfo-format 'texinfo-discard-line) | 3935 | (put 'shorttitlepage 'texinfo-format 'texinfo-discard-line-with-args) |
| 2983 | (put 'summarycontents 'texinfo-format 'texinfo-discard-line-with-args) | 3936 | (put 'summarycontents 'texinfo-format 'texinfo-discard-line-with-args) |
| 3937 | (put 'input 'texinfo-format 'texinfo-discard-line-with-args) | ||
| 3938 | (put 'dircategory 'texinfo-format 'texinfo-discard-line-with-args) | ||
| 2984 | 3939 | ||
| 2985 | 3940 | ||
| 2986 | ;;; Some commands cannot be handled | 3941 | ;;; Some commands cannot be handled |