emacs-devel
[Top][All Lists]
Advanced

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

Re: Bug?


From: Shynur Xie
Subject: Re: Bug?
Date: Thu, 4 May 2023 08:35:40 +0000

Hi, Eli.

In my last email, I mentioned that highlighting only 1 character is
the original behavior of the function `blink-matching-open':

> From: Shynur Xie <one.last.kiss@outlook.com>
>   To: Mattias Engdegård
>   Cc: emacs-devel; Po Lu
>
>> I also noticed that when the closing bracket is comprised of
>> multiple characters, only the first character is high-lit using
>> that face.
>
> That is the original behavior of `blink-matching-open' -- it only
> highlights the first character.  (What you expected is provided by
> `show-paren-mode'.)  It uses `forward-sexp' to move point to the
> first character (in your example, it's `c`), but `forward-sexp'
> doesn't report the length of this keyword (i.e., `case`).

I also find that, the mode `show-paren-mode' (which highlights an
entire matched keyword) also emits a message "Matches %s" which will
override what `blink-matching-open' does, when that mode's own option
`show-paren-context-when-offscreen' is t.

In conclusion, before my patch was installed, by default,
`blink-matching-open' highlighted only 1 matched character when that
character is on-screen; `show-paren-mode' highlighted the entire
keyword.  But both of them didn't highlight the matched off-screen
openparen shown in the echo area.  After my patch was installed,
`blink-matching-open' highlights the 1st character when that character
is off-screen, as well as how it does originally when the character is
on-screen.

So I'm now wondering, would it be better to write the functionality
(highlighting an entire matched keyword when it is shown in the echo
area) into <lisp/paren.el> instead of <lisp/simple.el> (and make it a
part of `show-paren-mode')?  My opinion is, if `blink-matching-open'
highlights the entire matched keyword in the echo area, why doesn't it
also highlight an entire keyword that is on-screen?  But if it does,
`blink-matching-open' and `show-paren-mode' will conflict/duplicate in
function/code.  If we make that functionality a part of
`show-paren-mode', not only is behavioral consistency guaranteed in
all respects, but that functionality can simply reuse the logic/code
of `show-paren-mode'.

Any suggstion?  Thanks.

--
shynur



reply via email to

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