1 |
;;; texinfmt.el --- format Texinfo files into Info files |
;;; texinfmt.el --- format Texinfo files into Info files |
2 |
|
|
3 |
;; Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, |
;; Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, |
4 |
;; 1994, 1995, 1996, 1997, 1998, 2000, 2001 |
;; 1994, 1995, 1996, 1997, 1998, 2000, 2001 |
5 |
;; Free Software Foundation, Inc. |
;; Free Software Foundation, Inc. |
6 |
|
|
37 |
(defmacro defcustom (var value doc &rest ignore) |
(defmacro defcustom (var value doc &rest ignore) |
38 |
`(defvar ,var ,value ,doc))) |
`(defvar ,var ,value ,doc))) |
39 |
|
|
40 |
(defvar texinfmt-version "2.38 of 3 July 1998") |
(defvar texinfmt-version "2.40 of 6 Dec 2002") |
41 |
|
|
42 |
(defun texinfmt-version (&optional here) |
(defun texinfmt-version (&optional here) |
43 |
"Show the version of texinfmt.el in the minibuffer. |
"Show the version of texinfmt.el in the minibuffer. |
44 |
If optional argument HERE is non-nil, insert info at point." |
If optional argument HERE is non-nil, insert info at point." |
45 |
(interactive "P") |
(interactive "P") |
46 |
(let ((version-string |
(let ((version-string |
47 |
(format "Version of \`texinfmt.el\': %s" texinfmt-version))) |
(format "Version of \`texinfmt.el\': %s" texinfmt-version))) |
48 |
(if here |
(if here |
49 |
(insert version-string) |
(insert version-string) |
50 |
(if (interactive-p) |
(if (interactive-p) |
51 |
(message "%s" version-string) |
(message "%s" version-string) |
134 |
(defvar texinfo-region-buffer-name "*Info Region*" |
(defvar texinfo-region-buffer-name "*Info Region*" |
135 |
"*Name of the temporary buffer used by \\[texinfo-format-region].") |
"*Name of the temporary buffer used by \\[texinfo-format-region].") |
136 |
|
|
137 |
|
;; These come from tex-mode.el. |
138 |
|
(defvar tex-start-of-header) |
139 |
|
(defvar tex-end-of-header) |
140 |
|
|
141 |
;;;###autoload |
;;;###autoload |
142 |
(defun texinfo-format-region (region-beginning region-end) |
(defun texinfo-format-region (region-beginning region-end) |
143 |
"Convert the current region of the Texinfo file to Info format. |
"Convert the current region of the Texinfo file to Info format. |
169 |
(header-text "") |
(header-text "") |
170 |
(header-beginning 1) |
(header-beginning 1) |
171 |
(header-end 1)) |
(header-end 1)) |
172 |
|
|
173 |
;;; Copy lines between beginning and end of header lines, |
;;; Copy lines between beginning and end of header lines, |
174 |
;;; if any, or else copy the `@setfilename' line, if any. |
;;; if any, or else copy the `@setfilename' line, if any. |
175 |
(save-excursion |
(save-excursion |
176 |
(save-restriction |
(save-restriction |
179 |
(let ((search-end (save-excursion (forward-line 100) (point)))) |
(let ((search-end (save-excursion (forward-line 100) (point)))) |
180 |
(if (or |
(if (or |
181 |
;; Either copy header text. |
;; Either copy header text. |
182 |
(and |
(and |
183 |
(prog1 |
(prog1 |
184 |
(search-forward tex-start-of-header search-end t) |
(search-forward tex-start-of-header search-end t) |
185 |
(forward-line 1) |
(forward-line 1) |
186 |
;; Mark beginning of header. |
;; Mark beginning of header. |
187 |
(setq header-beginning (point))) |
(setq header-beginning (point))) |
188 |
(prog1 |
(prog1 |
189 |
(search-forward tex-end-of-header nil t) |
(search-forward tex-end-of-header nil t) |
190 |
(beginning-of-line) |
(beginning-of-line) |
191 |
;; Mark end of header |
;; Mark end of header |
198 |
(setq header-beginning (point)) |
(setq header-beginning (point)) |
199 |
(forward-line 1) |
(forward-line 1) |
200 |
(setq header-end (point)))) |
(setq header-end (point)))) |
201 |
|
|
202 |
;; Copy header |
;; Copy header |
203 |
(setq header-text |
(setq header-text |
204 |
(buffer-substring |
(buffer-substring-no-properties |
205 |
(min header-beginning region-beginning) |
(min header-beginning region-beginning) |
206 |
header-end)))))) |
header-end)))))) |
207 |
|
|
218 |
;; Make sure region ends in a newline. |
;; Make sure region ends in a newline. |
219 |
(or (= (preceding-char) ?\n) |
(or (= (preceding-char) ?\n) |
220 |
(insert "\n")) |
(insert "\n")) |
221 |
|
|
222 |
(goto-char (point-min)) |
(goto-char (point-min)) |
223 |
(texinfo-mode) |
(texinfo-mode) |
224 |
(message "Converting region to Info format...") |
(message "Converting region to Info format...") |
228 |
|
|
229 |
;; Insert @include files so `texinfo-raise-lower-sections' can |
;; Insert @include files so `texinfo-raise-lower-sections' can |
230 |
;; work on them without losing track of multiple |
;; work on them without losing track of multiple |
231 |
;; @raise/@lowersections commands. |
;; @raise/@lowersections commands. |
232 |
(while (re-search-forward "^@include" nil t) |
(while (re-search-forward "^@include" nil t) |
233 |
(setq texinfo-command-end (point)) |
(setq texinfo-command-end (point)) |
234 |
(let ((filename (concat input-directory |
(let ((filename (concat input-directory |
244 |
(goto-char (point-min)) |
(goto-char (point-min)) |
245 |
;; Remove `@setfilename' line from included file, if any, |
;; Remove `@setfilename' line from included file, if any, |
246 |
;; so @setfilename command not duplicated. |
;; so @setfilename command not duplicated. |
247 |
(if (re-search-forward |
(if (re-search-forward "^@setfilename" (line-end-position 100) t) |
248 |
"^@setfilename" (save-excursion (forward-line 100) (point)) t) |
(delete-region (line-beginning-position 1) |
249 |
(progn |
(line-beginning-position 2))))))) |
|
(beginning-of-line) |
|
|
(delete-region |
|
|
(point) (save-excursion (forward-line 1) (point))))))))) |
|
250 |
|
|
251 |
;; Raise or lower level of each section, if necessary. |
;; Raise or lower level of each section, if necessary. |
252 |
(goto-char (point-min)) |
(goto-char (point-min)) |
268 |
|
|
269 |
(goto-char (point-min)) |
(goto-char (point-min)) |
270 |
(if (looking-at "\\\\input[ \t]+texinfo") |
(if (looking-at "\\\\input[ \t]+texinfo") |
271 |
(delete-region (point) (save-excursion (forward-line 1) (point)))) |
(delete-region (point) (line-beginning-position 2))) |
272 |
|
|
273 |
;; Insert Info region title text. |
;; Insert Info region title text. |
274 |
(goto-char (point-min)) |
(goto-char (point-min)) |
275 |
(if (search-forward |
(if (search-forward |
276 |
"@setfilename" (save-excursion (forward-line 100) (point)) t) |
"@setfilename" (save-excursion (forward-line 100) (point)) t) |
277 |
(progn |
(progn |
278 |
(setq texinfo-command-end (point)) |
(setq texinfo-command-end (point)) |
281 |
(let ((arg (texinfo-parse-arg-discard))) |
(let ((arg (texinfo-parse-arg-discard))) |
282 |
(insert " " |
(insert " " |
283 |
texinfo-region-buffer-name |
texinfo-region-buffer-name |
284 |
" buffer for: `") |
" buffer for: `") |
285 |
(insert (file-name-nondirectory (expand-file-name arg))) |
(insert (file-name-nondirectory (expand-file-name arg))) |
286 |
(insert "', -*-Text-*-\n"))) |
(insert "', -*-Text-*-\n"))) |
287 |
;; Else no `@setfilename' line |
;; Else no `@setfilename' line |
382 |
|
|
383 |
(insert-buffer-substring input-buffer) |
(insert-buffer-substring input-buffer) |
384 |
(message "Converting %s to Info format..." (buffer-name input-buffer)) |
(message "Converting %s to Info format..." (buffer-name input-buffer)) |
385 |
|
|
386 |
;; Insert @include files so `texinfo-raise-lower-sections' can |
;; Insert @include files so `texinfo-raise-lower-sections' can |
387 |
;; work on them without losing track of multiple |
;; work on them without losing track of multiple |
388 |
;; @raise/@lowersections commands. |
;; @raise/@lowersections commands. |
389 |
(goto-char (point-min)) |
(goto-char (point-min)) |
390 |
(while (re-search-forward "^@include" nil t) |
(while (re-search-forward "^@include" nil t) |
391 |
(setq texinfo-command-end (point)) |
(setq texinfo-command-end (point)) |
392 |
(let ((filename (concat input-directory |
(let ((filename (concat input-directory |
393 |
(texinfo-parse-line-arg)))) |
(texinfo-parse-line-arg)))) |
394 |
(re-search-backward "^@include") |
(re-search-backward "^@include") |
395 |
(delete-region (point) (save-excursion (forward-line 1) (point))) |
(delete-region (point) (line-beginning-position 2)) |
396 |
(message "Reading included file: %s" filename) |
(message "Reading included file: %s" filename) |
397 |
(save-excursion |
(save-excursion |
398 |
(save-restriction |
(save-restriction |
402 |
(goto-char (point-min)) |
(goto-char (point-min)) |
403 |
;; Remove `@setfilename' line from included file, if any, |
;; Remove `@setfilename' line from included file, if any, |
404 |
;; so @setfilename command not duplicated. |
;; so @setfilename command not duplicated. |
405 |
(if (re-search-forward |
(if (re-search-forward "^@setfilename" (line-end-position 100) t) |
406 |
"^@setfilename" |
(delete-region (line-beginning-position 1) |
407 |
(save-excursion (forward-line 100) (point)) t) |
(line-beginning-position 2))))))) |
|
(progn |
|
|
(beginning-of-line) |
|
|
(delete-region |
|
|
(point) (save-excursion (forward-line 1) (point))))))))) |
|
408 |
;; Raise or lower level of each section, if necessary. |
;; Raise or lower level of each section, if necessary. |
409 |
(goto-char (point-min)) |
(goto-char (point-min)) |
410 |
(texinfo-raise-lower-sections) |
(texinfo-raise-lower-sections) |
462 |
;; Convert three hyphens in a row to two. |
;; Convert three hyphens in a row to two. |
463 |
(goto-char min) |
(goto-char min) |
464 |
(while (re-search-forward "\\( \\|\\w\\)\\(---\\)\\( \\|\\w\\)" max t) |
(while (re-search-forward "\\( \\|\\w\\)\\(---\\)\\( \\|\\w\\)" max t) |
465 |
(delete-region (1+ (match-beginning 2)) (+ 2 (match-beginning |
(delete-region (1+ (match-beginning 2)) (+ 2 (match-beginning 2))))) |
|
2))))) |
|
466 |
|
|
467 |
|
|
468 |
;;; Handle paragraph filling |
;;; Handle paragraph filling |
473 |
(concat |
(concat |
474 |
"^@" |
"^@" |
475 |
"\\(" |
"\\(" |
476 |
|
;; add "itemize\\|" (from experiment of 2001 Nov 28) |
477 |
|
;; because of a problem with @end itemize@refill |
478 |
|
;; I don't know if this causes other problems. |
479 |
|
;; I suspect itemized lists don't get filled properly and a |
480 |
|
;; more precise fix is required. Bob |
481 |
|
"itemize\\|" |
482 |
"direntry\\|" |
"direntry\\|" |
483 |
"lisp\\|" |
"lisp\\|" |
484 |
"smalllisp\\|" |
"smalllisp\\|" |
576 |
|
|
577 |
(defun texinfo-append-refill () |
(defun texinfo-append-refill () |
578 |
"Append @refill at end of each paragraph that should be filled. |
"Append @refill at end of each paragraph that should be filled. |
579 |
Do not append @refill to paragraphs within @example and similar environments. |
Do not append @refill to paragraphs within @example and similar environments. |
580 |
Do not append @refill to paragraphs containing @w{TEXT} or @*." |
Do not append @refill to paragraphs containing @w{TEXT} or @*." |
581 |
|
|
582 |
;; It is necessary to append @refill before other processing because |
;; It is necessary to append @refill before other processing because |
583 |
;; the other processing removes information that tells Texinfo |
;; the other processing removes information that tells Texinfo |
584 |
;; whether the text should or should not be filled. |
;; whether the text should or should not be filled. |
585 |
|
|
586 |
(while (< (point) (point-max)) |
(while (< (point) (point-max)) |
587 |
(let ((refill-blank-lines "^[ \t\n]*$") |
(let ((refill-blank-lines "^[ \t\n]*$") |
588 |
(case-fold-search nil)) ; Don't confuse @TeX and @tex.... |
(case-fold-search nil)) ; Don't confuse @TeX and @tex.... |
589 |
(beginning-of-line) |
(beginning-of-line) |
590 |
;; 1. Skip over blank lines; |
;; 1. Skip over blank lines; |
591 |
;; skip over lines beginning with @-commands, |
;; skip over lines beginning with @-commands, |
592 |
;; but do not skip over lines |
;; but do not skip over lines |
593 |
;; that are no-refill environments such as @example or |
;; that are no-refill environments such as @example or |
594 |
;; that begin with within-paragraph @-commands such as @code. |
;; that begin with within-paragraph @-commands such as @code. |
595 |
(while (and (looking-at (concat "^@\\|^\\\\\\|" refill-blank-lines)) |
(while (and (looking-at (concat "^@\\|^\\\\\\|" refill-blank-lines)) |
596 |
(not (looking-at |
(not (looking-at |
597 |
(concat |
(concat |
598 |
"\\(" |
"\\(" |
599 |
texinfo-no-refill-regexp |
texinfo-no-refill-regexp |
600 |
"\\|" |
"\\|" |
601 |
texinfo-part-of-para-regexp |
texinfo-part-of-para-regexp |
602 |
"\\)"))) |
"\\)"))) |
603 |
(< (point) (point-max))) |
(< (point) (point-max))) |
604 |
(forward-line 1)) |
(forward-line 1)) |
605 |
;; 2. Skip over @example and similar no-refill environments. |
;; 2. Skip over @example and similar no-refill environments. |
606 |
(if (looking-at texinfo-no-refill-regexp) |
(if (looking-at texinfo-no-refill-regexp) |
607 |
(let ((environment |
(let ((environment (match-string-no-properties 1))) |
|
(buffer-substring (match-beginning 1) (match-end 1)))) |
|
608 |
(progn (re-search-forward (concat "^@end " environment) nil t) |
(progn (re-search-forward (concat "^@end " environment) nil t) |
609 |
(forward-line 1))) |
(forward-line 1))) |
610 |
;; Else |
;; Else |
611 |
;; 3. Do not refill a paragraph containing @w or @*, or ending |
;; 3. Do not refill a paragraph containing @w or @*, or ending |
612 |
;; with @<newline> followed by a newline. |
;; with @<newline> followed by a newline. |
613 |
(if (or |
(if (or (>= (point) (point-max)) |
614 |
(>= (point) (point-max)) |
(re-search-forward |
615 |
(re-search-forward |
"@w{\\|@\\*\\|@\n\n" |
616 |
"@w{\\|@\\*\\|@\n\n" |
(save-excursion (forward-paragraph) (forward-line 1) (point)) |
617 |
(save-excursion |
t)) |
|
(forward-paragraph) |
|
|
(forward-line 1) |
|
|
(point)) t)) |
|
618 |
;; Go to end of paragraph and do nothing. |
;; Go to end of paragraph and do nothing. |
619 |
(forward-paragraph) |
(forward-paragraph) |
620 |
;; 4. Else go to end of paragraph and insert @refill |
;; 4. Else go to end of paragraph and insert @refill |
621 |
(forward-paragraph) |
(forward-paragraph) |
622 |
(forward-line -1) |
(forward-line -1) |
636 |
;;; Handle `@raisesections' and `@lowersections' commands |
;;; Handle `@raisesections' and `@lowersections' commands |
637 |
|
|
638 |
;; These commands change the hierarchical level of chapter structuring |
;; These commands change the hierarchical level of chapter structuring |
639 |
;; commands. |
;; commands. |
640 |
;; |
;; |
641 |
;; @raisesections changes @subsection to @section, |
;; @raisesections changes @subsection to @section, |
642 |
;; @section to @chapter, |
;; @section to @chapter, |
643 |
;; etc. |
;; etc. |
652 |
;; |
;; |
653 |
;; Repeated @raisesections/@lowersections continue to raise or lower |
;; Repeated @raisesections/@lowersections continue to raise or lower |
654 |
;; the heading level. |
;; the heading level. |
655 |
;; |
;; |
656 |
;; An @lowersections command cancels an @raisesections command, and |
;; An @lowersections command cancels an @raisesections command, and |
657 |
;; vice versa. |
;; vice versa. |
658 |
;; |
;; |
663 |
;; @section produce chapter headings). |
;; @section produce chapter headings). |
664 |
|
|
665 |
(defun texinfo-raise-lower-sections () |
(defun texinfo-raise-lower-sections () |
666 |
"Raise or lower the hierarchical level of chapters, sections, etc. |
"Raise or lower the hierarchical level of chapters, sections, etc. |
667 |
|
|
668 |
This function acts according to `@raisesections' and `@lowersections' |
This function acts according to `@raisesections' and `@lowersections' |
669 |
commands in the Texinfo file. |
commands in the Texinfo file. |
697 |
An attempt to raise above `chapters' reproduces chapter commands; an |
An attempt to raise above `chapters' reproduces chapter commands; an |
698 |
attempt to lower below subsubsections reproduces subsubsection |
attempt to lower below subsubsections reproduces subsubsection |
699 |
commands." |
commands." |
700 |
|
|
701 |
;; `texinfo-section-types-regexp' is defined in `texnfo-upd.el'; |
;; `texinfo-section-types-regexp' is defined in `texnfo-upd.el'; |
702 |
;; it is a regexp matching chapter, section, other headings |
;; it is a regexp matching chapter, section, other headings |
703 |
;; (but not the top node). |
;; (but not the top node). |
704 |
|
|
705 |
(let (type (level 0)) |
(let (type (level 0)) |
706 |
(while |
(while |
707 |
(re-search-forward |
(re-search-forward |
708 |
(concat |
(concat |
709 |
"\\(\\(^@\\(raise\\|lower\\)sections\\)\\|\\(" |
"\\(\\(^@\\(raise\\|lower\\)sections\\)\\|\\(" |
712 |
nil t) |
nil t) |
713 |
(beginning-of-line) |
(beginning-of-line) |
714 |
(save-excursion (setq type (read (current-buffer)))) |
(save-excursion (setq type (read (current-buffer)))) |
715 |
(cond |
(cond |
716 |
|
|
717 |
;; 1. Increment level |
;; 1. Increment level |
718 |
((eq type '@raisesections) |
((eq type '@raisesections) |
719 |
(setq level (1+ level)) |
(setq level (1+ level)) |
720 |
(delete-region |
(delete-region |
721 |
(point) (save-excursion (forward-line 1) (point)))) |
(point) (save-excursion (forward-line 1) (point)))) |
722 |
|
|
723 |
;; 2. Decrement level |
;; 2. Decrement level |
724 |
((eq type '@lowersections) |
((eq type '@lowersections) |
725 |
(setq level (1- level)) |
(setq level (1- level)) |
726 |
(delete-region |
(delete-region |
727 |
(point) (save-excursion (forward-line 1) (point)))) |
(point) (save-excursion (forward-line 1) (point)))) |
728 |
|
|
729 |
;; Now handle structuring commands |
;; Now handle structuring commands |
730 |
((cond |
((cond |
731 |
|
|
732 |
;; 3. Raise level when positive |
;; 3. Raise level when positive |
733 |
((> level 0) |
((> level 0) |
734 |
(let ((count level) |
(let ((count level) |
739 |
(setq count (1- count))) |
(setq count (1- count))) |
740 |
(kill-word 1) |
(kill-word 1) |
741 |
(insert (symbol-name new-level)))) |
(insert (symbol-name new-level)))) |
742 |
|
|
743 |
;; 4. Do nothing except move point when level is zero |
;; 4. Do nothing except move point when level is zero |
744 |
((= level 0) (forward-line 1)) |
((= level 0) (forward-line 1)) |
745 |
|
|
746 |
;; 5. Lower level when positive |
;; 5. Lower level when positive |
747 |
((< level 0) |
((< level 0) |
748 |
(let ((count level) |
(let ((count level) |
762 |
(@majorheading . @majorheading) |
(@majorheading . @majorheading) |
763 |
(@chapheading . @chapheading) |
(@chapheading . @chapheading) |
764 |
(@appendix . @appendix) |
(@appendix . @appendix) |
765 |
|
|
766 |
(@section . @chapter) |
(@section . @chapter) |
767 |
(@unnumberedsec . @unnumbered) |
(@unnumberedsec . @unnumbered) |
768 |
(@heading . @chapheading) |
(@heading . @chapheading) |
769 |
(@appendixsec . @appendix) |
(@appendixsec . @appendix) |
770 |
|
|
771 |
(@subsection . @section) |
(@subsection . @section) |
772 |
(@unnumberedsubsec . @unnumberedsec) |
(@unnumberedsubsec . @unnumberedsec) |
773 |
(@subheading . @heading) |
(@subheading . @heading) |
774 |
(@appendixsubsec . @appendixsec) |
(@appendixsubsec . @appendixsec) |
775 |
|
|
776 |
(@subsubsection . @subsection) |
(@subsubsection . @subsection) |
777 |
(@unnumberedsubsubsec . @unnumberedsubsec) |
(@unnumberedsubsubsec . @unnumberedsubsec) |
778 |
(@subsubheading . @subheading) |
(@subsubheading . @subheading) |
784 |
higher types.") |
higher types.") |
785 |
|
|
786 |
(defvar texinfo-lowersections-alist |
(defvar texinfo-lowersections-alist |
787 |
'((@chapter . @section) |
'((@chapter . @section) |
788 |
(@unnumbered . @unnumberedsec) |
(@unnumbered . @unnumberedsec) |
789 |
(@centerchap . @unnumberedsec) |
(@centerchap . @unnumberedsec) |
790 |
(@majorheading . @heading) |
(@majorheading . @heading) |
791 |
(@chapheading . @heading) |
(@chapheading . @heading) |
792 |
(@appendix . @appendixsec) |
(@appendix . @appendixsec) |
793 |
|
|
794 |
(@section . @subsection) |
(@section . @subsection) |
795 |
(@unnumberedsec . @unnumberedsubsec) |
(@unnumberedsec . @unnumberedsubsec) |
796 |
(@heading . @subheading) |
(@heading . @subheading) |
797 |
(@appendixsec . @appendixsubsec) |
(@appendixsec . @appendixsubsec) |
798 |
|
|
799 |
(@subsection . @subsubsection) |
(@subsection . @subsubsection) |
800 |
(@unnumberedsubsec . @unnumberedsubsubsec) |
(@unnumberedsubsec . @unnumberedsubsubsec) |
801 |
(@subheading . @subsubheading) |
(@subheading . @subsubheading) |
802 |
(@appendixsubsec . @appendixsubsubsec) |
(@appendixsubsec . @appendixsubsubsec) |
803 |
|
|
804 |
(@subsubsection . @subsubsection) ; Cannot go lower. |
(@subsubsection . @subsubsection) ; Cannot go lower. |
805 |
(@unnumberedsubsubsec . @unnumberedsubsubsec) |
(@unnumberedsubsubsec . @unnumberedsubsubsec) |
806 |
(@subsubheading . @subsubheading) |
(@subsubheading . @subsubheading) |
817 |
|
|
818 |
(defun texinfo-format-scan () |
(defun texinfo-format-scan () |
819 |
(texinfo-format-convert (point-min) (point-max)) |
(texinfo-format-convert (point-min) (point-max)) |
820 |
;; Scan for @-commands. |
;; Search for @copying, which has to be first since the |
821 |
|
;; @insertcopying command then inserts the text elsewhere. |
822 |
|
(goto-char (point-min)) |
823 |
|
(when (search-forward "@copying" nil t) |
824 |
|
(texinfo-copying)) |
825 |
|
(while (search-forward "@insertcopying" nil t) |
826 |
|
(delete-region (match-beginning 0) (match-end 0)) |
827 |
|
|
828 |
|
(texinfo-insertcopying)) |
829 |
|
;; Scan for other @-commands. |
830 |
(goto-char (point-min)) |
(goto-char (point-min)) |
831 |
(while (search-forward "@" nil t) |
(while (search-forward "@" nil t) |
832 |
;; |
;; |
833 |
;; These are the single-character accent commands: @^ @` @' @" @= @~ |
;; These are the single-character accent commands: @^ @` @' @" @= @~ |
834 |
;; In Info, they are simply quoted and the @ deleted. |
;; In Info, they are simply quoted and the @ deleted. |
835 |
;; Other single-character commands: |
;; Other single-character commands: |
836 |
;; @* forces a line break, |
;; @* forces a line break, |
837 |
;; @- is a discretionary hyphenation point; does nothing in Info. |
;; @- is a discretionary hyphenation point; does nothing in Info. |
838 |
;; @<space>, @<tab>, @<newline> each produce a single space, |
;; @<space>, @<tab>, @<newline> each produce a single space, |
839 |
;; unless followed by a newline. |
;; unless followed by a newline. |
840 |
;; |
;; |
841 |
;; Old version 2.34 expression: (looking-at "[@{}^'` *\"?!]") |
;; Old version 2.34 expression: (looking-at "[@{}^'` *\"?!]") |
842 |
(if (looking-at "[@{}^'`\"=~ \t\n*?!-]") |
(if (looking-at "[@{}^'`\"=~ \t\n*?!-]") |
843 |
;; @*, causes a line break. |
;; @*, causes a line break. |
844 |
(cond |
(cond |
845 |
;; @*, a line break |
;; @*, a line break |
846 |
((= (following-char) ?*) |
((= (following-char) ?*) |
847 |
;; remove command |
;; remove command |
849 |
;; insert return if not at end of line; |
;; insert return if not at end of line; |
850 |
;; else line is already broken. |
;; else line is already broken. |
851 |
(if (not (= (following-char) ?\n)) |
(if (not (= (following-char) ?\n)) |
852 |
(insert ?\n))) |
(insert ?\n))) |
853 |
;; @-, deleted |
;; @-, deleted |
854 |
((= (following-char) ?-) |
((= (following-char) ?-) |
855 |
(delete-region (1- (point)) (1+ (point)))) |
(delete-region (1- (point)) (1+ (point)))) |
860 |
;; insert single space if not at end of line; |
;; insert single space if not at end of line; |
861 |
;; else line is already broken. |
;; else line is already broken. |
862 |
(if (not (= (following-char) ?\n)) |
(if (not (= (following-char) ?\n)) |
863 |
(insert ? ))) |
(insert ? ))) |
864 |
((= (following-char) ?\t) |
((= (following-char) ?\t) |
865 |
(delete-region (1- (point)) (1+ (point))) |
(delete-region (1- (point)) (1+ (point))) |
866 |
;; insert single space if not at end of line; |
;; insert single space if not at end of line; |
909 |
;; Handle let aliasing |
;; Handle let aliasing |
910 |
(setq texinfo-command-name |
(setq texinfo-command-name |
911 |
(let (trial |
(let (trial |
912 |
(cmdname |
(cmdname |
913 |
(buffer-substring |
(buffer-substring-no-properties |
914 |
(1+ texinfo-command-start) texinfo-command-end))) |
(1+ texinfo-command-start) texinfo-command-end))) |
915 |
(while (setq trial (assoc cmdname texinfo-alias-list)) |
(while (setq trial (assoc cmdname texinfo-alias-list)) |
916 |
(setq cmdname (cdr trial))) |
(setq cmdname (cdr trial))) |
923 |
(if enclosure-type |
(if enclosure-type |
924 |
(progn |
(progn |
925 |
(insert |
(insert |
926 |
(car (car (cdr enclosure-type))) |
(car (car (cdr enclosure-type))) |
927 |
(texinfo-parse-arg-discard) |
(texinfo-parse-arg-discard) |
928 |
(car (cdr (car (cdr enclosure-type))))) |
(car (cdr (car (cdr enclosure-type))))) |
929 |
(goto-char texinfo-command-start)) |
(goto-char texinfo-command-start)) |
930 |
(let ((cmd (get texinfo-command-name 'texinfo-format))) |
(let ((cmd (get texinfo-command-name 'texinfo-format))) |
931 |
(if cmd (funcall cmd) (texinfo-unsupported))))))) |
(if cmd (funcall cmd) (texinfo-unsupported))))))) |
932 |
|
|
933 |
(cond (texinfo-stack |
(cond (texinfo-stack |
934 |
(goto-char (nth 2 (car texinfo-stack))) |
(goto-char (nth 2 (car texinfo-stack))) |
935 |
(error "Unterminated @%s" (car (car texinfo-stack)))))) |
(error "Unterminated @%s" (car (car texinfo-stack))))) |
936 |
|
|
937 |
|
;; Remove excess whitespace |
938 |
|
(whitespace-cleanup)) |
939 |
|
|
940 |
|
(defvar texinfo-copying-text "" |
941 |
|
"Text of the copyright notice and copying permissions.") |
942 |
|
|
943 |
|
(defun texinfo-copying () |
944 |
|
"Copy the copyright notice and copying permissions from the Texinfo file, |
945 |
|
as indicated by the @copying ... @end copying command; |
946 |
|
insert the text with the @insertcopying command." |
947 |
|
(let ((beg (progn (beginning-of-line) (point))) |
948 |
|
(end (progn (re-search-forward "^@end copying[ \t]*\n") (point)))) |
949 |
|
(setq texinfo-copying-text |
950 |
|
(buffer-substring-no-properties |
951 |
|
(save-excursion (goto-char beg) (forward-line 1) (point)) |
952 |
|
(save-excursion (goto-char end) (forward-line -1) (point)))) |
953 |
|
(delete-region beg end))) |
954 |
|
|
955 |
|
(defun texinfo-insertcopying () |
956 |
|
"Insert the copyright notice and copying permissions from the Texinfo file, |
957 |
|
which are indicated by the @copying ... @end copying command." |
958 |
|
(insert (concat "\n" texinfo-copying-text))) |
959 |
|
|
960 |
(put 'begin 'texinfo-format 'texinfo-format-begin) |
(put 'begin 'texinfo-format 'texinfo-format-begin) |
961 |
(defun texinfo-format-begin () |
(defun texinfo-format-begin () |
975 |
|
|
976 |
(defun texinfo-parse-line-arg () |
(defun texinfo-parse-line-arg () |
977 |
"Return argument of @-command as string. |
"Return argument of @-command as string. |
978 |
Argument is separated from command either by a space or by a brace. |
Argument is separated from command either by a space or by a brace. |
979 |
If a space, return rest of line, with beginning and ending white |
If a space, return rest of line, with beginning and ending white |
980 |
space removed. If a brace, return string between braces. |
space removed. If a brace, return string between braces. |
981 |
Leave point after argument." |
Leave point after argument." |
995 |
(forward-char -1)) |
(forward-char -1)) |
996 |
(t |
(t |
997 |
(error "Invalid texinfo command arg format"))) |
(error "Invalid texinfo command arg format"))) |
998 |
(prog1 (buffer-substring start (point)) |
(prog1 (buffer-substring-no-properties start (point)) |
999 |
(if (eolp) (forward-char 1))))) |
(if (eolp) (forward-char 1))))) |
1000 |
|
|
1001 |
(defun texinfo-parse-expanded-arg () |
(defun texinfo-parse-expanded-arg () |
1018 |
(texinfo-format-expand-region start (point)) |
(texinfo-format-expand-region start (point)) |
1019 |
(setq texinfo-command-end (marker-position marker)) |
(setq texinfo-command-end (marker-position marker)) |
1020 |
(move-marker marker nil) |
(move-marker marker nil) |
1021 |
(prog1 (buffer-substring start (point)) |
(prog1 (buffer-substring-no-properties start (point)) |
1022 |
(if (eolp) (forward-char 1))))) |
(if (eolp) (forward-char 1))))) |
1023 |
|
|
1024 |
(defun texinfo-format-expand-region (start end) |
(defun texinfo-format-expand-region (start end) |
1065 |
(forward-char -1) |
(forward-char -1) |
1066 |
(skip-chars-backward " ") |
(skip-chars-backward " ") |
1067 |
(setq end (point)) |
(setq end (point)) |
1068 |
(setq args (cons (if (> end beg) (buffer-substring beg end)) |
(setq args (cons (if (> end beg) (buffer-substring-no-properties beg end)) |
1069 |
args)) |
args)) |
1070 |
(goto-char next) |
(goto-char next) |
1071 |
(skip-chars-forward " ")) |
(skip-chars-forward " ")) |
1079 |
args) |
args) |
1080 |
(search-forward "{") |
(search-forward "{") |
1081 |
(save-excursion |
(save-excursion |
1082 |
(texinfo-format-expand-region |
(texinfo-format-expand-region |
1083 |
(point) |
(point) |
1084 |
(save-excursion (up-list 1) (1- (point))))) |
(save-excursion (up-list 1) (1- (point))))) |
1085 |
;; The following does not handle cross references of the form: |
;; The following does not handle cross references of the form: |
1086 |
;; `@xref{bullet, , @code{@@bullet}@{@}}.' because the |
;; `@xref{bullet, , @code{@@bullet}@{@}}.' because the |
1087 |
;; re-search-forward finds the first right brace after the second |
;; re-search-forward finds the first right brace after the second |
1088 |
;; comma. |
;; comma. |
1089 |
(while (/= (preceding-char) ?\}) |
(while (/= (preceding-char) ?\}) |
1090 |
(skip-chars-forward " \t\n") |
(skip-chars-forward " \t\n") |
1091 |
(setq beg (point)) |
(setq beg (point)) |
1098 |
(goto-char beg) |
(goto-char beg) |
1099 |
(while (search-forward "\n" end t) |
(while (search-forward "\n" end t) |
1100 |
(replace-match " ")))) |
(replace-match " ")))) |
1101 |
(setq args (cons (if (> end beg) (buffer-substring beg end)) |
(setq args (cons (if (> end beg) (buffer-substring-no-properties beg end)) |
1102 |
args)) |
args)) |
1103 |
(goto-char next)) |
(goto-char next)) |
1104 |
;;(if (eolp) (forward-char 1)) |
;;(if (eolp) (forward-char 1)) |
1128 |
(re-search-forward "[\n ]") |
(re-search-forward "[\n ]") |
1129 |
(forward-char -1) |
(forward-char -1) |
1130 |
(setq end (point)))) |
(setq end (point)))) |
1131 |
(setq args (cons (buffer-substring beg end) args)) |
(setq args (cons (buffer-substring-no-properties beg end) args)) |
1132 |
(skip-chars-forward " ")) |
(skip-chars-forward " ")) |
1133 |
(forward-char 1) |
(forward-char 1) |
1134 |
(nreverse args)))) |
(nreverse args)))) |
1152 |
|
|
1153 |
;; Only `texinfo-format-buffer' handles @setfilename with this |
;; Only `texinfo-format-buffer' handles @setfilename with this |
1154 |
;; definition; `texinfo-format-region' handles @setfilename, if any, |
;; definition; `texinfo-format-region' handles @setfilename, if any, |
1155 |
;; specially. |
;; specially. |
1156 |
(put 'setfilename 'texinfo-format 'texinfo-format-setfilename) |
(put 'setfilename 'texinfo-format 'texinfo-format-setfilename) |
1157 |
(defun texinfo-format-setfilename () |
(defun texinfo-format-setfilename () |
1158 |
(texinfo-parse-arg-discard)) |
(texinfo-parse-arg-discard)) |
1188 |
|
|
1189 |
(put 'anchor 'texinfo-format 'texinfo-anchor) |
(put 'anchor 'texinfo-format 'texinfo-anchor) |
1190 |
(defun texinfo-anchor () |
(defun texinfo-anchor () |
1191 |
(let (anchor-string |
(let (anchor-string |
1192 |
(here (- (point) 7)) ; save location of beginning of `@anchor' |
(here (- (point) 7)) ; save location of beginning of `@anchor' |
1193 |
(arg (texinfo-parse-arg-discard))) |
(arg (texinfo-parse-arg-discard))) |
1194 |
(if (looking-at " ") ; since a space may be left after -discard |
(if (looking-at " ") ; since a space may be left after -discard |
1195 |
(delete-char 1)) |
(delete-char 1)) |
1196 |
(forward-paragraph) |
(forward-paragraph) |
1197 |
(let ((end (point))) |
(let ((end (point))) |
1198 |
(if (save-excursion |
(if (save-excursion |
1199 |
(backward-word 1) |
(backward-word 1) |
1200 |
(search-forward "@refill" end t)) |
(search-forward "@refill" end t)) |
1201 |
(setq anchor-string "@anchor-yes-refill") |
(setq anchor-string "@anchor-yes-refill") |
1213 |
;; The @detailmenu should be removed eventually. |
;; The @detailmenu should be removed eventually. |
1214 |
|
|
1215 |
;; According to Karl Berry, 31 August 1996: |
;; According to Karl Berry, 31 August 1996: |
1216 |
;; |
;; |
1217 |
;; You don't like, I don't like it. I agree, it would be better just to |
;; You don't like, I don't like it. I agree, it would be better just to |
1218 |
;; fix the bug [in `makeinfo']. .. At this point, since inserting those |
;; fix the bug [in `makeinfo']. .. At this point, since inserting those |
1219 |
;; two commands in the Elisp fn is trivial, I don't especially want to |
;; two commands in the Elisp fn is trivial, I don't especially want to |
1220 |
;; expend more effort... |
;; expend more effort... |
1221 |
;; |
;; |
1222 |
;; I added a couple sentences of documentation to the manual (putting the |
;; I added a couple sentences of documentation to the manual (putting the |
1223 |
;; blame on makeinfo where it belongs :-(). |
;; blame on makeinfo where it belongs :-(). |
1224 |
|
|
1284 |
|
|
1285 |
;;; URL Reference: @uref |
;;; URL Reference: @uref |
1286 |
|
|
1287 |
;; @uref produces a reference to a uniform resource locator (URL). |
;; @uref produces a reference to a uniform resource locator (URL). |
1288 |
;; It takes one mandatory argument, the URL, and one optional argument, |
;; It takes one mandatory argument, the URL, and one optional argument, |
1289 |
;; the text to display (the default is the URL itself). |
;; the text to display (the default is the URL itself). |
1290 |
|
|
1291 |
(put 'uref 'texinfo-format 'texinfo-format-uref) |
(put 'uref 'texinfo-format 'texinfo-format-uref) |
1292 |
(defun texinfo-format-uref () |
(defun texinfo-format-uref () |
1293 |
"Format URL and optional URL-TITLE. |
"Format URL and optional URL-TITLE. |
1294 |
Insert ` ... ' around URL if no URL-TITLE argument; |
Insert ` ... ' around URL if no URL-TITLE argument; |
1295 |
otherwise, insert URL-TITLE followed by URL in parentheses." |
otherwise, insert URL-TITLE followed by URL in parentheses." |
1296 |
(let ((args (texinfo-format-parse-args))) |
(let ((args (texinfo-format-parse-args))) |
1297 |
(texinfo-discard-command) |
(texinfo-discard-command) |
1298 |
;; if url-title |
;; if url-title |
1299 |
(if (nth 1 args) |
(if (nth 1 args) |
1300 |
(insert (nth 1 args) " (" (nth 0 args) ")") |
(insert (nth 1 args) " (" (nth 0 args) ")") |
1301 |
(insert "`" (nth 0 args) "'")) |
(insert "`" (nth 0 args) "'")) |
1383 |
(texinfo-discard-command)) |
(texinfo-discard-command)) |
1384 |
|
|
1385 |
|
|
1386 |
|
;;; @kbdinputstyle, @vskip, headings & footings |
1387 |
|
;; These commands for not for Info and should never |
1388 |
|
;; appear in an Info environment; but if they do, |
1389 |
|
;; this causes them to be discarded. |
1390 |
|
|
1391 |
|
;; @kbdinputstyle |
1392 |
|
(put 'kbdinputstyle 'texinfo-format 'texinfo-discard-line-with-args) |
1393 |
|
|
1394 |
|
;; @vskip |
1395 |
|
(put 'vskip 'texinfo-format 'texinfo-discard-line-with-args) |
1396 |
|
|
1397 |
|
;; headings & footings |
1398 |
|
(put 'evenfooting 'texinfo-format 'texinfo-discard-line-with-args) |
1399 |
|
(put 'evenheading 'texinfo-format 'texinfo-discard-line-with-args) |
1400 |
|
(put 'oddfooting 'texinfo-format 'texinfo-discard-line-with-args) |
1401 |
|
(put 'oddheading 'texinfo-format 'texinfo-discard-line-with-args) |
1402 |
|
(put 'everyfooting 'texinfo-format 'texinfo-discard-line-with-args) |
1403 |
|
(put 'everyheading 'texinfo-format 'texinfo-discard-line-with-args) |
1404 |
|
|
1405 |
|
|
1406 |
|
;;; @documentdescription ... @end documentdescription |
1407 |
|
;; This command is for HTML output and should never |
1408 |
|
;; appear in an Info environment; but if it does, |
1409 |
|
;; this causes it to be discarded. |
1410 |
|
|
1411 |
|
(put 'documentdescription 'texinfo-format 'texinfo-format-documentdescription) |
1412 |
|
(defun texinfo-format-documentdescription () |
1413 |
|
(delete-region texinfo-command-start |
1414 |
|
(progn (re-search-forward "^@end documentdescription[ \t]*\n") |
1415 |
|
(point)))) |
1416 |
|
|
1417 |
|
|
1418 |
|
|
1419 |
;;; @center, @sp, and @br |
;;; @center, @sp, and @br |
1420 |
|
|
1421 |
(put 'center 'texinfo-format 'texinfo-format-center) |
(put 'center 'texinfo-format 'texinfo-format-center) |
1453 |
;; This command is followed immediately by a left brace, then by the text of |
;; This command is followed immediately by a left brace, then by the text of |
1454 |
;; the footnote, and then by a terminating right brace. The |
;; the footnote, and then by a terminating right brace. The |
1455 |
;; template for a footnote is: |
;; template for a footnote is: |
1456 |
;; |
;; |
1457 |
;; @footnote{TEXT} |
;; @footnote{TEXT} |
1458 |
;; |
;; |
1459 |
;; Info has two footnote styles: |
;; Info has two footnote styles: |
1460 |
;; |
;; |
1461 |
;; * In the End of node style, all the footnotes for a single node |
;; * In the End of node style, all the footnotes for a single node |
1462 |
;; are placed at the end of that node. The footnotes are |
;; are placed at the end of that node. The footnotes are |
1463 |
;; separated from the rest of the node by a line of dashes with |
;; separated from the rest of the node by a line of dashes with |
1464 |
;; the word `Footnotes' within it. |
;; the word `Footnotes' within it. |
1465 |
;; |
;; |
1466 |
;; * In the Separate node style, all the footnotes for a single node |
;; * In the Separate node style, all the footnotes for a single node |
1467 |
;; are placed in an automatically constructed node of their own. |
;; are placed in an automatically constructed node of their own. |
1468 |
|
|
1470 |
;; @footnotestyle separate |
;; @footnotestyle separate |
1471 |
;; or |
;; or |
1472 |
;; @footnotestyle end |
;; @footnotestyle end |
1473 |
;; |
;; |
1474 |
;; The default is separate |
;; The default is separate |
1475 |
|
|
1476 |
(defvar texinfo-footnote-style "separate" |
(defvar texinfo-footnote-style "separate" |
1477 |
"Footnote style, either separate or end.") |
"Footnote style, either separate or end.") |
1478 |
|
|
1479 |
(put 'footnotestyle 'texinfo-format 'texinfo-footnotestyle) |
(put 'footnotestyle 'texinfo-format 'texinfo-footnotestyle) |
1506 |
(match-end 0))) |
(match-end 0))) |
1507 |
(node-name |
(node-name |
1508 |
(save-excursion |
(save-excursion |
1509 |
(buffer-substring |
(buffer-substring-no-properties |
1510 |
(progn (goto-char node-name-beginning) ; skip over node command |
(progn (goto-char node-name-beginning) ; skip over node command |
1511 |
(skip-chars-forward " \t") ; and over spaces |
(skip-chars-forward " \t") ; and over spaces |
1512 |
(point)) |
(point)) |
1526 |
(forward-line -1)) |
(forward-line -1)) |
1527 |
|
|
1528 |
;; two cases: for the first footnote, we must insert a node header; |
;; two cases: for the first footnote, we must insert a node header; |
1529 |
;; for the second and subsequent footnotes, we need only insert |
;; for the second and subsequent footnotes, we need only insert |
1530 |
;; the text of the footnote. |
;; the text of the footnote. |
1531 |
|
|
1532 |
(if (save-excursion |
(if (save-excursion |
1533 |
(re-search-backward |
(search-backward |
1534 |
(concat node-name "-Footnotes, Up: ") |
(concat node-name "-Footnotes, Up: ") |
1535 |
node-name-beginning |
node-name-beginning |
1536 |
t)) |
t)) |
1623 |
(put 'enumerate 'texinfo-format 'texinfo-enumerate) |
(put 'enumerate 'texinfo-format 'texinfo-enumerate) |
1624 |
(defun texinfo-enumerate () |
(defun texinfo-enumerate () |
1625 |
(texinfo-push-stack |
(texinfo-push-stack |
1626 |
'enumerate |
'enumerate |
1627 |
(progn (skip-chars-forward " \t") |
(progn (skip-chars-forward " \t") |
1628 |
(if (eolp) |
(if (eolp) |
1629 |
1 |
1 |
1723 |
(setcar (cdr (car texinfo-stack)) |
(setcar (cdr (car texinfo-stack)) |
1724 |
(make-symbol |
(make-symbol |
1725 |
(char-to-string |
(char-to-string |
1726 |
(1+ |
(1+ |
1727 |
(string-to-char enumerating-symbol)))))) |
(string-to-char enumerating-symbol)))))) |
1728 |
(t |
(t |
1729 |
(error |
(error |
1757 |
|
|
1758 |
(put 'table 'texinfo-format 'texinfo-table) |
(put 'table 'texinfo-format 'texinfo-table) |
1759 |
(defun texinfo-table () |
(defun texinfo-table () |
1760 |
(texinfo-push-stack |
(texinfo-push-stack |
1761 |
'table |
'table |
1762 |
(progn (skip-chars-forward " \t") |
(progn (skip-chars-forward " \t") |
1763 |
(if (eolp) |
(if (eolp) |
1764 |
"@asis" |
"@asis" |
1872 |
;; |
;; |
1873 |
;; Long lines of text are filled within columns. |
;; Long lines of text are filled within columns. |
1874 |
;; |
;; |
1875 |
;; Using the Emacs Lisp formatter, texinfmt.el, |
;; Using the Emacs Lisp formatter, texinfmt.el, |
1876 |
;; the whitespace between columns can be increased by setting |
;; the whitespace between columns can be increased by setting |
1877 |
;; `texinfo-extra-inter-column-width' to a value greater than 0. By default, |
;; `texinfo-extra-inter-column-width' to a value greater than 0. By default, |
1878 |
;; there is at least one blank space between columns. |
;; there is at least one blank space between columns. |
1879 |
;; |
;; |
1880 |
;; The Emacs Lisp formatter, texinfmt.el, ignores the following four |
;; The Emacs Lisp formatter, texinfmt.el, ignores the following four |
1881 |
;; commands that are defined in texinfo.tex for printed output. |
;; commands that are defined in texinfo.tex for printed output. |
1882 |
;; |
;; |
1883 |
;; @multitableparskip, |
;; @multitableparskip, |
1884 |
;; @multitableparindent, |
;; @multitableparindent, |
1885 |
;; @multitablecolmargin, |
;; @multitablecolmargin, |
1887 |
|
|
1888 |
;; How @multitable works. |
;; How @multitable works. |
1889 |
;; ===================== |
;; ===================== |
1890 |
;; |
;; |
1891 |
;; `texinfo-multitable' reads the @multitable line and determines from it |
;; `texinfo-multitable' reads the @multitable line and determines from it |
1892 |
;; how wide each column should be. |
;; how wide each column should be. |
1893 |
;; |
;; |
1894 |
;; Also, it pushes this information, along with an identifying symbol, |
;; Also, it pushes this information, along with an identifying symbol, |
1895 |
;; onto the `texinfo-stack'. At the @end multitable command, the stack |
;; onto the `texinfo-stack'. At the @end multitable command, the stack |
1896 |
;; is checked for its matching @multitable command, and then popped, or |
;; is checked for its matching @multitable command, and then popped, or |
1897 |
;; else an error is signaled. Also, this command pushes the location of |
;; else an error is signaled. Also, this command pushes the location of |
1898 |
;; the start of the table onto the stack. |
;; the start of the table onto the stack. |
1899 |
;; |
;; |
1900 |
;; `texinfo-end-multitable' checks the `texinfo-stack' that the @end |
;; `texinfo-end-multitable' checks the `texinfo-stack' that the @end |
1901 |
;; multitable truly is ending a corresponding beginning, and if it is, |
;; multitable truly is ending a corresponding beginning, and if it is, |
1902 |
;; pops the stack. |
;; pops the stack. |
1903 |
;; |
;; |
1904 |
;; `texinfo-multitable-widths' is called by `texinfo-multitable'. |
;; `texinfo-multitable-widths' is called by `texinfo-multitable'. |
1905 |
;; The function returns a list of the widths of each column in a |
;; The function returns a list of the widths of each column in a |
1906 |
;; multi-column table, based on the information supplied by the arguments |
;; multi-column table, based on the information supplied by the arguments |
1907 |
;; to the @multitable command (by arguments, I mean the text on the rest |
;; to the @multitable command (by arguments, I mean the text on the rest |
1908 |
;; of the @multitable line, not the remainder of the multi-column table |
;; of the @multitable line, not the remainder of the multi-column table |
1909 |
;; environment). |
;; environment). |
1910 |
;; |
;; |
1911 |
;; `texinfo-multitable-item' formats a row within a multicolumn table. |
;; `texinfo-multitable-item' formats a row within a multicolumn table. |
1912 |
;; This command is executed when texinfmt sees @item inside @multitable. |
;; This command is executed when texinfmt sees @item inside @multitable. |
1913 |
;; Cells in row are separated by `@tab's. Widths of cells are specified |
;; Cells in row are separated by `@tab's. Widths of cells are specified |
1914 |
;; by the arguments in the @multitable line. Cells are filled. All cells |
;; by the arguments in the @multitable line. Cells are filled. All cells |
1915 |
;; are made to be the same height by padding their bottoms, as needed, |
;; are made to be the same height by padding their bottoms, as needed, |
1916 |
;; with blanks. |
;; with blanks. |
1917 |
;; |
;; |
1918 |
;; `texinfo-multitable-extract-row' is called by `texinfo-multitable-item'. |
;; `texinfo-multitable-extract-row' is called by `texinfo-multitable-item'. |
1919 |
;; This function returns the text in a multitable row, as a string. |
;; This function returns the text in a multitable row, as a string. |
1920 |
;; The start of a row is marked by an @item and the end of row is the |
;; The start of a row is marked by an @item and the end of row is the |
1921 |
;; beginning of next @item or beginning of the @end multitable line. |
;; beginning of next @item or beginning of the @end multitable line. |
1922 |
;; Cells within a row are separated by @tab. |
;; Cells within a row are separated by @tab. |
1923 |
;; |
;; |
1924 |
;; Note that @tab, the cell separators, are not treated as independent |
;; Note that @tab, the cell separators, are not treated as independent |
1925 |
;; Texinfo commands. |
;; Texinfo commands. |
1926 |
|
|
1964 |
|
|
1965 |
Long lines of text are filled within columns. |
Long lines of text are filled within columns. |
1966 |
|
|
1967 |
Using the Emacs Lisp formatter, texinfmt.el, |
Using the Emacs Lisp formatter, texinfmt.el, |
1968 |
the whitespace between columns can be increased by setting |
the whitespace between columns can be increased by setting |
1969 |
`texinfo-extra-inter-column-width' to a value greater than 0. By default, |
`texinfo-extra-inter-column-width' to a value greater than 0. By default, |
1970 |
there is at least one blank space between columns. |
there is at least one blank space between columns. |
2006 |
;; @multitable {Column 1 template} {Column 2} {Column 3 example} |
;; @multitable {Column 1 template} {Column 2} {Column 3 example} |
2007 |
;; Place point before first argument |
;; Place point before first argument |
2008 |
(skip-chars-forward " \t") |
(skip-chars-forward " \t") |
2009 |
(cond |
(cond |
2010 |
;; Check for common misspelling |
;; Check for common misspelling |
2011 |
((looking-at "@columnfraction ") |
((looking-at "@columnfraction ") |
2012 |
(error "In @multitable, @columnfractions misspelled")) |
(error "In @multitable, @columnfractions misspelled")) |
2079 |
(skip-chars-backward " ") |
(skip-chars-backward " ") |
2080 |
;; remove whitespace at end of argument |
;; remove whitespace at end of argument |
2081 |
(delete-region (point) end) |
(delete-region (point) end) |
2082 |
(buffer-substring start (point))))) |
(buffer-substring-no-properties start (point))))) |
2083 |
(delete-region texinfo-command-start end) |
(delete-region texinfo-command-start end) |
2084 |
row)) |
row)) |
2085 |
|
|
2137 |
(goto-char (point-max)) |
(goto-char (point-max)) |
2138 |
(skip-chars-backward " ") |
(skip-chars-backward " ") |
2139 |
(delete-region (point) (save-excursion (end-of-line) (point))) |
(delete-region (point) (save-excursion (end-of-line) (point))) |
2140 |
;; Temorarily set texinfo-stack to nil so texinfo-format-scan |
;; Temporarily set texinfo-stack to nil so texinfo-format-scan |
2141 |
;; does not see an unterminated @multitable. |
;; does not see an unterminated @multitable. |
2142 |
(let (texinfo-stack) ; nil |
(let (texinfo-stack) ; nil |
2143 |
(texinfo-format-scan)) |
(texinfo-format-scan)) |
2192 |
(setq fill-column existing-fill-column))) |
(setq fill-column existing-fill-column))) |
2193 |
|
|
2194 |
|
|
2195 |
;;; @ifinfo, @iftex, @tex, @ifhtml, @html, @ifnottex, @ifnotinfo, @ifnothtml |
;;; @image |
2196 |
|
;; Use only the FILENAME argument to the command. |
2197 |
|
;; In Info, ignore the other arguments. |
2198 |
|
|
2199 |
|
(put 'image 'texinfo-format 'texinfo-format-image) |
2200 |
|
(defun texinfo-format-image () |
2201 |
|
"Insert an image from an an file ending in .txt. |
2202 |
|
Use only the FILENAME arg; for Info, ignore the other arguments to @image." |
2203 |
|
(let ((args (texinfo-format-parse-args)) |
2204 |
|
filename) |
2205 |
|
(when (null (nth 0 args)) |
2206 |
|
(error "Invalid image command")) |
2207 |
|
(texinfo-discard-command) |
2208 |
|
;; makeinfo uses FILENAME.txt |
2209 |
|
(setq filename (format "%s.txt" (nth 0 args))) |
2210 |
|
(message "Reading included file: %s" filename) |
2211 |
|
;; verbatim for Info output |
2212 |
|
(goto-char (+ (point) (cadr (insert-file-contents filename)))) |
2213 |
|
(message "Reading included file: %s...done" filename))) |
2214 |
|
|
2215 |
|
|
2216 |
|
;;; @ifinfo, @iftex, @tex, @ifhtml, @html, @ifplaintext, @ifxml, @xml |
2217 |
|
;; @ifnottex, @ifnotinfo, @ifnothtml, @ifnotplaintext, @ifnotxml |
2218 |
|
|
2219 |
(put 'ifinfo 'texinfo-format 'texinfo-discard-line) |
(put 'ifinfo 'texinfo-format 'texinfo-discard-line) |
2220 |
(put 'ifinfo 'texinfo-end 'texinfo-discard-command) |
(put 'ifinfo 'texinfo-end 'texinfo-discard-command) |
2222 |
(put 'iftex 'texinfo-format 'texinfo-format-iftex) |
(put 'iftex 'texinfo-format 'texinfo-format-iftex) |
2223 |
(defun texinfo-format-iftex () |
(defun texinfo-format-iftex () |
2224 |
(delete-region texinfo-command-start |
(delete-region texinfo-command-start |
2225 |
(progn (re-search-forward "@end iftex[ \t]*\n") |
(re-search-forward "@end iftex[ \t]*\n"))) |
|
(point)))) |
|
2226 |
|
|
2227 |
(put 'ifhtml 'texinfo-format 'texinfo-format-ifhtml) |
(put 'ifhtml 'texinfo-format 'texinfo-format-ifhtml) |
2228 |
(defun texinfo-format-ifhtml () |
(defun texinfo-format-ifhtml () |
2229 |
(delete-region texinfo-command-start |
(delete-region texinfo-command-start |
2230 |
(progn (re-search-forward "@end ifhtml[ \t]*\n") |
(re-search-forward "@end ifhtml[ \t]*\n"))) |
2231 |
|
|
2232 |
|
(put 'ifplaintext 'texinfo-format 'texinfo-format-ifplaintext) |
2233 |
|
(defun texinfo-format-ifplaintext () |
2234 |
|
(delete-region texinfo-command-start |
2235 |
|
(re-search-forward "@end ifplaintext[ \t]*\n"))) |
2236 |
|
|
2237 |
|
(put 'ifxml 'texinfo-format 'texinfo-format-ifxml) |
2238 |
|
(defun texinfo-format-ifxml () |
2239 |
|
(delete-region texinfo-command-start |
2240 |
|
(progn (re-search-forward "^@end ifxml[ \t]*\n") |
2241 |
(point)))) |
(point)))) |
2242 |
|
|
2243 |
(put 'tex 'texinfo-format 'texinfo-format-tex) |
(put 'tex 'texinfo-format 'texinfo-format-tex) |
2244 |
(defun texinfo-format-tex () |
(defun texinfo-format-tex () |
2245 |
(delete-region texinfo-command-start |
(delete-region texinfo-command-start |
2246 |
(progn (re-search-forward "@end tex[ \t]*\n") |
(re-search-forward "@end tex[ \t]*\n"))) |
|
(point)))) |
|
2247 |
|
|
2248 |
(put 'html 'texinfo-format 'texinfo-format-html) |
(put 'html 'texinfo-format 'texinfo-format-html) |
2249 |
(defun texinfo-format-html () |
(defun texinfo-format-html () |
2250 |
(delete-region texinfo-command-start |
(delete-region texinfo-command-start |
2251 |
(progn (re-search-forward "@end html[ \t]*\n") |
(re-search-forward "@end html[ \t]*\n"))) |
2252 |
|
|
2253 |
|
(put 'xml 'texinfo-format 'texinfo-format-xml) |
2254 |
|
(defun texinfo-format-xml () |
2255 |
|
(delete-region texinfo-command-start |
2256 |
|
(progn (re-search-forward "^@end xml[ \t]*\n") |
2257 |
(point)))) |
(point)))) |
2258 |
|
|
2259 |
(put 'ifnotinfo 'texinfo-format 'texinfo-format-ifnotinfo) |
(put 'ifnotinfo 'texinfo-format 'texinfo-format-ifnotinfo) |
2260 |
(defun texinfo-format-ifnotinfo () |
(defun texinfo-format-ifnotinfo () |
2261 |
(delete-region texinfo-command-start |
(delete-region texinfo-command-start |
2262 |
(progn (re-search-forward "@end ifnotinfo[ \t]*\n") |
(re-search-forward "@end ifnotinfo[ \t]*\n"))) |
2263 |
(point)))) |
|
2264 |
|
(put 'ifnotplaintext 'texinfo-format 'texinfo-discard-line) |
2265 |
|
(put 'ifnotplaintext 'texinfo-end 'texinfo-discard-command) |
2266 |
|
|
2267 |
(put 'ifnottex 'texinfo-format 'texinfo-discard-line) |
(put 'ifnottex 'texinfo-format 'texinfo-discard-line) |
2268 |
(put 'ifnottex 'texinfo-end 'texinfo-discard-command) |
(put 'ifnottex 'texinfo-end 'texinfo-discard-command) |
2270 |
(put 'ifnothtml 'texinfo-format 'texinfo-discard-line) |
(put 'ifnothtml 'texinfo-format 'texinfo-discard-line) |
2271 |
(put 'ifnothtml 'texinfo-end 'texinfo-discard-command) |
(put 'ifnothtml 'texinfo-end 'texinfo-discard-command) |
2272 |
|
|
2273 |
|
(put 'ifnotxml 'texinfo-format 'texinfo-discard-line) |
2274 |
|
(put 'ifnotxml 'texinfo-end 'texinfo-discard-command) |
2275 |
|
|
2276 |
|
|
2277 |
;;; @titlepage |
;;; @titlepage |
2278 |
|
|
2279 |
(put 'titlepage 'texinfo-format 'texinfo-format-titlepage) |
(put 'titlepage 'texinfo-format 'texinfo-format-titlepage) |
2280 |
(defun texinfo-format-titlepage () |
(defun texinfo-format-titlepage () |
2281 |
(delete-region texinfo-command-start |
(delete-region texinfo-command-start |
2282 |
(progn (re-search-forward "@end titlepage[ \t]*\n") |
(re-search-forward "@end titlepage[ \t]*\n"))) |
|
(point)))) |
|
2283 |
|
|
2284 |
(put 'endtitlepage 'texinfo-format 'texinfo-discard-line) |
(put 'endtitlepage 'texinfo-format 'texinfo-discard-line) |
2285 |
|
|
2288 |
(put 'titlespec 'texinfo-format 'texinfo-format-titlespec) |
(put 'titlespec 'texinfo-format 'texinfo-format-titlespec) |
2289 |
(defun texinfo-format-titlespec () |
(defun texinfo-format-titlespec () |
2290 |
(delete-region texinfo-command-start |
(delete-region texinfo-command-start |
2291 |
(progn (re-search-forward "@end titlespec[ \t]*\n") |
(re-search-forward "@end titlespec[ \t]*\n"))) |
|
(point)))) |
|
2292 |
|
|
2293 |
(put 'endtitlespec 'texinfo-format 'texinfo-discard-line) |
(put 'endtitlespec 'texinfo-format 'texinfo-discard-line) |
2294 |
|
|
2305 |
|
|
2306 |
|
|
2307 |
;;; @timestamp{} |
;;; @timestamp{} |
2308 |
;; Produce `Day Month Year Hour:Min' style of output. |
;; Produce `Day Month Year Hour:Min' style of output. |
2309 |
;; eg `1 Jan 1900 13:52' |
;; eg `1 Jan 1900 13:52' |
2310 |
|
|
2311 |
(put 'timestamp 'texinfo-format 'texinfo-format-timestamp) |
(put 'timestamp 'texinfo-format 'texinfo-format-timestamp) |
2323 |
(put 'ignore 'texinfo-format 'texinfo-format-ignore) |
(put 'ignore 'texinfo-format 'texinfo-format-ignore) |
2324 |
(defun texinfo-format-ignore () |
(defun texinfo-format-ignore () |
2325 |
(delete-region texinfo-command-start |
(delete-region texinfo-command-start |
2326 |
(progn (re-search-forward "@end ignore[ \t]*\n") |
(re-search-forward "@end ignore[ \t]*\n"))) |
|
(point)))) |
|
2327 |
|
|
2328 |
(put 'endignore 'texinfo-format 'texinfo-discard-line) |
(put 'endignore 'texinfo-format 'texinfo-discard-line) |
2329 |
|
|
2334 |
;; command for Info, but not for TeX. A command defined using |
;; command for Info, but not for TeX. A command defined using |
2335 |
;; `@definfoenclose' marks text by enclosing it in strings that precede |
;; `@definfoenclose' marks text by enclosing it in strings that precede |
2336 |
;; and follow the text. |
;; and follow the text. |
2337 |
;; |
;; |
2338 |
;; Presumably, if you define a command with `@definfoenclose` for Info, |
;; Presumably, if you define a command with `@definfoenclose` for Info, |
2339 |
;; you will also define the same command in the TeX definitions file, |
;; you will also define the same command in the TeX definitions file, |
2340 |
;; `texinfo.tex' in a manner appropriate for typesetting. |
;; `texinfo.tex' in a manner appropriate for typesetting. |
2341 |
;; |
;; |
2342 |
;; Write a `@definfoenclose' command on a line and follow it with three |
;; Write a `@definfoenclose' command on a line and follow it with three |
2343 |
;; arguments separated by commas (commas are used as separators in an |
;; arguments separated by commas (commas are used as separators in an |
2344 |
;; `@node' line in the same way). The first argument to |
;; `@node' line in the same way). The first argument to |
2355 |
;; If you do a @definfoenclose{} on the name of a pre-defined macro (such |
;; If you do a @definfoenclose{} on the name of a pre-defined macro (such |
2356 |
;; as @emph{}, @strong{}, @tt{}, or @i{}) the enclosure definition will |
;; as @emph{}, @strong{}, @tt{}, or @i{}) the enclosure definition will |
2357 |
;; override the built-in definition. |
;; override the built-in definition. |
2358 |
;; |
;; |
2359 |
;; An enclosure command defined this way takes one argument in braces. |
;; An enclosure command defined this way takes one argument in braces. |
2360 |
;; |
;; |
2361 |
;; For example, you can write: |
;; For example, you can write: |
2369 |
;; before and `\\' after the argument to `@phoo'. You can then write |
;; before and `\\' after the argument to `@phoo'. You can then write |
2370 |
;; `@phoo{bar}' wherever you want `//bar\\' highlighted in Info. |
;; `@phoo{bar}' wherever you want `//bar\\' highlighted in Info. |
2371 |
;; |
;; |
2372 |
;; Also, for TeX formatting, you could write |
;; Also, for TeX formatting, you could write |
2373 |
;; |
;; |
2374 |
;; @iftex |
;; @iftex |
2375 |
;; @global@let@phoo=@i |
;; @global@let@phoo=@i |
2418 |
(setq texinfo-alias-list |
(setq texinfo-alias-list |
2419 |
(cons |
(cons |
2420 |
(cons |
(cons |
2421 |
(buffer-substring (match-beginning 1) (match-end 1)) |
(match-string-no-properties 1) |
2422 |
(buffer-substring (match-beginning 2) (match-end 2))) |
(match-string-no-properties 2)) |
2423 |
texinfo-alias-list)) |
texinfo-alias-list)) |
2424 |
(texinfo-discard-command)) |
(texinfo-discard-command)) |
2425 |
) |
) |
2496 |
(insert (texinfo-parse-arg-discard)) |
(insert (texinfo-parse-arg-discard)) |
2497 |
(goto-char texinfo-command-start)) |
(goto-char texinfo-command-start)) |
2498 |
|
|
2499 |
|
;; @verb{<char>TEXT<char>} (in `makeinfo' 4.1 and later) |
2500 |
|
(put 'verb 'texinfo-format 'texinfo-format-verb) |
2501 |
|
(defun texinfo-format-verb () |
2502 |
|
"Format text between non-quoted unique delimiter characters verbatim. |
2503 |
|
Enclose the verbatim text, including the delimiters, in braces. Print |
2504 |
|
text exactly as written (but not the delimiters) in a fixed-width. |
2505 |
|
|
2506 |
|
For example, @verb\{|@|\} results in @ and |
2507 |
|
@verb\{+@'e?`!`+} results in @'e?`!`." |
2508 |
|
|
2509 |
|
(let ((delimiter (buffer-substring-no-properties |
2510 |
|
(1+ texinfo-command-end) (+ 2 texinfo-command-end)))) |
2511 |
|
(unless (looking-at "{") |
2512 |
|
(error "Not found: @verb start brace")) |
2513 |
|
(delete-region texinfo-command-start (+ 2 texinfo-command-end)) |
2514 |
|
(search-forward delimiter)) |
2515 |
|
(delete-backward-char 1) |
2516 |
|
(unless (looking-at "}") |
2517 |
|
(error "Not found: @verb end brace")) |
2518 |
|
(delete-char 1)) |
2519 |
|
|
2520 |
|
;; as of 2002 Dec 10 |
2521 |
|
;; see (texinfo)Block Enclosing Commands |
2522 |
|
;; need: @verbatim |
2523 |
|
|
2524 |
|
;; as of 2002 Dec 10 |
2525 |
|
;; see (texinfo)verbatiminclude |
2526 |
|
;; need: @verbatiminclude FILENAME |
2527 |
|
|
2528 |
(put 'bullet 'texinfo-format 'texinfo-format-bullet) |
(put 'bullet 'texinfo-format 'texinfo-format-bullet) |
2529 |
(defun texinfo-format-bullet () |
(defun texinfo-format-bullet () |
2530 |
"Insert an asterisk. |
"Insert an asterisk. |
2535 |
|
|
2536 |
;;; @kbd |
;;; @kbd |
2537 |
|
|
2538 |
;; Inside of @example ... @end example and similar environments, |
;; Inside of @example ... @end example and similar environments, |
2539 |
;; @kbd does nothing; but outside of such environments, it places |
;; @kbd does nothing; but outside of such environments, it places |
2540 |
;; single quotation markes around its argument. |
;; single quotation marks around its argument. |
2541 |
|
|
2542 |
(defvar texinfo-format-kbd-regexp |
(defvar texinfo-format-kbd-regexp |
2543 |
(concat |
(concat |
2570 |
"Place single quote marks around arg, except in @example and similar." |
"Place single quote marks around arg, except in @example and similar." |
2571 |
;; Search forward for @end example closer than an @example. |
;; Search forward for @end example closer than an @example. |
2572 |
;; Can stop search at nearest @node or texinfo-section-types-regexp |
;; Can stop search at nearest @node or texinfo-section-types-regexp |
2573 |
(let* ((stop |
(let* ((stop |
2574 |
(save-excursion |
(save-excursion |
2575 |
(re-search-forward |
(re-search-forward |
2576 |
(concat "^@node\\|\\(" texinfo-section-types-regexp "\\)") |
(concat "^@node\\|\\(" texinfo-section-types-regexp "\\)") |
2662 |
(point))) |
(point))) |
2663 |
(insert "INFO-DIR-SECTION " str "\n"))) |
(insert "INFO-DIR-SECTION " str "\n"))) |
2664 |
|
|
2665 |
;;; @cartouche |
;;; @cartouche |
2666 |
|
|
2667 |
;; The @cartouche command is a noop in Info; in a printed manual, |
;; The @cartouche command is a noop in Info; in a printed manual, |
2668 |
;; it makes a box with rounded corners. |
;; it makes a box with rounded corners. |
2723 |
(make-string |
(make-string |
2724 |
(- fill-column |
(- fill-column |
2725 |
(save-excursion |
(save-excursion |
2726 |
(end-of-line) |
(end-of-line) |
2727 |
(skip-chars-backward " \t") |
(skip-chars-backward " \t") |
2728 |
(delete-region (point) (progn (end-of-line) (point))) |
(delete-region (point) (progn (end-of-line) (point))) |
2729 |
(current-column))) |
(current-column))) |
2730 |
? ))))) |
? ))))) |
2731 |
|
|
2732 |
|
|
2773 |
;;; Refilling and indenting: @refill, @paragraphindent, @noindent |
;;; Refilling and indenting: @refill, @paragraphindent, @noindent |
2774 |
|
|
2775 |
;;; Indent only those paragraphs that are refilled as a result of an |
;;; Indent only those paragraphs that are refilled as a result of an |
2776 |
;;; @refill command. |
;;; @refill command. |
2777 |
|
|
2778 |
;; * If the value is `asis', do not change the existing indentation at |
;; * If the value is `asis', do not change the existing indentation at |
2779 |
;; the starts of paragraphs. |
;; the starts of paragraphs. |
2805 |
Default is to leave paragraph indentation as is." |
Default is to leave paragraph indentation as is." |
2806 |
(texinfo-discard-command) |
(texinfo-discard-command) |
2807 |
(let ((position (point-marker))) |
(let ((position (point-marker))) |
2808 |
(forward-paragraph -1) |
(forward-paragraph -1) |
2809 |
(if (looking-at "[ \t\n]*$") (forward-line 1)) |
(if (looking-at "[ \t\n]*$") (forward-line 1)) |
2810 |
;; Do not indent if an entry in a list, table, or deffn, |
;; Do not indent if an entry in a list, table, or deffn, |
2811 |
;; or if paragraph is preceded by @noindent. |
;; or if paragraph is preceded by @noindent. |
2812 |
;; Otherwise, indent |
;; Otherwise, indent |
2813 |
(cond |
(cond |
2814 |
;; delete a @noindent line and do not indent paragraph |
;; delete a @noindent line and do not indent paragraph |
2815 |
((save-excursion (forward-line -1) |
((save-excursion (forward-line -1) |
2816 |
(looking-at "^@noindent")) |
(looking-at "^@noindent")) |
2817 |
(forward-line -1) |
(forward-line -1) |
2818 |
(delete-region (point) (progn (forward-line 1) (point)))) |
(delete-region (point) (progn (forward-line 1) (point)))) |
2819 |
;; do nothing if "asis" |
;; do nothing if "asis" |
2820 |
((equal texinfo-paragraph-indent "asis")) |
((equal texinfo-paragraph-indent "asis")) |
2821 |
;; do no indenting in list, etc. |
;; do no indenting in list, etc. |
2822 |
((> texinfo-stack-depth 0)) |
((> texinfo-stack-depth 0)) |
2823 |
;; otherwise delete existing whitespace and indent |
;; otherwise delete existing whitespace and indent |
2824 |
(t |
(t |
2825 |
(delete-region (point) (progn (skip-chars-forward " \t") (point))) |
(delete-region (point) (progn (skip-chars-forward " \t") (point))) |
2826 |
(insert (make-string texinfo-paragraph-indent ? )))) |
(insert (make-string texinfo-paragraph-indent ? )))) |
2827 |
(forward-paragraph 1) |
(forward-paragraph 1) |
2828 |
(forward-line -1) |
(forward-line -1) |
2829 |
(end-of-line) |
(end-of-line) |
2830 |
;; Do not fill a section title line with asterisks, hyphens, etc. that |
;; Do not fill a section title line with asterisks, hyphens, etc. that |
2834 |
(paragraph-separate |
(paragraph-separate |
2835 |
(concat paragraph-separate "\\|[-=.]+\\|\\*\\*+")) |
(concat paragraph-separate "\\|[-=.]+\\|\\*\\*+")) |
2836 |
(previous-paragraph-start paragraph-start) |
(previous-paragraph-start paragraph-start) |
2837 |
(paragraph-start |
(paragraph-start |
2838 |
(concat paragraph-start "\\|[-=.]+\\|\\*\\*+"))) |
(concat paragraph-start "\\|[-=.]+\\|\\*\\*+"))) |
2839 |
(unwind-protect |
(unwind-protect |
2840 |
(fill-paragraph nil) |
(fill-paragraph nil) |
2843 |
(goto-char position))) |
(goto-char position))) |
2844 |
|
|
2845 |
(put 'noindent 'texinfo-format 'texinfo-noindent) |
(put 'noindent 'texinfo-format 'texinfo-noindent) |
2846 |
(defun texinfo-noindent () |
(defun texinfo-noindent () |
2847 |
(save-excursion |
(save-excursion |
2848 |
(forward-paragraph 1) |
(forward-paragraph 1) |
2849 |
(if (search-backward "@refill" |
(if (search-backward "@refill" |
2850 |
(save-excursion (forward-line -1) (point)) t) |
(save-excursion (forward-line -1) (point)) t) |
2928 |
|
|
2929 |
(fset index-formatting-command |
(fset index-formatting-command |
2930 |
(list 'lambda 'nil |
(list 'lambda 'nil |
2931 |
(list 'texinfo-index |
(list 'texinfo-index |
2932 |
(list 'quote index-alist-name)))))) |
(list 'quote index-alist-name)))))) |
2933 |
|
|
2934 |
|
|
2986 |
;; Subroutine for sorting an index. |
;; Subroutine for sorting an index. |
2987 |
;; At start of a line, return a string to sort the line under. |
;; At start of a line, return a string to sort the line under. |
2988 |
(defun texinfo-sort-startkeyfun () |
(defun texinfo-sort-startkeyfun () |
2989 |
(let ((line |
(let ((line (buffer-substring-no-properties (point) (line-end-position)))) |
|
(buffer-substring (point) (save-excursion (end-of-line) (point))))) |
|
2990 |
;; Canonicalize whitespace and eliminate funny chars. |
;; Canonicalize whitespace and eliminate funny chars. |
2991 |
(while (string-match "[ \t][ \t]+\\|[^a-z0-9 ]+" line) |
(while (string-match "[ \t][ \t]+\\|[^a-z0-9 ]+" line) |
2992 |
(setq line (concat (substring line 0 (match-beginning 0)) |
(setq line (concat (substring line 0 (match-beginning 0)) |
2993 |
" " |
" " |
2994 |
(substring line (match-end 0) (length line))))) |
(substring line (match-end 0))))) |
2995 |
line)) |
line)) |
2996 |
|
|
2997 |
|
|
3081 |
|
|
3082 |
;; See the `texinfo-accent-commands' variable |
;; See the `texinfo-accent-commands' variable |
3083 |
;; in the section for `texinfo-append-refill'. |
;; in the section for `texinfo-append-refill'. |
3084 |
;; Also, see the defun for `texinfo-format-scan' |
;; Also, see the defun for `texinfo-format-scan' |
3085 |
;; for single-character accent commands. |
;; for single-character accent commands. |
3086 |
|
|
3087 |
;; Command Info output Name |
;; Command Info output Name |
3126 |
|
|
3127 |
;; Note: The defun texinfo-format-scan |
;; Note: The defun texinfo-format-scan |
3128 |
;; looks at "[@{}^'`\",=~ *?!-]" |
;; looks at "[@{}^'`\",=~ *?!-]" |
3129 |
;; In the case of @*, a line break is inserted; |
;; In the case of @*, a line break is inserted; |
3130 |
;; in the other cases, the characters are simply quoted and the @ is deleted. |
;; in the other cases, the characters are simply quoted and the @ is deleted. |
3131 |
;; Thus, `texinfo-format-scan' handles the following |
;; Thus, `texinfo-format-scan' handles the following |
3132 |
;; single-character accent commands: @^ @` @' @" @, @- @= @~ |
;; single-character accent commands: @^ @` @' @" @, @- @= @~ |
3136 |
;; (defun texinfo-format-circumflex-accent () |
;; (defun texinfo-format-circumflex-accent () |
3137 |
;; (texinfo-discard-command) |
;; (texinfo-discard-command) |
3138 |
;; (insert "^")) |
;; (insert "^")) |
3139 |
;; |
;; |
3140 |
;; @` ==> ` grave accent |
;; @` ==> ` grave accent |
3141 |
;; (put '\` 'texinfo-format 'texinfo-format-grave-accent) |
;; (put '\` 'texinfo-format 'texinfo-format-grave-accent) |
3142 |
;; (defun texinfo-format-grave-accent () |
;; (defun texinfo-format-grave-accent () |
3143 |
;; (texinfo-discard-command) |
;; (texinfo-discard-command) |
3144 |
;; (insert "\`")) |
;; (insert "\`")) |
3145 |
;; |
;; |
3146 |
;; @' ==> ' acute accent |
;; @' ==> ' acute accent |
3147 |
;; (put '\' 'texinfo-format 'texinfo-format-acute-accent) |
;; (put '\' 'texinfo-format 'texinfo-format-acute-accent) |
3148 |
;; (defun texinfo-format-acute-accent () |
;; (defun texinfo-format-acute-accent () |
3149 |
;; (texinfo-discard-command) |
;; (texinfo-discard-command) |
3150 |
;; (insert "'")) |
;; (insert "'")) |
3151 |
;; |
;; |
3152 |
;; @" ==> " umlaut accent |
;; @" ==> " umlaut accent |
3153 |
;; (put '\" 'texinfo-format 'texinfo-format-umlaut-accent) |
;; (put '\" 'texinfo-format 'texinfo-format-umlaut-accent) |
3154 |
;; (defun texinfo-format-umlaut-accent () |
;; (defun texinfo-format-umlaut-accent () |
3160 |
;; (defun texinfo-format-overbar-accent () |
;; (defun texinfo-format-overbar-accent () |
3161 |
;; (texinfo-discard-command) |
;; (texinfo-discard-command) |
3162 |
;; (insert "=")) |
;; (insert "=")) |
3163 |
;; |
;; |
3164 |
;; @~ ==> ~ tilde accent |
;; @~ ==> ~ tilde accent |
3165 |
;; (put '~ 'texinfo-format 'texinfo-format-tilde-accent) |
;; (put '~ 'texinfo-format 'texinfo-format-tilde-accent) |
3166 |
;; (defun texinfo-format-tilde-accent () |
;; (defun texinfo-format-tilde-accent () |
3320 |
;; In Info, `Category: name ARGS' |
;; In Info, `Category: name ARGS' |
3321 |
;; In index: name: node. line#. |
;; In index: name: node. line#. |
3322 |
;; |
;; |
3323 |
;; @defvr category name |
;; @defvr category name |
3324 |
;; In Info, `Category: name' |
;; In Info, `Category: name' |
3325 |
;; In index: name: node. line#. |
;; In index: name: node. line#. |
3326 |
;; |
;; |
3341 |
;; Generalized typed-function-like or typed-variable-like entity: |
;; Generalized typed-function-like or typed-variable-like entity: |
3342 |
;; @deftypefn category data-type name args... |
;; @deftypefn category data-type name args... |
3343 |
;; In Info, `Category: data-type name args...' |
;; In Info, `Category: data-type name args...' |
3344 |
;; @deftypevr category data-type name |
;; @deftypevr category data-type name |
3345 |
;; In Info, `Category: data-type name' |
;; In Info, `Category: data-type name' |
3346 |
;; In index: name: node. line#. |
;; In index: name: node. line#. |
3347 |
;; |
;; |
3348 |
;; Specialized typed-function-like or typed-variable-like entity: |
;; Specialized typed-function-like or typed-variable-like entity: |
3349 |
;; @deftypefun data-type name args... |
;; @deftypefun data-type name args... |
3350 |
;; In Info, `Function: data-type name ARGS' |
;; In Info, `Function: data-type name ARGS' |
3351 |
;; In index: name: node. line#. |
;; In index: name: node. line#. |
3352 |
;; |
;; |
3353 |
;; @deftypevar data-type name |
;; @deftypevar data-type name |
3354 |
;; In Info, `Variable: data-type name' |
;; In Info, `Variable: data-type name' |
3355 |
;; In index: name: node. line#. but include args after name!? |
;; In index: name: node. line#. but include args after name!? |
3356 |
;; |
;; |
3357 |
;; Generalized object oriented entity: |
;; Generalized object oriented entity: |
3358 |
;; @defop category class name args... |
;; @defop category class name args... |
3359 |
;; In Info, `Category on class: name ARG' |
;; In Info, `Category on class: name ARG' |
3360 |
;; In index: name on class: node. line#. |
;; In index: name on class: node. line#. |
3361 |
;; |
;; |
3362 |
;; @defcv category class name |
;; @defcv category class name |
3363 |
;; In Info, `Category of class: name' |
;; In Info, `Category of class: name' |
3364 |
;; In index: name of class: node. line#. |
;; In index: name of class: node. line#. |
3365 |
;; |
;; |
3366 |
;; Specialized object oriented entity: |
;; Specialized object oriented entity: |
3367 |
;; @defmethod class name args... |
;; @defmethod class name args... |
3368 |
;; In Info, `Method on class: name ARGS' |
;; In Info, `Method on class: name ARGS' |
3369 |
;; In index: name on class: node. line#. |
;; In index: name on class: node. line#. |
3370 |
;; |
;; |
3483 |
;; Generalized typed-function-like or typed-variable-like entity: |
;; Generalized typed-function-like or typed-variable-like entity: |
3484 |
;; @deftypefn category data-type name args... |
;; @deftypefn category data-type name args... |
3485 |
;; In Info, `Category: data-type name args...' |
;; In Info, `Category: data-type name args...' |
3486 |
;; @deftypevr category data-type name |
;; @deftypevr category data-type name |
3487 |
;; In Info, `Category: data-type name' |
;; In Info, `Category: data-type name' |
3488 |
;; Note: args in lower case, unless modified in command line. |
;; Note: args in lower case, unless modified in command line. |
3489 |
(let ((category (car parsed-args)) |
(let ((category (car parsed-args)) |
3506 |
;; Specialized typed-function-like or typed-variable-like entity: |
;; Specialized typed-function-like or typed-variable-like entity: |
3507 |
;; @deftypefun data-type name args... |
;; @deftypefun data-type name args... |
3508 |
;; In Info, `Function: data-type name ARGS' |
;; In Info, `Function: data-type name ARGS' |
3509 |
;; @deftypevar data-type name |
;; @deftypevar data-type name |
3510 |
;; In Info, `Variable: data-type name' |
;; In Info, `Variable: data-type name' |
3511 |
;; Note: args in lower case, unless modified in command line. |
;; Note: args in lower case, unless modified in command line. |
3512 |
;; Use cdr of texinfo-defun-type to determine category: |
;; Use cdr of texinfo-defun-type to determine category: |
3523 |
(put 'defop 'texinfo-deffn-formatting-property 'texinfo-format-defop) |
(put 'defop 'texinfo-deffn-formatting-property 'texinfo-format-defop) |
3524 |
(put 'defopx 'texinfo-deffn-formatting-property 'texinfo-format-defop) |
(put 'defopx 'texinfo-deffn-formatting-property 'texinfo-format-defop) |
3525 |
(defun texinfo-format-defop (parsed-args) |
(defun texinfo-format-defop (parsed-args) |
3526 |
;; Generalized object oriented entity: |
;; Generalized object oriented entity: |
3527 |
;; @defop category class name args... |
;; @defop category class name args... |
3528 |
;; In Info, `Category on class: name ARG' |
;; In Info, `Category on class: name ARG' |
3529 |
;; Note: args in upper case; use of `on' |
;; Note: args in upper case; use of `on' |
3540 |
(put 'defcv 'texinfo-deffn-formatting-property 'texinfo-format-defcv) |
(put 'defcv 'texinfo-deffn-formatting-property 'texinfo-format-defcv) |
3541 |
(put 'defcvx 'texinfo-deffn-formatting-property 'texinfo-format-defcv) |
(put 'defcvx 'texinfo-deffn-formatting-property 'texinfo-format-defcv) |
3542 |
(defun texinfo-format-defcv (parsed-args) |
(defun texinfo-format-defcv (parsed-args) |
3543 |
;; Generalized object oriented entity: |
;; Generalized object oriented entity: |
3544 |
;; @defcv category class name |
;; @defcv category class name |
3545 |
;; In Info, `Category of class: name' |
;; In Info, `Category of class: name' |
3546 |
;; Note: args in upper case; use of `of' |
;; Note: args in upper case; use of `of' |
3547 |
(let ((category (car parsed-args)) |
(let ((category (car parsed-args)) |
3558 |
(put 'defmethodx 'texinfo-deffn-formatting-property 'texinfo-format-defmethod) |
(put 'defmethodx 'texinfo-deffn-formatting-property 'texinfo-format-defmethod) |
3559 |
(defun texinfo-format-defmethod (parsed-args) |
(defun texinfo-format-defmethod (parsed-args) |
3560 |
;; Specialized object oriented entity: |
;; Specialized object oriented entity: |
3561 |
;; @defmethod class name args... |
;; @defmethod class name args... |
3562 |
;; In Info, `Method on class: name ARGS' |
;; In Info, `Method on class: name ARGS' |
3563 |
;; Note: args in upper case; use of `on' |
;; Note: args in upper case; use of `on' |
3564 |
;; Use cdr of texinfo-defun-type to determine category: |
;; Use cdr of texinfo-defun-type to determine category: |
3596 |
;; line number. Depending on the which command is used, the entry is |
;; line number. Depending on the which command is used, the entry is |
3597 |
;; formatted differently: |
;; formatted differently: |
3598 |
;; |
;; |
3599 |
;; @defun, |
;; @defun, |
3600 |
;; @defmac, |
;; @defmac, |
3601 |
;; @defspec, |
;; @defspec, |
3602 |
;; @defvar, |
;; @defvar, |
3603 |
;; @defopt all use their 1st argument as the entry-proper |
;; @defopt all use their 1st argument as the entry-proper |
3604 |
;; |
;; |
3605 |
;; @deffn, |
;; @deffn, |
3606 |
;; @defvr, |
;; @defvr, |
3607 |
;; @deftp |
;; @deftp |
3608 |
;; @deftypefun |
;; @deftypefun |
3609 |
;; @deftypevar all use their 2nd argument as the entry-proper |
;; @deftypevar all use their 2nd argument as the entry-proper |
3610 |
;; |
;; |
3611 |
;; @deftypefn, |
;; @deftypefn, |
3612 |
;; @deftypevr both use their 3rd argument as the entry-proper |
;; @deftypevr both use their 3rd argument as the entry-proper |
3613 |
;; |
;; |
3614 |
;; @defmethod uses its 2nd and 1st arguments as an entry-proper |
;; @defmethod uses its 2nd and 1st arguments as an entry-proper |
3615 |
;; formatted: NAME on CLASS |
;; formatted: NAME on CLASS |
3616 |
|
|
3617 |
;; @defop uses its 3rd and 2nd arguments as an entry-proper |
;; @defop uses its 3rd and 2nd arguments as an entry-proper |
3618 |
;; formatted: NAME on CLASS |
;; formatted: NAME on CLASS |
3619 |
;; |
;; |
3620 |
;; @defivar uses its 2nd and 1st arguments as an entry-proper |
;; @defivar uses its 2nd and 1st arguments as an entry-proper |
3621 |
;; formatted: NAME of CLASS |
;; formatted: NAME of CLASS |
3622 |
;; |
;; |
3638 |
;; `index-list' will be texinfo-findex or the like |
;; `index-list' will be texinfo-findex or the like |
3639 |
(let ((index-list (get texinfo-command-name 'texinfo-defun-index))) |
(let ((index-list (get texinfo-command-name 'texinfo-defun-index))) |
3640 |
(set index-list |
(set index-list |
3641 |
(cons |
(cons |
3642 |
;; Three elements: entry-proper, node-name, line-number |
;; Three elements: entry-proper, node-name, line-number |
3643 |
(list |
(list |
3644 |
(car parsed-args) |
(car parsed-args) |
3659 |
(put 'deftypefunx 'texinfo-defun-indexing-property 'texinfo-index-deffn) |
(put 'deftypefunx 'texinfo-defun-indexing-property 'texinfo-index-deffn) |
3660 |
(put 'deftypevar 'texinfo-defun-indexing-property 'texinfo-index-deffn) |
(put 'deftypevar 'texinfo-defun-indexing-property 'texinfo-index-deffn) |
3661 |
(put 'deftypevarx 'texinfo-defun-indexing-property 'texinfo-index-deffn) |
(put 'deftypevarx 'texinfo-defun-indexing-property 'texinfo-index-deffn) |
3662 |
(defun texinfo-index-deffn (parsed-args) |
(defun texinfo-index-deffn (parsed-args) |
3663 |
;; use 2nd parsed-arg as entry-proper |
;; use 2nd parsed-arg as entry-proper |
3664 |
;; `index-list' will be texinfo-findex or the like |
;; `index-list' will be texinfo-findex or the like |
3665 |
(let ((index-list (get texinfo-command-name 'texinfo-defun-index))) |
(let ((index-list (get texinfo-command-name 'texinfo-defun-index))) |
3666 |
(set index-list |
(set index-list |
3667 |
(cons |
(cons |
3668 |
;; Three elements: entry-proper, node-name, line-number |
;; Three elements: entry-proper, node-name, line-number |
3669 |
(list |
(list |
3670 |
(car (cdr parsed-args)) |
(car (cdr parsed-args)) |
3684 |
;; `index-list' will be texinfo-findex or the like |
;; `index-list' will be texinfo-findex or the like |
3685 |
(let ((index-list (get texinfo-command-name 'texinfo-defun-index))) |
(let ((index-list (get texinfo-command-name 'texinfo-defun-index))) |
3686 |
(set index-list |
(set index-list |
3687 |
(cons |
(cons |
3688 |
;; Three elements: entry-proper, node-name, line-number |
;; Three elements: entry-proper, node-name, line-number |
3689 |
(list |
(list |
3690 |
(car (cdr (cdr parsed-args))) |
(car (cdr (cdr parsed-args))) |
3702 |
;; `index-list' will be texinfo-findex or the like |
;; `index-list' will be texinfo-findex or the like |
3703 |
(let ((index-list (get texinfo-command-name 'texinfo-defun-index))) |
(let ((index-list (get texinfo-command-name 'texinfo-defun-index))) |
3704 |
(set index-list |
(set index-list |
3705 |
(cons |
(cons |
3706 |
;; Three elements: entry-proper, node-name, line-number |
;; Three elements: entry-proper, node-name, line-number |
3707 |
(list |
(list |
3708 |
(format "%s on %s" |
(format "%s on %s" |
3709 |
(car (cdr parsed-args)) |
(car (cdr parsed-args)) |
3710 |
(car parsed-args)) |
(car parsed-args)) |
3711 |
texinfo-last-node |
texinfo-last-node |
3722 |
;; `index-list' will be texinfo-findex or the like |
;; `index-list' will be texinfo-findex or the like |
3723 |
(let ((index-list (get texinfo-command-name 'texinfo-defun-index))) |
(let ((index-list (get texinfo-command-name 'texinfo-defun-index))) |
3724 |
(set index-list |
(set index-list |
3725 |
(cons |
(cons |
3726 |
;; Three elements: entry-proper, node-name, line-number |
;; Three elements: entry-proper, node-name, line-number |
3727 |
(list |
(list |
3728 |
(format "%s on %s" |
(format "%s on %s" |
3729 |
(car (cdr (cdr parsed-args))) |
(car (cdr (cdr parsed-args))) |
3730 |
(car (cdr parsed-args))) |
(car (cdr parsed-args))) |
3731 |
texinfo-last-node |
texinfo-last-node |
3742 |
;; `index-list' will be texinfo-findex or the like |
;; `index-list' will be texinfo-findex or the like |
3743 |
(let ((index-list (get texinfo-command-name 'texinfo-defun-index))) |
(let ((index-list (get texinfo-command-name 'texinfo-defun-index))) |
3744 |
(set index-list |
(set index-list |
3745 |
(cons |
(cons |
3746 |
;; Three elements: entry-proper, node-name, line-number |
;; Three elements: entry-proper, node-name, line-number |
3747 |
(list |
(list |
3748 |
(format "%s of %s" |
(format "%s of %s" |
3749 |
(car (cdr parsed-args)) |
(car (cdr parsed-args)) |
3750 |
(car parsed-args)) |
(car parsed-args)) |
3751 |
texinfo-last-node |
texinfo-last-node |
3762 |
;; `index-list' will be texinfo-findex or the like |
;; `index-list' will be texinfo-findex or the like |
3763 |
(let ((index-list (get texinfo-command-name 'texinfo-defun-index))) |
(let ((index-list (get texinfo-command-name 'texinfo-defun-index))) |
3764 |
(set index-list |
(set index-list |
3765 |
(cons |
(cons |
3766 |
;; Three elements: entry-proper, node-name, line-number |
;; Three elements: entry-proper, node-name, line-number |
3767 |
(list |
(list |
3768 |
(format "%s of %s" |
(format "%s of %s" |
3769 |
(car (cdr (cdr parsed-args))) |
(car (cdr (cdr parsed-args))) |
3770 |
(car (cdr parsed-args))) |
(car (cdr parsed-args))) |
3771 |
texinfo-last-node |
texinfo-last-node |
3953 |
;; @set FLAG, then the text is not formatted; it is ignored. @ifclear |
;; @set FLAG, then the text is not formatted; it is ignored. @ifclear |
3954 |
;; is the opposite of @ifset. |
;; is the opposite of @ifset. |
3955 |
|
|
3956 |
;; If a flag is set to a string with @set FLAG, |
;; If a flag is set to a string with @set FLAG, |
3957 |
;; replace @value{FLAG} with the string. |
;; replace @value{FLAG} with the string. |
3958 |
;; If a flag with a value is cleared, |
;; If a flag with a value is cleared, |
3959 |
;; @value{FLAG} is invalid, |
;; @value{FLAG} is invalid, |
3960 |
;; as if there had never been any @set FLAG previously. |
;; as if there had never been any @set FLAG previously. |
3961 |
|
|
3962 |
(put 'clear 'texinfo-format 'texinfo-clear) |
(put 'clear 'texinfo-format 'texinfo-clear) |
3994 |
'flag-set) |
'flag-set) |
3995 |
(get (car (read-from-string arg)) 'texinfo-set-value)) |
(get (car (read-from-string arg)) 'texinfo-set-value)) |
3996 |
(insert (get (car (read-from-string arg)) 'texinfo-set-value))) |
(insert (get (car (read-from-string arg)) 'texinfo-set-value))) |
3997 |
((eq (get (car (read-from-string arg)) 'texinfo-whether-setp) |
((eq (get (car (read-from-string arg)) 'texinfo-whether-setp) |
3998 |
'flag-cleared) |
'flag-cleared) |
3999 |
(insert (format "{No value for \"%s\"}" arg))) |
(insert (format "{No value for \"%s\"}" arg))) |
4000 |
((eq (get (car (read-from-string arg)) 'texinfo-whether-setp) nil) |
((eq (get (car (read-from-string arg)) 'texinfo-whether-setp) nil) |
4014 |
'flag-cleared) |
'flag-cleared) |
4015 |
;; Clear region (i.e., cause the text to be ignored). |
;; Clear region (i.e., cause the text to be ignored). |
4016 |
(delete-region texinfo-command-start |
(delete-region texinfo-command-start |
4017 |
(progn (re-search-forward "@end ifset[ \t]*\n") |
(re-search-forward "@end ifset[ \t]*\n"))) |
|
(point)))) |
|
4018 |
((eq (get (car (read-from-string arg)) 'texinfo-whether-setp) |
((eq (get (car (read-from-string arg)) 'texinfo-whether-setp) |
4019 |
nil) |
nil) |
4020 |
;; In this case flag is neither set nor cleared. |
;; In this case flag is neither set nor cleared. |
4021 |
;; Act as if set, i.e. do nothing. |
;; Act as if set, i.e. do nothing. |
4022 |
())))) |
())))) |
4023 |
|
|
4031 |
'flag-set) |
'flag-set) |
4032 |
;; Clear region (i.e., cause the text to be ignored). |
;; Clear region (i.e., cause the text to be ignored). |
4033 |
(delete-region texinfo-command-start |
(delete-region texinfo-command-start |
4034 |
(progn (re-search-forward "@end ifclear[ \t]*\n") |
(re-search-forward "@end ifclear[ \t]*\n"))) |
|
(point)))) |
|
4035 |
((eq (get (car (read-from-string arg)) 'texinfo-whether-setp) |
((eq (get (car (read-from-string arg)) 'texinfo-whether-setp) |
4036 |
'flag-cleared) |
'flag-cleared) |
4037 |
;; Format the text (i.e., do not remove it); do nothing here. |
;; Format the text (i.e., do not remove it); do nothing here. |
4038 |
()) |
()) |
4039 |
((eq (get (car (read-from-string arg)) 'texinfo-whether-setp) |
((eq (get (car (read-from-string arg)) 'texinfo-whether-setp) |
4040 |
nil) |
nil) |
4041 |
;; In this case flag is neither set nor cleared. |
;; In this case flag is neither set nor cleared. |
4042 |
;; Act as if clear, i.e. do nothing. |
;; Act as if clear, i.e. do nothing. |
4043 |
())))) |
())))) |
4044 |
|
|
4073 |
(setq start (point)) |
(setq start (point)) |
4074 |
(search-forward "," stop t) |
(search-forward "," stop t) |
4075 |
(skip-chars-backward ", ") |
(skip-chars-backward ", ") |
4076 |
(buffer-substring start (point)))) |
(buffer-substring-no-properties start (point)))) |
4077 |
(arg2 |
(arg2 |
4078 |
(progn |
(progn |
4079 |
(search-forward "," stop t) |
(search-forward "," stop t) |
4081 |
(setq start (point)) |
(setq start (point)) |
4082 |
(search-forward "," stop t) |
(search-forward "," stop t) |
4083 |
(skip-chars-backward ", ") |
(skip-chars-backward ", ") |
4084 |
(buffer-substring start (point)))) |
(buffer-substring-no-properties start (point)))) |
4085 |
(texinfo-command |
(texinfo-command |
4086 |
(progn |
(progn |
4087 |
(search-forward "," stop t) |
(search-forward "," stop t) |
4089 |
(setq start (point)) |
(setq start (point)) |
4090 |
(goto-char (1- stop)) |
(goto-char (1- stop)) |
4091 |
(skip-chars-backward " ") |
(skip-chars-backward " ") |
4092 |
(buffer-substring start (point))))) |
(buffer-substring-no-properties start (point))))) |
4093 |
(delete-region texinfo-command-start stop) |
(delete-region texinfo-command-start stop) |
4094 |
(if (equal arg1 arg2) |
(if (equal arg1 arg2) |
4095 |
(insert texinfo-command)) |
(insert texinfo-command)) |
4210 |
(put 'smallbreak 'texinfo-format 'texinfo-discard-line) |
(put 'smallbreak 'texinfo-format 'texinfo-discard-line) |
4211 |
(put 'medbreak 'texinfo-format 'texinfo-discard-line) |
(put 'medbreak 'texinfo-format 'texinfo-discard-line) |
4212 |
(put 'bigbreak 'texinfo-format 'texinfo-discard-line) |
(put 'bigbreak 'texinfo-format 'texinfo-discard-line) |
4213 |
|
(put 'afourpaper 'texinfo-format 'texinfo-discard-line) |
4214 |
|
(put 'afivepaper 'texinfo-format 'texinfo-discard-line) |
4215 |
|
(put 'afourlatex 'texinfo-format 'texinfo-discard-line) |
4216 |
|
(put 'afourwide 'texinfo-format 'texinfo-discard-line) |
4217 |
|
|
4218 |
|
|
4219 |
;;; These noop commands discard the rest of the line. |
;;; These noop commands discard the rest of the line. |
4256 |
(put 'summarycontents 'texinfo-format 'texinfo-discard-line-with-args) |
(put 'summarycontents 'texinfo-format 'texinfo-discard-line-with-args) |
4257 |
(put 'input 'texinfo-format 'texinfo-discard-line-with-args) |
(put 'input 'texinfo-format 'texinfo-discard-line-with-args) |
4258 |
|
|
4259 |
|
(put 'documentlanguage 'texinfo-format 'texinfo-discard-line-with-args) |
4260 |
|
(put 'documentencoding 'texinfo-format 'texinfo-discard-line-with-args) |
4261 |
|
|
4262 |
|
|
4263 |
|
|
4264 |
;;; Some commands cannot be handled |
;;; Some commands cannot be handled |
4265 |
|
|
4266 |
(defun texinfo-unsupported () |
(defun texinfo-unsupported () |
4267 |
(error "%s is not handled by texinfo" |
(error "%s is not handled by texinfo" |
4268 |
(buffer-substring texinfo-command-start texinfo-command-end))) |
(buffer-substring-no-properties texinfo-command-start texinfo-command-end))) |
4269 |
|
|
4270 |
;;; Batch formatting |
;;; Batch formatting |
4271 |
|
|
4316 |
(error |
(error |
4317 |
(message ">> Error: %s" (prin1-to-string err)) |
(message ">> Error: %s" (prin1-to-string err)) |
4318 |
(message ">> point at") |
(message ">> point at") |
4319 |
(let ((s (buffer-substring (point) |
(let ((s (buffer-substring-no-properties (point) |
4320 |
(min (+ (point) 100) |
(min (+ (point) 100) |
4321 |
(point-max)))) |
(point-max)))) |
4322 |
(tem 0)) |
(tem 0)) |
4323 |
(while (setq tem (string-match "\n+" s tem)) |
(while (setq tem (string-match "\n+" s tem)) |
4324 |
(setq s (concat (substring s 0 (match-beginning 0)) |
(setq s (concat (substring s 0 (match-beginning 0)) |