auctex-devel
[Top][All Lists]
Advanced

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

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


From: Ralf Angeli
Subject: [AUCTeX-devel] Re: Fontifying of titles...
Date: Sat, 09 Apr 2005 13:29:35 +0200
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/22.0.50 (gnu/linux)

* David Kastrup (2005-04-09) writes:

> Ralf Angeli <address@hidden> writes:
>
>> 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?

I don't see a reason why it should be called only once when not under
debugger control.

> Anyway, would not something like
>
> (save-excursion
>   (let ((oldpoint (point)))
>     (move-beginning-of-line)
>     (if (or (< (vertical-motion 1) 1)

(vertical-motion 1) returns something smaller than 1 when invoked on
a wrapped line?  For me it always returns 1, both on overlong and
non-overlong lines.

>             (> (point) oldpoint))
>         col
>       (backward-char)
>       (current-column))))
>
> be more efficient since it would not have to loop?

Anyway, I took the idea and merged it with what I had.  The following
patch should work (hasn't got too much testing, though):

--- latex.el    06 Apr 2005 08:49:24 +0200      5.356
+++ latex.el    09 Apr 2005 13:22:56 +0200      
@@ -2504,7 +2504,7 @@
                                     (line-beginning-position))
                                  fill-column))))
            (setq linebeg (point))
-           (move-to-column (current-fill-column))
+           (move-to-column (LaTeX-current-fill-column))
            (if (when (< (point) (marker-position end-marker))
                  ;; Find the position where we'll break the line.
                  (forward-char 1)      ; Use an immediately following
@@ -2566,6 +2566,15 @@
       ;; Return the fill-prefix we used
       fill-prefix)))
 
+(defun LaTeX-current-fill-column ()
+  (let ((truncate-partial-width-windows t))
+    (save-excursion
+      (beginning-of-line)
+      (if (and (= (point) (progn (vertical-motion 1) 
(line-beginning-position)))
+              (< (current-column) (current-fill-column)))
+         (1- (current-column))
+       (current-fill-column)))))
+
 ;; Following lines are copied from `fill.el' (CVS Emacs, March 2005).
 ;;   The `fill-space' property carries the string with which a newline should 
be
 ;;   replaced when unbreaking a line (in fill-delete-newlines).  It is added to
-- 
Ralf

reply via email to

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