Mercurial > emacs
comparison lisp/textmodes/texinfmt.el @ 48794:837d37faadcf
Installed on behalf of TAKAHASHI Kaoru <kaoru@kaisei.org>
(@verb, @image): new commands
(@kbdinputstyle, @vskip, @evenfooting, @evenheading, @oddfooting,
@oddheading, @everyfooting, @everyheading, @documentdescription):
Add these commands, none of which should appear in an Info
environment; but if they do, these definitions should cause
them to be discarded.
author | Robert J. Chassell <bob@rattlesnake.com> |
---|---|
date | Tue, 10 Dec 2002 19:01:36 +0000 |
parents | a4aa559a2dec |
children | faafd2631b67 |
comparison
equal
deleted
inserted
replaced
48793:da833584a044 | 48794:837d37faadcf |
---|---|
1389 (put '\- 'texinfo-format 'texinfo-format-soft-hyphen) | 1389 (put '\- 'texinfo-format 'texinfo-format-soft-hyphen) |
1390 (defun texinfo-format-soft-hyphen () | 1390 (defun texinfo-format-soft-hyphen () |
1391 (texinfo-discard-command)) | 1391 (texinfo-discard-command)) |
1392 | 1392 |
1393 | 1393 |
1394 ;;; @kbdinputstyle, @vskip, headings & footings | |
1395 ;; These commands for not for Info and should never | |
1396 ;; appear in an Info environment; but if they do, | |
1397 ;; this causes them to be discarded. | |
1398 | |
1399 ;; @kbdinputstyle | |
1400 (put 'kbdinputstyle 'texinfo-format 'texinfo-discard-line-with-args) | |
1401 | |
1402 ;; @vskip | |
1403 (put 'vskip 'texinfo-format 'texinfo-discard-line-with-args) | |
1404 | |
1405 ;; headings & footings | |
1406 (put 'evenfooting 'texinfo-format 'texinfo-discard-line-with-args) | |
1407 (put 'evenheading 'texinfo-format 'texinfo-discard-line-with-args) | |
1408 (put 'oddfooting 'texinfo-format 'texinfo-discard-line-with-args) | |
1409 (put 'oddheading 'texinfo-format 'texinfo-discard-line-with-args) | |
1410 (put 'everyfooting 'texinfo-format 'texinfo-discard-line-with-args) | |
1411 (put 'everyheading 'texinfo-format 'texinfo-discard-line-with-args) | |
1412 | |
1413 | |
1414 ;;; @documentdescription ... @end documentdescription | |
1415 ;; This command is for HTML output and should never | |
1416 ;; appear in an Info environment; but if it does, | |
1417 ;; this causes it to be discarded. | |
1418 | |
1419 (put 'documentdescription 'texinfo-format 'texinfo-format-documentdescription) | |
1420 (defun texinfo-format-documentdescription () | |
1421 (delete-region texinfo-command-start | |
1422 (progn (re-search-forward "^@end documentdescription[ \t]*\n") | |
1423 (point)))) | |
1424 | |
1425 | |
1426 | |
1394 ;;; @center, @sp, and @br | 1427 ;;; @center, @sp, and @br |
1395 | 1428 |
1396 (put 'center 'texinfo-format 'texinfo-format-center) | 1429 (put 'center 'texinfo-format 'texinfo-format-center) |
1397 (defun texinfo-format-center () | 1430 (defun texinfo-format-center () |
1398 (let ((arg (texinfo-parse-expanded-arg))) | 1431 (let ((arg (texinfo-parse-expanded-arg))) |
2165 (setq column-number (1+ column-number)))) | 2198 (setq column-number (1+ column-number)))) |
2166 (kill-buffer texinfo-multitable-buffer-name) | 2199 (kill-buffer texinfo-multitable-buffer-name) |
2167 (setq fill-column existing-fill-column))) | 2200 (setq fill-column existing-fill-column))) |
2168 | 2201 |
2169 | 2202 |
2203 ;;; @image | |
2204 ;; Use only the FILENAME argument to the command. | |
2205 ;; In Info, ignore the other arguments. | |
2206 | |
2207 (put 'image 'texinfo-format 'texinfo-format-image) | |
2208 (defun texinfo-format-image () | |
2209 "Insert an image from an an file ending in .txt. | |
2210 Use only the FILENAME arg; for Info, ignore the other arguments to @image." | |
2211 (let ((args (texinfo-format-parse-args)) | |
2212 filename) | |
2213 (when (null (nth 0 args)) | |
2214 (error "Invalid image command")) | |
2215 (texinfo-discard-command) | |
2216 ;; makeinfo uses FILENAME.txt | |
2217 (setq filename (format "%s.txt" (nth 0 args))) | |
2218 (message "Reading included file: %s" filename) | |
2219 ;; verbatim for Info output | |
2220 (goto-char (+ (point) (cadr (insert-file-contents filename)))) | |
2221 (message "Reading included file: %s...done" filename))) | |
2222 | |
2223 | |
2170 ;;; @ifinfo, @iftex, @tex, @ifhtml, @html, @ifplaintext, @ifxml, @xml | 2224 ;;; @ifinfo, @iftex, @tex, @ifhtml, @html, @ifplaintext, @ifxml, @xml |
2171 ;; @ifnottex, @ifnotinfo, @ifnothtml, @ifnotplaintext, @ifnotxml | 2225 ;; @ifnottex, @ifnotinfo, @ifnothtml, @ifnotplaintext, @ifnotxml |
2172 | 2226 |
2173 (put 'ifinfo 'texinfo-format 'texinfo-discard-line) | 2227 (put 'ifinfo 'texinfo-format 'texinfo-discard-line) |
2174 (put 'ifinfo 'texinfo-end 'texinfo-discard-command) | 2228 (put 'ifinfo 'texinfo-end 'texinfo-discard-command) |
2456 (put 'key 'texinfo-format 'texinfo-format-key) | 2510 (put 'key 'texinfo-format 'texinfo-format-key) |
2457 ;; I've decided not want to have angle brackets around these -- rms. | 2511 ;; I've decided not want to have angle brackets around these -- rms. |
2458 (defun texinfo-format-key () | 2512 (defun texinfo-format-key () |
2459 (insert (texinfo-parse-arg-discard)) | 2513 (insert (texinfo-parse-arg-discard)) |
2460 (goto-char texinfo-command-start)) | 2514 (goto-char texinfo-command-start)) |
2515 | |
2516 ;; @verb{<char>TEXT<char>} (in `makeinfo' 4.1 and later) | |
2517 (put 'verb 'texinfo-format 'texinfo-format-verb) | |
2518 (defun texinfo-format-verb () | |
2519 "Format text between non-quoted unique delimiter characters verbatim. | |
2520 Enclose the verbatim text, including the delimiters, in braces. Print | |
2521 text exactly as written (but not the delimiters) in a fixed-width. | |
2522 | |
2523 For example, @verb\{|@|\} results in @ and | |
2524 @verb\{+@'e?`!`+} results in @'e?`!`." | |
2525 | |
2526 (let ((delimiter (buffer-substring-no-properties | |
2527 (1+ texinfo-command-end) (+ 2 texinfo-command-end)))) | |
2528 (unless (looking-at "{") | |
2529 (error "Not found: @verb start brace")) | |
2530 (delete-region texinfo-command-start (+ 2 texinfo-command-end)) | |
2531 (search-forward delimiter)) | |
2532 (delete-backward-char 1) | |
2533 (unless (looking-at "}") | |
2534 (error "Not found: @verb end brace")) | |
2535 (delete-char 1)) | |
2536 | |
2537 ;; as of 2002 Dec 10 | |
2538 ;; see (texinfo)Block Enclosing Commands | |
2539 ;; need: @verbatim | |
2540 | |
2541 ;; as of 2002 Dec 10 | |
2542 ;; see (texinfo)verbatiminclude | |
2543 ;; need: @verbatiminclude FILENAME | |
2461 | 2544 |
2462 (put 'bullet 'texinfo-format 'texinfo-format-bullet) | 2545 (put 'bullet 'texinfo-format 'texinfo-format-bullet) |
2463 (defun texinfo-format-bullet () | 2546 (defun texinfo-format-bullet () |
2464 "Insert an asterisk. | 2547 "Insert an asterisk. |
2465 If used within a line, follow `@bullet' with braces." | 2548 If used within a line, follow `@bullet' with braces." |