From 8a978e488d26b830d08c57250c6393120958e789 Mon Sep 17 00:00:00 2001 From: yamaoka Date: Thu, 12 Apr 2012 02:38:22 +0000 Subject: [PATCH] ptexinfmt.el (texinfo-format-syntax-table): Modify character syntax of " and \ to w, as a workaround. (texinfo-format-comma): Support @comma. (texinfo-format-parse-args): Tweak it so as to work for @comma. --- utils/ChangeLog | 7 +++++++ utils/ptexinfmt.el | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) diff --git a/utils/ChangeLog b/utils/ChangeLog index c27dd04..6a6de42 100644 --- a/utils/ChangeLog +++ b/utils/ChangeLog @@ -1,3 +1,10 @@ +2012-04-12 Katsumi Yamaoka + + * ptexinfmt.el (texinfo-format-syntax-table): Modify character syntax + of " and \ to w, as a workaround. + (texinfo-format-comma): Support @comma. + (texinfo-format-parse-args): Tweak it so as to work for @comma. + 2011-04-20 TAKAHASHI Kaoru * ptexinfmt.el: Fix description comment style. diff --git a/utils/ptexinfmt.el b/utils/ptexinfmt.el index 2875efb..e3d9d1b 100644 --- a/utils/ptexinfmt.el +++ b/utils/ptexinfmt.el @@ -62,6 +62,11 @@ (require 'texinfmt) +;; Work around a problem that double-quotes at bol disappear: +;; @dfn{FOO} => FOO", ``BAR'' => BAR", \BAZ/ => BAZ/ +(modify-syntax-entry ?\" "w" texinfo-format-syntax-table) +(modify-syntax-entry ?\\ "w" texinfo-format-syntax-table) + ;;; Broken (defvar ptexinfmt-disable-broken-notice-flag t "If non-nil disable notice, when call `ptexinfmt-broken-facility'. @@ -1021,6 +1026,53 @@ which are indicated by the @copying ... @end copying command." (delete-region (match-beginning 0) (match-end 0)) (texinfo-insertcopying)))) + +;; @comma +(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)))) + (provide 'ptexinfmt) ;;; ptexinfmt.el ends here -- 1.7.10.4