auctex-devel
[Top][All Lists]
Advanced

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

Re: [AUCTeX-devel] Re: Fontifying of titles...


From: David Kastrup
Subject: Re: [AUCTeX-devel] Re: Fontifying of titles...
Date: Sat, 09 Apr 2005 12:50:08 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Ralf Angeli <address@hidden> writes:

> * David Kastrup (2005-04-09) writes:
>
>> Anyway, here is another idea for "Emergency wrapping": use
>> `vertical-motion' for checking that the wrap positions are still in
>> the physical screen line.  Maybe this should be done only if used
>> interactively, though.
>>
>> I was at first afraid that this would wreak havoc when the windows are
>> split horizontally, but that case could be catered for by binding
>> truncate-partial-width-windows to t.
>
> Something like this could work:
>
> (defun LaTeX-current-fill-column ()
>   (let ((col (current-fill-column))
>       (truncate-partial-width-windows t)
>       overfull)
>     (save-excursion
>       (move-to-column col)
>       (while (= (line-beginning-position)
>               (save-excursion
>                 (vertical-motion -1)
>                 (line-beginning-position)))
>       (setq overfull t)
>       (backward-char))
>       (if (and (< (current-column) col) overfull) (current-column) col))))
>
> You can call this instead of `current-fill-column' in
> `LaTeX-fill-region-as-para-do'.  It works while debugging with edebug
> but fails (i.e. gets only the first line right) when called via
> `M-q'.  Dunno why.

Maybe it is only called once per paragraph, and not once per line?
Anyway, would not something like

(save-excursion
  (let ((oldpoint (point)))
    (move-beginning-of-line)
    (if (or (< (vertical-motion 1) 1)
            (> (point) oldpoint))
        col
      (backward-char)
      (current-column))))

be more efficient since it would not have to loop?

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum




reply via email to

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