emacs-pretest-bug
[Top][All Lists]
Advanced

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

Info-fontify-node doesn't refill paragraphs properly


From: Fabrice Bauzac
Subject: Info-fontify-node doesn't refill paragraphs properly
Date: Sat, 29 Mar 2003 16:23:08 +0100

When fontifying Info buffers, some paragraphs are refilled.  However, the 
filling is sometimes curious.  Here is an example:

================================================================
File: test.info,  Node: Top,  Up: (dir)

The Test Reference Manual
*************************

 - Scheme Procedure: open path flags [mode] C Function: scm_open
 - (path, flags, mode) Open the file named by PATH for reading and/or
 - writing.  FLAGS is an integer specifying how the file should be
 - opened.  MODE is an integer specifying the permission bits of the
 - file, if it needs to be created, before the umask (see *note Top::) is
 - applied.  The default is 666 (Unix itself has no default).


================================================================

To reproduce the bug above, create a test.texi file:

================================================================
@setfilename test.info
@settitle Test Reference Manual
@set MANUAL-EDITION 1.0

@node Top, , , (dir)
@top The Test Reference Manual

@deffn {Scheme Procedure} open path flags [mode]
@deffnx {C Function} scm_open (path, flags, mode)
Open the file named by @var{path} for reading and/or writing.
@var{flags} is an integer specifying how the file should be opened.
@var{mode} is an integer specifying the permission bits of the file,
if it needs to be created, before the umask (@pxref{Top}) is
applied.  The default is 666 (Unix itself has no default).
@end deffn
================================================================

Then create an Info file with `makeinfo test.texi' and look at it with
C-u C-h i /tmp/test.info

The problem seems to reside in the Info-fontify-node Lisp function,
which does this:

        (let ((fill-nobreak-invisible t))
          (goto-char (point-max))
          (while paragraph-markers
            (let ((m (car paragraph-markers)))
              (setq paragraph-markers (cdr paragraph-markers))
              (when (< m (point))
                (goto-char m)
                (fill-paragraph nil)
                (backward-paragraph 1))
              (set-marker m nil))))

I don't know how refilling is done normally to overcome a problematic
fill like this, but this might work:

        (let ((fill-nobreak-invisible t))
          (goto-char (point-max))
          (while paragraph-markers
            (let ((m (car paragraph-markers)))
              (setq paragraph-markers (cdr paragraph-markers))
              (when (< m (point))
                (goto-char m)
                (let (fill-prefix start end)
                  (save-excursion
                    (beginning-of-line)
                    (looking-at "\\W *")
                    (setq fill-prefix (match-string 0))
                    (previous-line 1)
                    (looking-at "\\W *")
                    (while (string= (match-string 0) fill-prefix)
                      (previous-line 1)
                      (looking-at "\\W *"))
                    (next-line 1)
                    (setq start (point-marker)))
                  (save-excursion
                    (beginning-of-line)
                    (next-line 1)
                    (looking-at "\\W *")
                    (while (string= (match-string 0) fill-prefix)
                      (next-line 1)
                      (looking-at "\\W *"))
                    (setq end (point-marker)))
                  (save-restriction
                    (narrow-to-region start end)
                    (fill-paragraph nil)))
                (backward-paragraph 1))
              (set-marker m nil))))


In GNU Emacs 21.3.50.2 (i686-pc-linux-gnu)
 of 2003-03-21 on noon.dnsalias.net
configured using `configure '--with-gtk' '--prefix=/home/noon/.prefix-emacs''

Important settings:
  value of $LC_ALL: fr_FR
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: fr_FR
  locale-coding-system: iso-latin-1
  default-enable-multibyte-characters: t

Recent input:
C-x b t m p <return> ! <return> C-h i C-x k <return> 
C-u C-h i M-p <return> C-x k <return> C-u C-h i M-p 
M-p M-p M-n <return> q C-h i C-x k <return> C-x b i 
n f <tab> <return> C-p C-p C-M-x <f8> * M-> C-p C-p 
C-e C-j q M-v C-u C-p C-u C-p C-u C-p C-M-x M-> C-p 
C-p C-p C-p C-e C-j C-x k <return> C-p C-p C-p M-f 
M-f M-b g e t - M-f <backspace> C-n C-e C-j q C-h i 
M-x r e s <backspace> p o <tab> r <tab> <return>

Recent messages:
Mark set
Wrote /tmp/test.texi
(Shell command succeeded with no output)
byte-code: No such anchor in tag table or node in tag table or file: Top
Info-fontify-node
Mark set
Info-fontify-node
Mark set
Making completion list...
Loading emacsbug...done

Thanks.

-- 
fabrice bauzac
Software should be free.  http://www.gnu.org/philosophy/why-free.html




reply via email to

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