[Top][All Lists]
[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: |
Thu, 4 Sep 2003 08:30:52 +0900 (JST) |
User-agent: |
SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/21.2.92 (sparc-sun-solaris2.6) MULE/5.0 (SAKAKI) |
In article <address@hidden>, Thierry Emery <address@hidden> writes:
> I agree, and as i'm not working today, i made an attempt at it...
> What do you think of the attached patch for texinfo.el, which
> introduces `texinfo-fill-nobreak-predicate' (inspired from
> `latex-fill-nobreak-predicate') ?
Thank you.
To the maintainer of textinfo.el:
Please take a look at the patch and decide to install it or
not.
---
Ken'ichi HANDA
address@hidden
> Moreover, i attach a new test file, with paragraphs for @samp, @code and @kbd
> for testing `texinfo-fill-nobreak-predicate', but also with a paragraph for
> @xref, which requires the previous kinsoku.el modification (i have checked in
> CVS emacs/man/*.texi that line breaking inside @xref is quite common, while
> it is not found for @samp, @code and @kbd).
> The test procedure is roughly the same:
> emacs -q test3.texi
> C-s samp
> M-q
> M-}
> M-q
> M-}
> M-q
> M-}
> M-q
> Thierry
> [2 patch-texinfo <application/octet-stream (7bit)>]
> diff -u lisp/textmodes/texinfo.el.orig lisp/textmodes/texinfo.el
> --- lisp/textmodes/texinfo.el.orig Sun Jul 13 19:15:47 2003
> +++ lisp/textmodes/texinfo.el Mon Sep 1 10:14:10 2003
> @@ -583,6 +583,8 @@
> (concat "\b\\|@[a-zA-Z]*[ \n]\\|" paragraph-separate))
> (make-local-variable 'paragraph-start)
> (setq paragraph-start (concat "\b\\|@[a-zA-Z]*[ \n]\\|" paragraph-start))
> + (set (make-local-variable 'fill-nobreak-predicate)
> + 'texinfo-fill-nobreak-predicate)
> (make-local-variable 'adaptive-fill-mode)
> (setq adaptive-fill-mode nil)
> (make-local-variable 'fill-column)
> @@ -630,6 +632,25 @@
> prevent-filling
> (concat auto-fill-inhibit-regexp "\\|" prevent-filling)))))
> +(defun texinfo-fill-nobreak-predicate ()
> + "Function assigned to local variable `fill-nobreak-predicate'
> +to prevent breaking inside @code{...}, @kbd{...} and @samp{...}"
> + (let ((origin (point))
> + inside-p)
> + (beginning-of-line)
> + (while (and (< (point) origin)
> + (re-search-forward "@\\(code\\|kbd\\|samp\\){" origin t))
> + (setq inside-p t)
> + (while (and (< (point) origin)
> + (not (= (following-char) ?})))
> + (condition-case nil
> + (forward-sexp)
> + (error (goto-char origin))))
> + (unless (>= (point) origin)
> + (forward-char 1)
> + (setq inside-p nil)))
> + (goto-char origin)
> + inside-p))