[Top][All Lists]

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

Re: [AUCTeX] A problem with \parencite and fill-paragraph

From: Ikumi Keita
Subject: Re: [AUCTeX] A problem with \parencite and fill-paragraph
Date: Fri, 31 Mar 2017 16:49:05 +0900

Hi Arash,

>>>>> Arash Esbati <address@hidden> writes:

> You need \B to match the end of a "not-word".  What do you think about a
> change like this?

I think your approach is basically OK.  (I vaguely remember
font-latex.el uses similar methods for building regexp.)

Let me make some comments on this code.

> \documentclass{article}
> \begin{document}

> \begin{verbatim}
> Eval:
> (defun LaTeX-paragraph-commands-regexp-make ()
>   "Return a regular expression matching defined paragraph commands."
>   (let (cmds symbs)
>     (dolist (mac (append LaTeX-paragraph-commands
>                          LaTeX-paragraph-commands-internal))
>       (if (string-match "[a-zA-Z]" mac)
>           (push mac cmds)
>         (push mac symbs)))
>     (concat (regexp-quote TeX-esc) "\\("
>             (regexp-opt cmds)
>             "\\b"
>             "\\|"
>             (regexp-opt symbs)
>             "\\B"
>             "\\)")))

(1) I'm wondering whether this "\B" is really necessary.  With this
"\B", "\[" followed by alphanumeric letters without separating spaces is
not considered as a start of a paragraph.  Forgive me if I'm saying
something stupid, but this fills
abc def ghi jkl
abc def ghi jkl \[xyz=123\] ABC DEF GHI JKL
when typing M-q with the point on the equation, while the original code
fills to
abc def ghi jkl
\[xyz=123\] ABC DEF GHI JKL
.  If the line "\\B" is omitted from the code above, the results are the
same.  Am I missing something?

(2) Considering the compatibility with older emacsen, the usage of
`regexp-opt' seems to require some more tweaks.  Without optional second
argument, `regexp-opt' of xemacs 21.4 does not enclose the result with
"\(" and "\)".

So I propose to change the `concat' part like this:
    (concat (regexp-quote TeX-esc) "\\(?:"
            (regexp-opt cmds "\\(?:")
            (regexp-opt symbs "\\(?:")

Ikumi Keita

reply via email to

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