Subject: bug#9461: 24.0.50; Weird behaviour in "show-parent-mode"

From: Dani Moncayo <[email-masked]>
Date: Thu, 8 Sep 2011 10:14:37 +0200

On Thu, Sep 8, 2011 at 01:59, Juri Linkov <[email-masked]> wrote:
>> 1. Create a new buffer: C-x b tmp <RET>
>> 2. Turn "show-paren-mode" on: M-x show-paren-mode <RET>
>> 3. Write "\(hello\)".
>> The resulting buffer appearance is shown in the attached file.
>> Why is Emacs trying to match the first "\" with the last ")"?
>
> It highlights with the face `show-paren-mismatch', not `show-paren-match'.

Yes, I know...

I didn't write the expected behavior because I thought it was obvious.
 But well, here we go:

As I see it, if I write "abc(def]", "(" and "]" are _both_ highlighted
with the mismatch font, which is logical, because there is a mismatch
on _both_ characters: the "(" should have a ")" after it (without any
"]" in between), and likely for the "]".

But if I write "abc\(def\)", there is a "(" that matches the ")", so I
don't understand why "a" and ")" are highlighted with the mismatch
font.  TRT would be to highlight both parentheses with the "match"
font.  Even if the ")" didn't have a matching "(", the "a" should
_never_ be highlighted, because that character doesn't expect any
other to match it (at least in fundamental mode, which is the current
one).

Also, one could think that the "close delimiter" meaning of ")" is
cancelled by the previous escape ("\"), but then I would expect that
no highlighting took place at all, because both parentheses are
escaped.

So, definitely something is wrong here, IMO.

-- 
Dani Moncayo