From: Eli Zaretskii <eliz@gnu.org>
To: Shynur Xie <one.last.kiss@outlook.com>
Cc: 63089@debbugs.gnu.org
Subject: bug#63089: [PATCH] Display offscreen matched openparen
Date: Fri, 28 Apr 2023 09:28:53 +0300 [thread overview]
Message-ID: <834jp0seoq.fsf@gnu.org> (raw)
In-Reply-To: <SA0PR04MB74334F774F1484F0A1CB3835D7659@SA0PR04MB7433.namprd04.prod.outlook.com> (message from Shynur Xie on Wed, 26 Apr 2023 13:39:17 +0000)
> From: Shynur Xie <one.last.kiss@outlook.com>
> Date: Wed, 26 Apr 2023 13:39:17 +0000
>
> A line containing the matched open parenthesis will be displayed in
> the echo area if that parenthesis is offscreen when the user types a
> close parenthesis.
>
> However, for example, the matched line may contain so many parentheses
>
> ```
> (... (... ((((((((
> ...
> ...
> ```
>
> that user will be confused by the text displayed in the echo area:
>
> ```
> (... (... (((((
> ```
>
> This patch changed a Lisp function `blink-matching-open' and rewrote a
> Lisp function `blink-paren-open-paren-line-string' in order to help
> user recognize the matched parenthesis more easily.
Thanks.
First, I think this should be an opt-in behavior, not the default. We
remove properties from the text we show in the echo-area for a reason.
So please add a user option to enable this behavior.
Also, please don't unnecessarily introduce whitespace differences into
the code, like here:
> - ((save-excursion (skip-chars-backward " \t") (not (bolp)))
> - (setq regions (list (cons (line-beginning-position)
> - (1+ pos)))))
> + ;; Show what precedes the open in its line, if anything.
> + ((save-excursion
> + (skip-chars-backward " \t")
> + (not (bolp)))
> + #("Matches %s"
> + ;; Make the following text (i.e., %s) prominent.
> + 0 7 (face (:weight light)))
> + (blink-paren-open-paren-line-string blinkpos)))))))
This assume the font used in the echo-area must have a light variant
installed; if it doesn't, Emacs might select a different font and/or
the same "normal" weight. So I'm not sure this is a good idea, in
general. Why not use the 'shadow' face instead?
I'm not sure I understand why you use backticks in some parts of the
patch. For example:
> - ((save-excursion (skip-chars-backward " \t") (not (bolp)))
> - (setq regions (list (cons (line-beginning-position)
> - (1+ pos)))))
> + ;; Show what precedes the open in its line, if anything.
> + ((save-excursion
> + (skip-chars-backward " \t")
> + (not (bolp)))
> + (let ((bol (line-beginning-position)))
> + (setq regions `((,bol . ,(1+ pos)))
> + openparen-idx (- pos bol))))
The original code didn't use backticks, so why do you need it in the
new version?
> + (1+openparen-idx (1+ openparen-idx)))
^^^^^^^^^^^^^^^
This is a strange and confusing notation, please find a better name
for this variable.
Finally, this patch is too large to accept without copyright
assignment. What is the status of your legal paperwork?
next prev parent reply other threads:[~2023-04-28 6:28 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-26 13:39 bug#63089: [PATCH] Display offscreen matched openparen Shynur Xie
2023-04-28 6:28 ` Eli Zaretskii [this message]
2023-04-28 12:36 ` Shynur Xie
2023-04-29 11:05 ` Eli Zaretskii
2023-04-30 10:09 ` Shynur Xie
2023-05-01 13:17 ` Eli Zaretskii
2023-05-01 17:52 ` Shynur Xie
2023-05-02 18:38 ` 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=834jp0seoq.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=63089@debbugs.gnu.org \
--cc=one.last.kiss@outlook.com \
/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).