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

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

bug#63441: closed (Wrong Indentation with backslash in verb macros with


From: GNU bug Tracking System
Subject: bug#63441: closed (Wrong Indentation with backslash in verb macros with braces)
Date: Thu, 11 May 2023 19:43:02 +0000

Your message dated Thu, 11 May 2023 21:42:22 +0200
with message-id <86lehuac4h.fsf@gnu.org>
and subject line Re: bug#63441: Wrong Indentation with backslash in verb macros 
with braces
has caused the debbugs.gnu.org bug report #63441,
regarding Wrong Indentation with backslash in verb macros with braces
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs@gnu.org.)


-- 
63441: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=63441
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
--- Begin Message --- Subject: Wrong Indentation with backslash in verb macros with braces Date: Thu, 11 May 2023 10:36:06 +0200 User-agent: Gnus/5.13 (Gnus v5.13)
Hi all,

I just installed a change (commit 0cb158fd96) which improves
fontification of arguments of verb macros with braces.  One addition is
also handling of backslash(es) as last character(s) in the argument.
There is a downside, though.  Consider the following file:

--8<---------------cut here---------------start------------->8---
\documentclass{article}
\usepackage{url}
\begin{document}

This is text with \textbf{foo\}
  bar}

\path{foobar\}
next line

\end{document}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
--8<---------------cut here---------------end--------------->8---

Now mark the text body and indent with 'M-x indent-region RET' or with
C-M-\ and you get:

--8<---------------cut here---------------start------------->8---
This is text with \textbf{foo\}
  bar}

\path{foobar\}
  next line
--8<---------------cut here---------------end--------------->8---

which is wrong.  This is due to the implementation of
`TeX-brace-count-line' which presumes that ?\\ always escapes the next
char, which is wrong in verb macros.  I can think of a solution like
this:

--8<---------------cut here---------------start------------->8---
diff --git a/tex.el b/tex.el
index b862d3c2..4663b217 100644
--- a/tex.el
+++ b/tex.el
@@ -5485,7 +5485,9 @@ additional characters."
                         (setq count (- count TeX-brace-indent-level)))
                        ((eq char ?\\)
                         (when (< (point) limit)
-                          (forward-char)
+                          (unless (and (fboundp 'LaTeX-verbatim-p)
+                                       (LaTeX-verbatim-p))
+                            (forward-char))
                           t))))))
       count)))
--8<---------------cut here---------------end--------------->8---

Any comments oder better approaches?

Best, Arash



--- End Message ---
--- Begin Message --- Subject: Re: bug#63441: Wrong Indentation with backslash in verb macros with braces Date: Thu, 11 May 2023 21:42:22 +0200 User-agent: Gnus/5.13 (Gnus v5.13)
Hi Keita,

Ikumi Keita <ikumi@ikumi.que.jp> writes:

> I don't think `fboundp' test is a right approach because it calls
> `LaTeX-verbatim-p' even in non-LaTeX mode buffers after the session
> loads latex.el. How about just
> (TeX-verbatim-p)
> instead of
> (and (fboundp 'LaTeX-verbatim-p)
>      (LaTeX-verbatim-p))
> ?

Thanks for reminding me, you're right, that's the way to go.  I
installed the change per your suggestion (commit 715a88a5f2).  Closing
this report.

Best, Arash


--- End Message ---

reply via email to

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