[gnus git] branch master updated: m0-9-53-gb54663c =1= infohack.el: Work for the case makeinfo is not available

Katsumi Yamaoka <[email protected]> Mon, 10 Feb 2014 04:59:00 +0100
Newsgroups gmane.emacs.gnus.cvs
Message-ID <[email protected]>
       via  b54663c1e8e546c5befa57c95c9a502bff073fd7 (commit)
      from  0606f000241707b6aea460c64f34185cf680dc0b (commit)


- Log -----------------------------------------------------------------
commit b54663c1e8e546c5befa57c95c9a502bff073fd7
Author: Katsumi Yamaoka <[email protected]>
Date:   Mon Feb 10 03:58:42 2014 +0000

    infohack.el: Work for the case makeinfo is not available
    
    infohack.el (texinfo-format-comma): Support @comma.
     (infohack-replace-unsupported): New function.
     (infohack): Use it.

diff --git a/texi/ChangeLog b/texi/ChangeLog
index ed50161..ea20ccf 100644
--- a/texi/ChangeLog
+++ b/texi/ChangeLog
@@ -1,3 +1,9 @@
+2014-02-10  Katsumi Yamaoka  <[email protected]>
+
+	* infohack.el (texinfo-format-comma): Support @comma.
+	(infohack-replace-unsupported): New function.
+	(infohack): Use it.
+
 2014-02-08  Glenn Morris  <[email protected]>
 
 	* auth.texi (GnuPG and EasyPG Assistant Configuration):
diff --git a/texi/infohack.el b/texi/infohack.el
index da86bd1..e2ca0a7 100644
--- a/texi/infohack.el
+++ b/texi/infohack.el
@@ -58,6 +58,51 @@ which are indicated by the @copying ... @end copying command."
       (delete-region (match-beginning 0) (match-end 0))
       (texinfo-insertcopying))))
 
+(if (fboundp 'texinfo-format-comma)
+    nil
+  (put 'comma 'texinfo-format 'texinfo-format-comma)
+  (defun texinfo-format-comma ()
+    (texinfo-parse-arg-discard)
+    (insert ",")
+    (put-text-property (1- (point)) (point) 'ignore t))
+
+  ;; Redefine this function so as to work for @comma
+  (defun texinfo-format-parse-args ()
+    (let ((start (1- (point)))
+	  next beg end
+	  args)
+      (search-forward "{")
+      (save-excursion
+	(texinfo-format-expand-region
+	 (point)
+	 (save-excursion (up-list 1) (1- (point)))))
+      ;; The following does not handle cross references of the form:
+      ;; `@xref{bullet, , @code{@@bullet}@{@}}.' because the
+      ;; re-search-forward finds the first right brace after the second
+      ;; comma.
+      (while (/= (preceding-char) ?\})
+	(skip-chars-forward " \t\n")
+	(setq beg (point))
+;;;	(re-search-forward "[},]")
+	;; Ignore commas that are derived from @comma{}.
+	(while (and (re-search-forward "[},]" nil t)
+		    (get-text-property (match-beginning 0) 'ignore)))
+;;;
+	(setq next (point))
+	(forward-char -1)
+	(skip-chars-backward " \t\n")
+	(setq end (point))
+	(cond ((< beg end)
+	       (goto-char beg)
+	       (while (search-forward "\n" end t)
+		 (replace-match " "))))
+	(push (if (> end beg) (buffer-substring-no-properties beg end))
+	      args)
+	(goto-char next))
+      ;;(if (eolp) (forward-char 1))
+      (setq texinfo-command-end (point))
+      (nreverse args))))
+
 (defun infohack-remove-unsupported ()
   (goto-char (point-min))
   (while (re-search-forward "@\\(end \\)?ifnottex" nil t) 
@@ -67,6 +112,19 @@ which are indicated by the @copying ... @end copying command."
     (delete-region (1+ (match-beginning 0))
 		   (search-forward "\n@end iflatex\n"))))
 
+(defun infohack-replace-unsupported ()
+  (goto-char (point-min))
+  (while (search-forward "@indicateurl{" nil t)
+    (replace-match "@url{"))
+  (goto-char (point-min))
+  (while (search-forward "@enumerate" nil t)
+    (narrow-to-region (point)
+		      (or (re-search-forward "@end[\t ]+enumerate" nil t)
+			  (point-max)))
+    (goto-char (point-min))
+    (while (re-search-forward "@item[\t ]+\\([^\t\n ]\\)" nil t)
+      (replace-match "@item\n\\1"))))
+
 (defun infohack-include-files ()
   "Insert @include files."
   (goto-char (point-min))
@@ -103,6 +161,7 @@ which are indicated by the @copying ... @end copying command."
     (setq coding-system buffer-file-coding-system)
     (infohack-remove-unsupported)
     (infohack-include-files)
+    (infohack-replace-unsupported)
     (texinfo-every-node-update) 
     (texinfo-format-buffer t) ;; Don't save any file.
     (setq default-directory dest-directory)

-----------------------------------------------------------------------
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we listed those
revisions in full, above.

Summary of changes:
 texi/ChangeLog   |    6 ++++++
 texi/infohack.el |   59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 65 insertions(+)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnus Project".

The branch, master has been updated


hooks/post-receive
-- 
Gnus Project