auctex-devel
[Top][All Lists]
Advanced

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

Re: fill breaks verbatim macros not followed with spaces


From: Ikumi Keita
Subject: Re: fill breaks verbatim macros not followed with spaces
Date: Mon, 04 Jul 2022 14:54:03 +0900

[ Changed Cc: addresses and Subject: ]

Hi Arash,

There were still difficulties with my last proposal, so I took another
approach.

>>>>> Arash Esbati <arash@gnu.org> writes:
>> Following up myself, I think I have an idea which excludes the boundries
>> while looking for `font-latex-verbatim-face':
----------------------------------------------------------------------
(defun LaTeX-verbatim-p (&optional pos)
[...]
        (when LaTeX-shortvrb-chars
          (let* ((strings (mapcar #'string LaTeX-shortvrb-chars))
                 (regexp (concat "[^\\]"
                                 (mapconcat #'regexp-quote strings "\\|")))
                 (p (point))
                 (match (save-excursion
                          (re-search-forward regexp (line-end-position) t))))
----------------------------------------------------------------------
This regexp search doesn't match when the point is just before the
shortvrb delimiter even if the regexp is built as I suggested before.

----------------------------------------------------------------------
                 (save-excursion
                   (cl-oddp (how-many regexp (line-beginning-position) p)))
                 (save-excursion
                   (cl-evenp (how-many regexp (line-beginning-position) 
match)))))))))
----------------------------------------------------------------------
These `how-many's don't count as expected when there are adjacent
shortvrb quotes like |abc||xyz| .

So I ended up with a thought that this sort of matter should be handled
by emacs built-in syntax facilities. I expect the attached patch
addresses all issues discussed so far.

I changed the syntax for shortvrb delimiters from "|" (generic string
delimiters) to "\"" (string quotes) so that it can handle intermixed
expressions like this:
\documentclass{article}
\usepackage{shortvrb}
\MakeShortVerb{\|}
\MakeShortVerb{\"}
\begin{document}
Donec |posuere"augue| in quam.  "Mauris|ac"
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% LaTeX-shortvrb-chars: (?| ?\")
%%% End:

Even with this approach, backslash just before the closing shortvrb
delimiter like |xyz\| can't be handled correctly, but I think we can
live with that.

Regards,
Ikumi Keita
#StandWithUkraine #StopWarInUkraine

Attachment: revised-fix
Description: use syntax


reply via email to

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