From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#63089: [PATCH] Display offscreen matched openparen Date: Fri, 28 Apr 2023 09:28:53 +0300 Message-ID: <834jp0seoq.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40321"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 63089@debbugs.gnu.org To: Shynur Xie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Apr 28 08:29:17 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1psHbZ-000AIs-9K for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 28 Apr 2023 08:29:17 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1psHbQ-0006Hz-OL; Fri, 28 Apr 2023 02:29:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1psHbL-0006Hj-0Z for bug-gnu-emacs@gnu.org; Fri, 28 Apr 2023 02:29:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1psHbK-0000xY-HX for bug-gnu-emacs@gnu.org; Fri, 28 Apr 2023 02:29:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1psHbK-0007en-Ct for bug-gnu-emacs@gnu.org; Fri, 28 Apr 2023 02:29:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 28 Apr 2023 06:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63089 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 63089-submit@debbugs.gnu.org id=B63089.168266330829390 (code B ref 63089); Fri, 28 Apr 2023 06:29:02 +0000 Original-Received: (at 63089) by debbugs.gnu.org; 28 Apr 2023 06:28:28 +0000 Original-Received: from localhost ([127.0.0.1]:60384 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1psHam-0007dw-Ac for submit@debbugs.gnu.org; Fri, 28 Apr 2023 02:28:28 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:34394) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1psHak-0007dk-Gc for 63089@debbugs.gnu.org; Fri, 28 Apr 2023 02:28:27 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1psHae-0000qy-MY; Fri, 28 Apr 2023 02:28:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=liAoPIfTEreWi1fhrNdykcyc85Vco5EmYVPfK0pLymU=; b=gbuaLduC5ub0 C+6GAde4ydNeCf3dQ94BpNnR+Ic8qzu0YpM5oK8gbRUzedzODMvPUqGNViE0upA4ZrIVONMqIUmn1 69u/6OddrX+FIouca6mT+QqIJrLBFVYapVwEHGDIq6+PZE+8ghhRZ4z8v2bUIvfU9soTpIl8oBWLC 3jusxB5dfj5a4EbYylswxiC7Ne3EUrCeRr+Zajk5lfy1Dgo1unc9kVOsXbSshidEN35M3PvCPyeHz vNfTHk1N+dKB/PGnos8chKqI15W+8lmSgDKHTUENZSGO1abp2z1E2Wqh988l8PkXgIpYjwxqaZZnj vdOqnJ2X2EIEoJc5bpn3Xg==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1psHad-0001gg-Ng; Fri, 28 Apr 2023 02:28:20 -0400 In-Reply-To: (message from Shynur Xie on Wed, 26 Apr 2023 13:39:17 +0000) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:260753 Archived-At: > From: Shynur Xie > 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?