bug-texinfo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: address@hidden: texinfmt.el + kinsoku.el combined bug]


From: Kenichi Handa
Subject: Re: address@hidden: texinfmt.el + kinsoku.el combined bug]
Date: Mon, 25 Aug 2003 11:33:28 +0900 (JST)

In article <address@hidden>, Richard Stallman <address@hidden> writes:

> Would you please DTRT?

I include Robert J. Chassell <address@hidden>
(maintainer of textinfo) in CC:.

> ------- Start of forwarded message -------
> To: address@hidden
> From: Thierry Emery <address@hidden>
> Subject: texinfmt.el + kinsoku.el combined bug
[...]
> Actions and symptoms:
>  While installing the info part of the Japanese character input package
> "SKK 12.2.0" (see http://openlab.ring.gr.jp/skk/ ), the emacs command
>  `texinfo-format-buffer' fails on file "ddskk-12.2.0/doc/skk.texi" with
>  message "Invalid texinfo command arg format".

> Simplified scenario:
>  download http://openlab.ring.gr.jp/skk/maintrunk/ddskk-12.2.0.tar.bz2
>  bunzip2 -c ddskk-12.2.0.tar.bz2 | tar x ddskk-12.2.0/doc/skk.texi
>  emacs -q ddskk-12.2.0/doc/skk.texi
>  M-x texinfo-format-buffer

Thank you for the detailed report.  I can reproduce this bug
with emacs-21.3.  But, I couldn't reproduce it with the
latest CVS HEAD.  In this version, kinsoku.el is not
changed, but there were several changes in texinfmt.el.
Could you try with the emacs of CVS HEAD too?

Robert, by just reading ChangeLog, I couldn't find which
change in texinfmt.el fixed this problem.  Could you confirm
that the problem is surely fixed?

---
Ken'ichi HANDA
address@hidden

> Investigation results:
>  The file skk.texi contains "@footnotestyle end" and various "@footnote"
>  commands.
>  The "@footnote" command at point 26950 of this file is handled by
>  `texinfo-format-footnote', which calls `texinfo-format-end-node', which
>  calls `fill-paragraph', which calls `fill-region-as-paragraph', which itself
>  calls `kinsoku', which inserts a newline between the next @samp and its
>  opening brace.
>  This comes from the `kinsoku' settings for "{", which has category set "<al"
>  (as shown by M-x describe-categories in the unfinished skk.info buffer),
>  hence `kinsoku' refuses to insert a line break after "{", and from the
>  `kinsoku-shorter' logic which is willing to insert one before it.
>  Of course `texinfmt' does not tolerate this, and when processing the split
>  @samp command, `texinfo-parse-line-arg' signals an error with message
>  "Invalid texinfo command arg format".

> Tentative correction (see attached patch):
>  1) modify the character category for "{" (adding ">") in the texinfmt
>     working buffer,
>     N.B. this is not sufficient, then `kinsoku-shorter' inserts a line break
>          between "@sam" and "p{"...
>  2) prevent `kinsoku' from inserting a line break inside a non-kinsoku
>     (e.g. latin) word, making it skip until either a space or a character
>     with category "|".

> - 
> -----------------------------------------------------------------------------
> - --- lisp/textmodes/texinfmt.el.orig Sun Oct 28 10:10:32 2001
> +++ lisp/textmodes/texinfmt.el        Thu Aug 21 17:12:12 2003
> @@ -58,6 +58,7 @@
>  (require 'texnfo-upd)       ; So `texinfo-section-types-regexp' is defined.
 
>  (defvar texinfo-format-syntax-table nil)
> +(defvar texinfo-format-category-table nil)
 
>  (defvar texinfo-vindex)
>  (defvar texinfo-findex)
> @@ -103,6 +104,13 @@
>    (modify-syntax-entry ?} "){" texinfo-format-syntax-table)
>    (modify-syntax-entry ?\' "." texinfo-format-syntax-table))
 
> +;;; Category table
> +
> +(if texinfo-format-category-table
> +    nil
> +  (setq texinfo-format-category-table (copy-category-table 
> (standard-category-table)))
> +  ;; add that { should not be wrapped to beginning of next line
> +  (modify-category-entry ?{ ?> texinfo-format-category-table))
>  
>  ;;; Top level buffer and region formatting functions
 
> @@ -221,6 +229,7 @@
>      (setq fill-column fill-column-for-info)
>      ;; Install a syntax table useful for scanning command operands.
>      (set-syntax-table texinfo-format-syntax-table)
> +    (set-category-table texinfo-format-category-table)
 
>      ;; Insert @include files so `texinfo-raise-lower-sections' can
>      ;; work on them without losing track of multiple
> @@ -378,6 +387,7 @@
 
>      (setq fill-column fill-column-for-info)
>      (set-syntax-table texinfo-format-syntax-table)
> +    (set-category-table texinfo-format-category-table)
 
>      (insert-buffer-substring input-buffer)
>      (message "Converting %s to Info format..." (buffer-name input-buffer))
> - --- lisp/international/kinsoku.el.orig      Sun Jul 15 21:53:53 2001
> +++ lisp/international/kinsoku.el     Thu Aug 21 18:38:20 2003
> @@ -123,7 +123,11 @@
>  (defun kinsoku-longer ()
>    (let ((pos-and-column (save-excursion
>                         (forward-char 1)
> - -                     (while (aref (char-category-set (following-char)) ?>)
> +                       (while (and (not (eobp))
> +                                   (or (aref (char-category-set 
> (following-char)) ?>)
> +                                       ;; protect non-kinsoku words
> +                                       (not (or (eq (preceding-char) ? )
> +                                                (aref (char-category-set 
> (preceding-char)) ?|)))))
>                           (forward-char 1))
>                         (cons (point) (current-column)))))
>      (if (or (<= kinsoku-limit 0)
> @@ -137,7 +141,10 @@
>              (forward-char -1)
>              (while (and (< linebeg (point))
>                          (or (aref (char-category-set (preceding-char)) ?<)
> - -                          (aref (char-category-set (following-char)) ?>)))
> +                            (aref (char-category-set (following-char)) ?>)
> +                            ;; protect non-kinsoku words
> +                            (not (or (eq (preceding-char) ? )
> +                                     (aref (char-category-set 
> (preceding-char)) ?|)))))
>                (forward-char -1))
>              (point))))
>      (if (< linebeg pos)
> - 
> -----------------------------------------------------------------------------
> 2003-08-21  Thierry Emery <address@hidden>

>       * texinfmt.el (texinfo-format-category-table): new variable for a
>           category table which is based on the standard one and adds category
>           ">" to character "{".
>           (texinfo-format-region, texinfo-format-buffer-1): set category
>           table of working buffer to previous variable, to prevent kinsoku
>           from splitting texinfo command names from their arguments.

>         * kinsoku.el (kinsoku-longer, kinsoku-shorter): do not choose a line
>           break position in the middle of a non-kinsoku (e.g. latin) word,
>           making it skip until either a space or a character with category 
> "|".
>           (kinsoku-longer): test for end of buffer.


> _______________________________________________
> Bug-gnu-emacs mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/bug-gnu-emacs
> ------- End of forwarded message -------







reply via email to

[Prev in Thread] Current Thread [Next in Thread]