[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [AUCTeX] A problem with \parencite and fill-paragraph
From: |
Arash Esbati |
Subject: |
Re: [AUCTeX] A problem with \parencite and fill-paragraph |
Date: |
Sat, 01 Apr 2017 14:01:25 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.2 |
Ikumi Keita <address@hidden> writes:
>>>>>> 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.)
>
> (1) I'm wondering whether this "\B" is really necessary.
Hi Keita,
no, \B is not really necessary, I just wanted to say that appending \b
to the complete regexp would not work for \[; it would be \B or
nothing. And dropping \B is more versatile.
> (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 "\\(?:")
> "\\b"
> "\\|"
> (regexp-opt symbs "\\(?:")
> "\\)")
Thanks for raising the compat issue. I will install this (dopping
"\\(?:" for the second regexp):
--8<---------------cut here---------------start------------->8---
(defun LaTeX-paragraph-commands-regexp-make ()
"Return a regular expression matching defined paragraph commands.
Regexp part containing TeX control words is postfixed with `\\b'
to avoid ambiguities (e.g. \\par vs. \\parencite)."
(let (cmds symbs)
(dolist (mac (append LaTeX-paragraph-commands
LaTeX-paragraph-commands-internal))
(if (string-match "[^a-zA-Z]" mac)
(push mac symbs)
(push mac cmds)))
(concat (regexp-quote TeX-esc) "\\(?:"
(regexp-opt cmds "\\(?:")
"\\b"
"\\|"
(regexp-opt symbs)
"\\)")))
--8<---------------cut here---------------end--------------->8---
Best, Arash
- Re: [AUCTeX] A problem with \parencite and fill-paragraph,
Arash Esbati <=