auctex
[Top][All Lists]
Advanced

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

Re: [AUCTeX] Spurious newline after folded macros.


From: Juan Jose Garcia-Ripoll
Subject: Re: [AUCTeX] Spurious newline after folded macros.
Date: Wed, 25 Apr 2018 19:54:13 +0200

I would like to thank you all for investigating this issue. I tried using TeX-fold but was prevented from doing so because of the many spurious newlines and also because of the overall lag in the resulting buffer. Are both related? Could you help me investigate this?

On Wed, Apr 25, 2018 at 6:16 PM, Ikumi Keita <address@hidden> wrote:
Hi Joost,

>>>>> Joost Kremers <address@hidden> writes:
> Hi all,
> On Fri, Mar 23 2018, Joost Kremers wrote:
>> After the recent AUCTeX update to version 12.1.1 (which I installed
>> just two days ago, due to having been on vacation), I noticed a
>> strange problem with TeX-fold-mode. After a folded macro, there is a
>> spurious newline, i.e., the text is continued on the next line, even
>> though there is no newline in the actual text.

> I posted this message about a month ago, but I haven't received any
> replies. I *really* don't want to be the guy that starts whining when
> their question goes unanswered on a public mailing list, but this
> issue happens even with `emacs -Q', so I find it hard to imagine that
> I'm the only one seeing it...

> I just realised that I can examine the contents of the overlay with
> `C-u C-x =', and so I did, and I found that indeed, the overlay
> contains an extra "\n". This is for example the overlay on
> "\textit{Aliquam}" in the screenshots I sent:

> #("Aliquam\n" 0 7
>  (wrap-prefix "" face
>               (font-latex-italic-face)
>               fontified t))

> I also noticed that sometimes, the newline isn't added, though I
> haven't been able to figure out what conditions it. I have, for
> example, an \item in a beamer presentation that shows the problem, but
> when I make the text of the \item shorter, the problem disappears. (I
> confirmed that in the former case, the overlay text is "*\n" and in
> the latter just "*".)

> So here's hoping this time around someone may be able to help.

Thank you for your report.  I think I found out the origin of the
behavior you reported.  Could you please try the following modified
function?  I.e., put the point (cursor) just after the last ")", type
C-x C-e and try folding again in the latex document buffer.  I expect
that the previous behavior is recovered.
If this fixes the problem, I'll install the change in the git
repository.

(defun TeX-fold-overfull-p (ov-start ov-end display-string)
  "Return t if an overfull line will result after adding an overlay.
The overlay extends from OV-START to OV-END and will display the
string DISPLAY-STRING."
  (and
   (save-excursion
     (goto-char ov-end)
     (search-backward "\n" ov-start t))
   (not (string-match "\n" display-string))
   (> (+ (- ov-start
            (save-excursion
              (goto-char ov-start)
              (line-beginning-position)))
         (length display-string)
         (- (save-excursion
              (goto-char ov-end)
              (line-end-position))
            ov-end))
      (current-fill-column))))

Regards,
Ikumi Keita

_______________________________________________
auctex mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/auctex


reply via email to

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