unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Shynur Xie <one.last.kiss@outlook.com>
To: "Eli Zaretskii" <eliz@gnu.org>, "Mattias Engdegård" <mattiase@acm.org>
Cc: "emacs-devel@gnu.org" <emacs-devel@gnu.org>,
	"luangruo@yahoo.com" <luangruo@yahoo.com>
Subject: Re: Bug?
Date: Thu, 4 May 2023 08:35:40 +0000	[thread overview]
Message-ID: <SA0PR04MB7433EE89B5395D2A41463DE0D76D9@SA0PR04MB7433.namprd04.prod.outlook.com> (raw)
In-Reply-To: <838re5mzcu.fsf@gnu.org>

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



  parent reply	other threads:[~2023-05-04  8:35 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <875y9aciir.fsf.ref@yahoo.com>
2023-05-03  1:26 ` Bug? Po Lu
2023-05-03  9:40   ` Bug? Mattias Engdegård
2023-05-03 10:12     ` Bug? Mattias Engdegård
2023-05-03 11:24       ` Bug? Shynur Xie
2023-05-03 12:27         ` Bug? Mattias Engdegård
2023-05-03 17:22           ` Bug? Juri Linkov
2023-05-03 11:24       ` Bug? Eli Zaretskii
2023-05-03 11:26         ` Bug? Shynur Xie
2023-05-04  8:35         ` Shynur Xie [this message]
2023-05-04 20:57         ` Bug? Shynur Xie
2023-05-05  4:41           ` Bug? Eli Zaretskii
2023-05-05 16:18             ` Bug? Shynur Xie
2023-05-06 10:44           ` Bug? Mattias Engdegård
2023-05-06 14:58             ` Bug? Shynur Xie
2023-05-06 15:24               ` Bug? Eli Zaretskii
2023-05-07 11:08               ` Bug? Mattias Engdegård
2023-05-07 12:05                 ` Bug? Po Lu
2023-05-07 12:17                   ` Bug? Eli Zaretskii
2023-05-07 12:54                     ` Bug? Po Lu
2023-05-07 13:36                     ` Bug? Shynur Xie
2023-05-07 13:51                       ` Bug? Mattias Engdegård
2023-05-07 14:42                         ` Bug? Shynur Xie
2023-05-07 15:06                           ` Bug? Eli Zaretskii
2023-05-03 11:23     ` Bug? Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SA0PR04MB7433EE89B5395D2A41463DE0D76D9@SA0PR04MB7433.namprd04.prod.outlook.com \
    --to=one.last.kiss@outlook.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=luangruo@yahoo.com \
    --cc=mattiase@acm.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).