GNU bug report logs -
#61400
Different filling for verbatim macros
Previous Next
Reported by: Arash Esbati <arash <at> gnu.org>
Date: Fri, 10 Feb 2023 08:53:01 UTC
Severity: normal
Done: Arash Esbati <arash <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
Message #65 received at 61400 <at> debbugs.gnu.org (full text, mbox):
Hi Keita,
Ikumi Keita <ikumi <at> ikumi.que.jp> writes:
> Thanks, now I'd like to push the attached commit. Any comments welcome.
Thanks, I think I have one minor comment. Take this example:
--8<---------------cut here---------------start------------->8---
\documentclass{article}
\usepackage{fvextra}
\begin{document}
\Verb{pre\cmd{test}p*st}
\end{document}
--8<---------------cut here---------------end--------------->8---
Put point on * and try
M-: (LaTeX-verbatim-macro-boundaries) RET
which returns nil. This is due to this part of the function:
(when (string= delimiter TeX-grop)
(setq delimiter (concat delimiter TeX-grcl)))
(goto-char (1+ end))
(skip-chars-forward (concat "^" delimiter))
What I don't understand it why the code does:
(when (string= delimiter TeX-grop)
(setq delimiter (concat delimiter TeX-grcl)))
which is "^{}"; I would have expected "^}" only because using \verb{foo{
is just asking for trouble and not officially supported IIRC. Even with
delimiter being "^}", this form:
(skip-chars-forward (concat "^" delimiter))
means stop before the first "}" which is not far enough in case we have
balanced braces in the argument (and only such are allowed). So I
suggest we change this part of the code like this:
--8<---------------cut here---------------start------------->8---
diff --git a/latex.el b/latex.el
index 03795cf4..bbb8cd29 100644
--- a/latex.el
+++ b/latex.el
@@ -3830,10 +3830,14 @@ of the macro argument as cons."
;; both the opening and the closing brace as an end marker.
;; Like that the function should work for \verb|...| as well
;; as for \url{...}.
- (when (string= delimiter TeX-grop)
- (setq delimiter (concat delimiter TeX-grcl)))
- (goto-char (1+ end))
- (skip-chars-forward (concat "^" delimiter))
+ (if (string= delimiter TeX-grop)
+ (progn
+ (goto-char end)
+ (re-search-forward "{[^}{]*\\(?:{[^}{]*}[^}{]*\\)*}"
+ (line-end-position) t)
+ (backward-char))
+ (goto-char (1+ end))
+ (skip-chars-forward (concat "^" delimiter)))
(when (<= orig (point))
(if arg-only
(cons (1+ end) (point))
--8<---------------cut here---------------end--------------->8---
Then we only need to solve the fontification issue ;-) WDYT?
Best, Arash
This bug report was last modified 2 years and 155 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.