aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert J. Chassell2002-12-06 19:43:49 +0000
committerRobert J. Chassell2002-12-06 19:43:49 +0000
commita66ccdcf77eb5fdb4dd0ce7a9c971ce7e3d97333 (patch)
tree5b102a008545885324d9f1f7483fc27c310c0566
parent983209d0dccccef2523d955d078b1751e3d608db (diff)
downloademacs-a66ccdcf77eb5fdb4dd0ce7a9c971ce7e3d97333.tar.gz
emacs-a66ccdcf77eb5fdb4dd0ce7a9c971ce7e3d97333.zip
(texinfo-format-scan) Handle new functions for copyright
notice and copying permissions. (texinfo-copying, texinfo-insertcopying): New functions. Installed for TAKAHASHI Kaoru <kaoru@kaisei.org> (texinfo-format-xml): New function. (ifxml, ifnotxml): New aliases.
-rw-r--r--lisp/textmodes/texinfmt.el57
1 files changed, 52 insertions, 5 deletions
diff --git a/lisp/textmodes/texinfmt.el b/lisp/textmodes/texinfmt.el
index bb425517b57..71af8e44a51 100644
--- a/lisp/textmodes/texinfmt.el
+++ b/lisp/textmodes/texinfmt.el
@@ -37,7 +37,7 @@
37 (defmacro defcustom (var value doc &rest ignore) 37 (defmacro defcustom (var value doc &rest ignore)
38 `(defvar ,var ,value ,doc))) 38 `(defvar ,var ,value ,doc)))
39 39
40(defvar texinfmt-version "2.39 of 24 Nov 2002") 40(defvar texinfmt-version "2.40 of 6 Dec 2002")
41 41
42(defun texinfmt-version (&optional here) 42(defun texinfmt-version (&optional here)
43 "Show the version of texinfmt.el in the minibuffer. 43 "Show the version of texinfmt.el in the minibuffer.
@@ -825,7 +825,16 @@ lower types.")
825 825
826(defun texinfo-format-scan () 826(defun texinfo-format-scan ()
827 (texinfo-format-convert (point-min) (point-max)) 827 (texinfo-format-convert (point-min) (point-max))
828 ;; Scan for @-commands. 828 ;; Search for @copying, which has to be first since the
829 ;; @insertcopying command then inserts the text elsewhere.
830 (goto-char (point-min))
831 (when (search-forward "@copying" nil t)
832 (texinfo-copying))
833 (while (search-forward "@insertcopying" nil t)
834 (delete-region (match-beginning 0) (match-end 0))
835
836 (texinfo-insertcopying))
837 ;; Scan for other @-commands.
829 (goto-char (point-min)) 838 (goto-char (point-min))
830 (while (search-forward "@" nil t) 839 (while (search-forward "@" nil t)
831 ;; 840 ;;
@@ -931,7 +940,30 @@ lower types.")
931 940
932 (cond (texinfo-stack 941 (cond (texinfo-stack
933 (goto-char (nth 2 (car texinfo-stack))) 942 (goto-char (nth 2 (car texinfo-stack)))
934 (error "Unterminated @%s" (car (car texinfo-stack)))))) 943 (error "Unterminated @%s" (car (car texinfo-stack)))))
944
945 ;; Remove excess whitespace
946 (whitespace-cleanup))
947
948(defvar texinfo-copying-text ""
949 "Text of the copyright notice and copying permissions.")
950
951(defun texinfo-copying ()
952 "Copy the copyright notice and copying permissions from the Texinfo file,
953as indicated by the @copying ... @end copying command;
954insert the text with the @insertcopying command."
955 (let ((beg (progn (beginning-of-line) (point)))
956 (end (progn (re-search-forward "^@end copying[ \t]*\n") (point))))
957 (setq texinfo-copying-text
958 (buffer-substring-no-properties
959 (save-excursion (goto-char beg) (forward-line 1) (point))
960 (save-excursion (goto-char end) (forward-line -1) (point))))
961 (delete-region beg end)))
962
963(defun texinfo-insertcopying ()
964 "Insert the copyright notice and copying permissions from the Texinfo file,
965which are indicated by the @copying ... @end copying command."
966 (insert (concat "\n" texinfo-copying-text)))
935 967
936(put 'begin 'texinfo-format 'texinfo-format-begin) 968(put 'begin 'texinfo-format 'texinfo-format-begin)
937(defun texinfo-format-begin () 969(defun texinfo-format-begin ()
@@ -2135,8 +2167,8 @@ This command is executed when texinfmt sees @item inside @multitable."
2135 (setq fill-column existing-fill-column))) 2167 (setq fill-column existing-fill-column)))
2136 2168
2137 2169
2138;;; @ifinfo, @iftex, @tex, @ifhtml, @html, @ifplaintext 2170;;; @ifinfo, @iftex, @tex, @ifhtml, @html, @ifplaintext, @ifxml, @xml
2139;; @ifnottex, @ifnotinfo, @ifnothtml, @ifnotplaintext 2171;; @ifnottex, @ifnotinfo, @ifnothtml, @ifnotplaintext, @ifnotxml
2140 2172
2141(put 'ifinfo 'texinfo-format 'texinfo-discard-line) 2173(put 'ifinfo 'texinfo-format 'texinfo-discard-line)
2142(put 'ifinfo 'texinfo-end 'texinfo-discard-command) 2174(put 'ifinfo 'texinfo-end 'texinfo-discard-command)
@@ -2159,6 +2191,12 @@ This command is executed when texinfmt sees @item inside @multitable."
2159 (progn (re-search-forward "@end ifplaintext[ \t]*\n") 2191 (progn (re-search-forward "@end ifplaintext[ \t]*\n")
2160 (point)))) 2192 (point))))
2161 2193
2194(put 'ifxml 'texinfo-format 'texinfo-format-ifxml)
2195(defun texinfo-format-ifxml ()
2196 (delete-region texinfo-command-start
2197 (progn (re-search-forward "^@end ifxml[ \t]*\n")
2198 (point))))
2199
2162(put 'tex 'texinfo-format 'texinfo-format-tex) 2200(put 'tex 'texinfo-format 'texinfo-format-tex)
2163(defun texinfo-format-tex () 2201(defun texinfo-format-tex ()
2164 (delete-region texinfo-command-start 2202 (delete-region texinfo-command-start
@@ -2171,6 +2209,12 @@ This command is executed when texinfmt sees @item inside @multitable."
2171 (progn (re-search-forward "@end html[ \t]*\n") 2209 (progn (re-search-forward "@end html[ \t]*\n")
2172 (point)))) 2210 (point))))
2173 2211
2212(put 'xml 'texinfo-format 'texinfo-format-xml)
2213(defun texinfo-format-xml ()
2214 (delete-region texinfo-command-start
2215 (progn (re-search-forward "^@end xml[ \t]*\n")
2216 (point))))
2217
2174(put 'ifnotinfo 'texinfo-format 'texinfo-format-ifnotinfo) 2218(put 'ifnotinfo 'texinfo-format 'texinfo-format-ifnotinfo)
2175(defun texinfo-format-ifnotinfo () 2219(defun texinfo-format-ifnotinfo ()
2176 (delete-region texinfo-command-start 2220 (delete-region texinfo-command-start
@@ -2186,6 +2230,9 @@ This command is executed when texinfmt sees @item inside @multitable."
2186(put 'ifnothtml 'texinfo-format 'texinfo-discard-line) 2230(put 'ifnothtml 'texinfo-format 'texinfo-discard-line)
2187(put 'ifnothtml 'texinfo-end 'texinfo-discard-command) 2231(put 'ifnothtml 'texinfo-end 'texinfo-discard-command)
2188 2232
2233(put 'ifnotxml 'texinfo-format 'texinfo-discard-line)
2234(put 'ifnotxml 'texinfo-end 'texinfo-discard-command)
2235
2189 2236
2190;;; @titlepage 2237;;; @titlepage
2191 2238