From: kaoru Date: Tue, 18 Jul 2000 18:22:41 +0000 (+0000) Subject: * utils/ptexinfmt.el: Use fmakunbound, when broken-function replace. X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cd78d67a6f0462bc0e43bee5e3f2635d7a88144f;p=elisp%2Fwanderlust.git * utils/ptexinfmt.el: Use fmakunbound, when broken-function replace. --- diff --git a/ChangeLog b/ChangeLog index c733a3b..7b31bec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2000-07-18 TAKAHASHI Kaoru + + * utils/ptexinfmt.el: Use fmakunbound, when broken-function + replace. + 2000-07-17 Yuuichi Teranishi * WL-ELS: Deleted time-stamp line. diff --git a/utils/ptexinfmt.el b/utils/ptexinfmt.el index 4cee1dd..1fd7750 100644 --- a/utils/ptexinfmt.el +++ b/utils/ptexinfmt.el @@ -40,10 +40,10 @@ (provide 'ptexinfmt) -;;; Fix broken facility +;;; Broken ;; @var (broken-facility texinfo-format-var - "When @COMMAND included, don't perse it." + "Don't perse @COMMAND included @var" (condition-case nil (with-temp-buffer (let (texinfo-enclosure-list texinfo-alias-list) @@ -53,15 +53,9 @@ t)) (error nil))) -(when-broken texinfo-format-var - (defun texinfo-format-var () - (let ((arg (texinfo-parse-expanded-arg))) - (texinfo-discard-command) - (insert (upcase arg))))) - ;; @xref (broken-facility texinfo-format-xref - "When 1st arg is nil, wrong-type-argument error." + "Can't format 1st argument empty @xref." (condition-case nil (with-temp-buffer (let (texinfo-enclosure-list texinfo-alias-list) @@ -71,22 +65,9 @@ t)) (error nil))) -(when-broken texinfo-format-xref - (defun texinfo-format-xref () - (let ((args (texinfo-format-parse-args))) - (texinfo-discard-command) - (insert "*Note ") - (let ((fname (or (nth 1 args) (nth 2 args)))) - (if (null (or fname (nth 3 args))) - (insert (car args) "::") - (insert (or fname (car args)) ": ") - (if (nth 3 args) - (insert "(" (nth 3 args) ")")) - (and (car args) (insert (car args)))))))) - ;; @uref (broken-facility texinfo-format-uref - "Parse 2 times argument." + "Parse 2 times @uref argument." (condition-case nil (with-temp-buffer (let (texinfo-enclosure-list texinfo-alias-list) @@ -96,10 +77,51 @@ t)) (error nil))) -(when-broken texinfo-format-uref - (fmakunbound 'texinfo-format-uref)) ; after defun-maybe +;;; Obsolete +;; Removed Texinfo 3.8 +(put 'overfullrule 'texinfo-format 'texinfo-discard-line) +(put 'smallbreak 'texinfo-format 'texinfo-discard-line) +(put 'medbreak 'texinfo-format 'texinfo-discard-line) +(put 'bigbreak 'texinfo-format 'texinfo-discard-line) +;; Removed Texinfo 3.9 +(put 'setchapterstyle 'texinfo-format 'texinfo-discard-line-with-args) + +;;; Hardcopy and HTML (discard) +;; I18N +(put 'documentlanguage 'texinfo-format 'texinfo-discard-line-with-args) +(put 'documentencoding 'texinfo-format 'texinfo-discard-line-with-args) + +;; size +(put 'smallbook 'texinfo-format 'texinfo-discard-line) +(put 'afourpaper 'texinfo-format 'texinfo-discard-line) +(put 'afourlatex 'texinfo-format 'texinfo-discard-line) +(put 'afourwide 'texinfo-format 'texinfo-discard-line) +(put 'pagesizes 'texinfo-format 'texinfo-discard-line-with-args) + +;; style +(put 'setchapternewpage 'texinfo-format 'texinfo-discard-line-with-args) +(put 'kbdinputstyle 'texinfo-format 'texinfo-discard-line-with-args) + +;; flags +(put 'setcontentsaftertitlepage 'texinfo-format 'texinfo-discard-line) +(put 'setshortcontentsaftertitlepage 'texinfo-format 'texinfo-discard-line) +(put 'novalidate 'texinfo-format 'texinfo-discard-line-with-args) + +;; head & foot +(put 'headings 'texinfo-format 'texinfo-discard-line-with-args) +(put 'evenfooting 'texinfo-format 'texinfo-discard-line-with-args) +(put 'evenheading 'texinfo-format 'texinfo-discard-line-with-args) +(put 'oddfooting 'texinfo-format 'texinfo-discard-line-with-args) +(put 'oddheading 'texinfo-format 'texinfo-discard-line-with-args) +(put 'everyfooting 'texinfo-format 'texinfo-discard-line-with-args) +(put 'everyheading 'texinfo-format 'texinfo-discard-line-with-args) + +;; misc +(put 'page 'texinfo-format 'texinfo-discard-line) +(put 'hyphenation 'texinfo-format 'texinfo-discard-command-and-arg) + ;;; Directory File ;; @direcategory (put 'dircategory 'texinfo-format 'texinfo-format-dircategory) @@ -125,12 +147,11 @@ (texinfo-pop-stack 'direntry)) -;;; Menus +;;; Block Enclosing and Conditional ;; @detailmenu ... @end detailmenu (put 'detailmenu 'texinfo-format 'texinfo-discard-line) (put 'detailmenu 'texinfo-end 'texinfo-discard-command) -;;; Block Enclosing ;; @smalldisplay ... @end smalldisplay (put 'smalldisplay 'texinfo-format 'texinfo-format-example) (put 'smalldisplay 'texinfo-end 'texinfo-end-example) @@ -139,7 +160,32 @@ (put 'smallformat 'texinfo-format 'texinfo-format-flushleft) (put 'smallformat 'texinfo-end 'texinfo-end-flushleft) +;; @ifnottex ... @end ifnottex +(put 'ifnottex 'texinfo-format 'texinfo-discard-line) +(put 'ifnottex 'texinfo-end 'texinfo-discard-command) + +;; @ifnothtml ... @end ifnothtml +(put 'ifnothtml 'texinfo-format 'texinfo-discard-line) +(put 'ifnothtml 'texinfo-end 'texinfo-discard-command) + +;; @ifnotinfo ... @end ifnotinfo +(put 'ifnotinfo 'texinfo-format 'texinfo-format-ifnotinfo) +(put 'endifnotinfo 'texinfo-format 'texinfo-discard-line) +(defun-maybe texinfo-format-ifnotinfo () + (delete-region texinfo-command-start + (progn (re-search-forward "@end ifnotinfo[ \t]*\n") + (point)))) + +;; @html ... @end html +(put 'html 'texinfo-format 'texinfo-format-html) +(put 'endhtml 'texinfo-format 'texinfo-discard-line) +(defun-maybe texinfo-format-html () + (delete-region texinfo-command-start + (progn (re-search-forward "@end html[ \t]*\n") + (point)))) + + ;;; Marking ;; @url, @env, @command (put 'url 'texinfo-format 'texinfo-format-code) @@ -149,6 +195,13 @@ ;; @acronym (put 'acronym 'texinfo-format 'texinfo-format-var) +(when-broken texinfo-format-var + (fmakunbound 'texinfo-format-var)) +(defun-maybe texinfo-format-var () + (let ((arg (texinfo-parse-expanded-arg))) + (texinfo-discard-command) + (insert (upcase arg)))) + ;; @key (put 'key 'texinfo-format 'texinfo-format-key) (defun-maybe texinfo-format-key () @@ -157,7 +210,7 @@ ;; @email{EMAIL-ADDRESS[, DISPLAYED-TEXT]} (put 'email 'texinfo-format 'texinfo-format-email) -(defun texinfo-format-email () +(defun-maybe texinfo-format-email () "Format EMAIL-ADDRESS and optional DISPLAYED-TXT. Insert < ... > around EMAIL-ADDRESS." (let ((args (texinfo-format-parse-args))) @@ -181,122 +234,7 @@ Insert < ... > around EMAIL-ADDRESS." (goto-char texinfo-command-start)) -;;; Cross References -;; @ref -(put 'ref 'texinfo-format 'texinfo-format-xref) - -;; @uref -(put 'uref 'texinfo-format 'texinfo-format-uref) -(defun-maybe texinfo-format-uref () - "Format URL and optional URL-TITLE. -Insert ` ... ' around URL if no URL-TITLE argument; -otherwise, insert URL-TITLE followed by URL in parentheses." - (let ((args (texinfo-format-parse-args))) - (texinfo-discard-command) - ;; if url-title - (if (nth 1 args) - (insert (nth 1 args) " (" (nth 0 args) ")") - (insert "`" (nth 0 args) "'")) - (goto-char texinfo-command-start))) - -;;; Conditional -;; @ifnottex ... @end ifnottex -(put 'ifnottex 'texinfo-format 'texinfo-discard-line) -(put 'ifnottex 'texinfo-end 'texinfo-discard-command) - -;; @ifnothtml ... @end ifnothtml -(put 'ifnothtml 'texinfo-format 'texinfo-discard-line) -(put 'ifnothtml 'texinfo-end 'texinfo-discard-command) - -;; @ifnotinfo ... @end ifnotinfo -(put 'ifnotinfo 'texinfo-format 'texinfo-format-ifnotinfo) -(put 'endifnotinfo 'texinfo-format 'texinfo-discard-line) -(defun-maybe texinfo-format-ifnotinfo () - (delete-region texinfo-command-start - (progn (re-search-forward "@end ifnotinfo[ \t]*\n") - (point)))) - -;; @html ... @end html -(put 'html 'texinfo-format 'texinfo-format-html) -(put 'endhtml 'texinfo-format 'texinfo-discard-line) -(defun texinfo-format-html () - (delete-region texinfo-command-start - (progn (re-search-forward "@end html[ \t]*\n") - (point)))) - -;;; Hardcopy and HTML (discard) -;; I18N -(put 'documentlanguage 'texinfo-format 'texinfo-discard-line-with-args) -(put 'documentencoding 'texinfo-format 'texinfo-discard-line-with-args) - -;; size -(put 'smallbook 'texinfo-format 'texinfo-discard-line) -(put 'afourpaper 'texinfo-format 'texinfo-discard-line) -(put 'afourlatex 'texinfo-format 'texinfo-discard-line) -(put 'afourwide 'texinfo-format 'texinfo-discard-line) -(put 'pagesizes 'texinfo-format 'texinfo-discard-line-with-args) - -;; style -(put 'setchapternewpage 'texinfo-format 'texinfo-discard-line-with-args) -(put 'kbdinputstyle 'texinfo-format 'texinfo-discard-line-with-args) - -;; flags -(put 'setcontentsaftertitlepage 'texinfo-format 'texinfo-discard-line) -(put 'setshortcontentsaftertitlepage 'texinfo-format 'texinfo-discard-line) -(put 'novalidate 'texinfo-format 'texinfo-discard-line-with-args) - -;; head & foot -(put 'headings 'texinfo-format 'texinfo-discard-line-with-args) -(put 'evenfooting 'texinfo-format 'texinfo-discard-line-with-args) -(put 'evenheading 'texinfo-format 'texinfo-discard-line-with-args) -(put 'oddfooting 'texinfo-format 'texinfo-discard-line-with-args) -(put 'oddheading 'texinfo-format 'texinfo-discard-line-with-args) -(put 'everyfooting 'texinfo-format 'texinfo-discard-line-with-args) -(put 'everyheading 'texinfo-format 'texinfo-discard-line-with-args) - -;; misc -(put 'page 'texinfo-format 'texinfo-discard-line) -(put 'hyphenation 'texinfo-format 'texinfo-discard-command-and-arg) - -;;; Special -;; @exampleindent - -;; @alias NEW=EXISTING (maybe invalid) -(put 'alias 'texinfo-format 'texinfo-alias) -(defun-maybe texinfo-alias () - (let ((start (1- (point))) - args) - (skip-chars-forward " ") - (save-excursion (end-of-line) (setq texinfo-command-end (point))) - (if (not (looking-at "\\([^=]+\\)=\\(.*\\)")) - (error "Invalid alias command") - (setq texinfo-alias-list - (cons - (cons - (buffer-substring (match-beginning 1) (match-end 1)) - (buffer-substring (match-beginning 2) (match-end 2))) - texinfo-alias-list)) - (texinfo-discard-command)))) - -;; @definfoenclose NEWCMD, BEFORE, AFTER - -;; @image{FILENAME, [WIDTH], [HEIGHT]} -(put 'image 'texinfo-format 'texinfo-format-image) -(defun-maybe texinfo-format-image () - (let ((args (texinfo-format-parse-args)) ; parse FILENAME? - filename) - (when (null (nth 0 args)) - (error "Invalid image command")) - (texinfo-discard-command) - ;; makeinfo uses FILENAME.txt - (setq filename (format "%s.txt" (nth 0 args))) - (message "Reading included file: %s" filename) - ;; verbatim for Info output - (goto-char (+ (point) (cadr (insert-file-contents filename)))))) - -;; @multitable COLUMN-WIDTH-SPEC' - - + ;;; Accents and Special characters ;; @pounds{} ==> # Pounds Sterling (put 'pounds 'texinfo-format 'texinfo-format-pounds) @@ -444,13 +382,80 @@ otherwise, insert URL-TITLE followed by URL in parentheses." (goto-char texinfo-command-start)) -;;; Obsolete Texinfo command (backward compatibility) -;; Removed Texinfo 3.8 -(put 'overfullrule 'texinfo-format 'texinfo-discard-line) -(put 'smallbreak 'texinfo-format 'texinfo-discard-line) -(put 'medbreak 'texinfo-format 'texinfo-discard-line) -(put 'bigbreak 'texinfo-format 'texinfo-discard-line) -;; Removed Texinfo 3.9 -(put 'setchapterstyle 'texinfo-format 'texinfo-discard-line-with-args) + +;;; Cross References +;; @ref, @xref +(put 'ref 'texinfo-format 'texinfo-format-xref) + +(when-broken texinfo-format-xref + (fmakunbound 'texinfo-format-xref)) +(defun-maybe texinfo-format-xref () + (let ((args (texinfo-format-parse-args))) + (texinfo-discard-command) + (insert "*Note ") + (let ((fname (or (nth 1 args) (nth 2 args)))) + (if (null (or fname (nth 3 args))) + (insert (car args) "::") + (insert (or fname (car args)) ": ") + (if (nth 3 args) + (insert "(" (nth 3 args) ")")) + (and (car args) (insert (car args))))))) + +;; @uref +(put 'uref 'texinfo-format 'texinfo-format-uref) +(when-broken texinfo-format-uref + (fmakunbound 'texinfo-format-uref)) +(defun-maybe texinfo-format-uref () + "Format URL and optional URL-TITLE. +Insert ` ... ' around URL if no URL-TITLE argument; +otherwise, insert URL-TITLE followed by URL in parentheses." + (let ((args (texinfo-format-parse-args))) + (texinfo-discard-command) + ;; if url-title + (if (nth 1 args) + (insert (nth 1 args) " (" (nth 0 args) ")") + (insert "`" (nth 0 args) "'")) + (goto-char texinfo-command-start))) + + + +;;; Special +;; @exampleindent + +;; @alias NEW=EXISTING +(put 'alias 'texinfo-format 'texinfo-alias) +(defun-maybe texinfo-alias () + (let ((start (1- (point))) + args) + (skip-chars-forward " ") + (save-excursion (end-of-line) (setq texinfo-command-end (point))) + (if (not (looking-at "\\([^=]+\\)=\\(.*\\)")) + (error "Invalid alias command") + (setq texinfo-alias-list + (cons + (cons + (buffer-substring (match-beginning 1) (match-end 1)) + (buffer-substring (match-beginning 2) (match-end 2))) + texinfo-alias-list)) + (texinfo-discard-command)))) + +;; @definfoenclose NEWCMD, BEFORE, AFTER + +;; @image{FILENAME, [WIDTH], [HEIGHT]} +(put 'image 'texinfo-format 'texinfo-format-image) +(defun-maybe texinfo-format-image () + (let ((args (texinfo-format-parse-args)) ; parse FILENAME? + filename) + (when (null (nth 0 args)) + (error "Invalid image command")) + (texinfo-discard-command) + ;; makeinfo uses FILENAME.txt + (setq filename (format "%s.txt" (nth 0 args))) + (message "Reading included file: %s" filename) + ;; verbatim for Info output + (goto-char (+ (point) (cadr (insert-file-contents filename)))) + (message "Reading included file: %s...done" filename))) + +;; @multitable COLUMN-WIDTH-SPEC' ;;; ptexinfmt.el ends here