From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Jos=C3=A9_?= =?UTF-8?Q?J=C3=BAnior?= Newsgroups: gmane.emacs.bugs Subject: bug#55202: 27.1 Feature request: Show parens when point is anywhere inside of them Date: Mon, 2 May 2022 23:10:36 -0300 Message-ID: References: <87bkwhtzhm.fsf@gnus.org> <877d74bbsr.fsf@gnus.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000e1314405de120588" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24139"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 55202@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue May 03 04:12:13 2022 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 1nli1N-00067V-AB for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 03 May 2022 04:12:13 +0200 Original-Received: from localhost ([::1]:56190 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nli1L-00041x-VP for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 02 May 2022 22:12:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44814) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nli1C-00041U-Is for bug-gnu-emacs@gnu.org; Mon, 02 May 2022 22:12:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44456) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nli1C-0005Wq-A8 for bug-gnu-emacs@gnu.org; Mon, 02 May 2022 22:12:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nli1C-0007O7-4J for bug-gnu-emacs@gnu.org; Mon, 02 May 2022 22:12:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Jos=C3=A9_?= =?UTF-8?Q?J=C3=BAnior?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 03 May 2022 02:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55202 X-GNU-PR-Package: emacs Original-Received: via spool by 55202-submit@debbugs.gnu.org id=B55202.165154388128346 (code B ref 55202); Tue, 03 May 2022 02:12:02 +0000 Original-Received: (at 55202) by debbugs.gnu.org; 3 May 2022 02:11:21 +0000 Original-Received: from localhost ([127.0.0.1]:38353 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nli0X-0007N7-8U for submit@debbugs.gnu.org; Mon, 02 May 2022 22:11:21 -0400 Original-Received: from mail-wr1-f48.google.com ([209.85.221.48]:39484) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nli0V-0007Mt-6M for 55202@debbugs.gnu.org; Mon, 02 May 2022 22:11:19 -0400 Original-Received: by mail-wr1-f48.google.com with SMTP id d5so21583461wrb.6 for <55202@debbugs.gnu.org>; Mon, 02 May 2022 19:11:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=B5b5z0dD8q1nbZk8SXJaVqVJrYVjR3MlABc/vQB2KK8=; b=pIJXI9A9FeKSZsWKh5VsXhUc5zJNdB2dcXRa9gS1Grx9T/nGkPJpT/Gjflotln37ob URXEEZHLZval5puhxBpy6OM/2SSEYs4dvOv5K1GJfysP3TNND5unPLtNGHHQIvFIwXS+ 6tCaHSbkXbMoNNrJ3pGPAhETVxJnYdd0AZwhnZhwlrLqpemELZpI/03WogxeBXOLW5bg FKjJSlrXQlv6e8hVyl2vv5GxKW51G/Psn7/kCQmPnnn2vwWrdUb2eNYS0CN8bN/FVgV+ 8We+uOK4/FF//F209w9HoS8H4rwDfWdvCV1PFDx1qVgUnOhNXlmRWrKdDy3BM0kCAbiA af1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=B5b5z0dD8q1nbZk8SXJaVqVJrYVjR3MlABc/vQB2KK8=; b=aTw7xfUaMeav/V/iQYicthDFHm5Uci1SvLdxkKjjNPTHGimMxWJrsOe05RZcKCeR3n 3jNUNBfk1pYDkCKNoFDIJm5axD1FS6lksdDqH4MNGCba32lkwEwWAzAPzGAQWxfxo2f7 kXYOEC8S+51ruHSoxOgz1yMm8op/gqXouW83JNpbps34DCik5ry/NGzbnxwQ4qEphkjJ Y98y+RGL2W/FkcFtAya0O0kG3QLo/LLKEAoirazka/JMEM+hN0zK4oxUspPhsijZG+VX bJkrMeQLuH5LL7kMiQAEjFdeofeGn99YzBqnAU5OexST8lUwGXCEzDGPJu4g3+IYihmb ZjgA== X-Gm-Message-State: AOAM530kkDdXe2GYsBSvq3N0dN8F1B9UQV6iZgl4RFqUpSqNEHHtDSI5 /e0YavkDKiqZBSDeS4q2SWzIv0akNGN5ukjNrjM= X-Google-Smtp-Source: ABdhPJyCrCFstTHovrcSOriATkmJXrPOznYkhmb6El4M/YS2ky1u5d3p6mEiWedAatHWwBsav9rafzh9v5jIk2EGfWo= X-Received: by 2002:a5d:648f:0:b0:20c:4eba:f529 with SMTP id o15-20020a5d648f000000b0020c4ebaf529mr11026271wri.237.1651543872973; Mon, 02 May 2022 19:11:12 -0700 (PDT) In-Reply-To: <877d74bbsr.fsf@gnus.org> 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" Xref: news.gmane.io gmane.emacs.bugs:231292 Archived-At: --000000000000e1314405de120588 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I've been using this workaround so far, and it seems to work (like the first option, though): (define-advice show-paren-function (:around (fn) fix) "Highlight enclosing parens." (cond ((looking-at-p "\\s(") (funcall fn)) (t (save-excursion (ignore-errors (backward-up-list)) (funcall fn))))) source I don't know about efficiency, but I haven't tried it in deeply nested blocks. On Mon, May 2, 2022 at 5:04 AM Lars Ingebrigtsen wrote: > Jos=C3=A9 J=C3=BAnior writes: > > > I didn't know how to answer, so I looked how other editors do. I found > two behaviors: > > > > 1. Unless the point is right by the parens, it should highlight the > curly braces. So in > > this case it would highlight the curly braces. > > > > With the point in these places would highlight the parens, otherwise > would highlight > > the curly braces: > > > > {|(|foobar}|)| > > > > 2. Ignore and don't highlight anything. > > I guess 2) seems more consistent, but I don't have much of an opinion. > Choosing one or the other of the parentheses seems a bit arbitrary. > > -- > (domestic pets only, the antidote for overdose, milk.) > bloggy blog: http://lars.ingebrigtsen.no > --000000000000e1314405de120588 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I've been using this workaround so far, and it seems t= o work (like the first option, though):

(define-advice show-paren-fu= nction (:around (fn) fix)
=C2=A0 "Highlight enclosing parens."=
=C2=A0 (cond ((looking-at-p "\\s(") (funcall fn))
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 (t (save-excursion
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0(ignore-errors (backward-up-list))
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(funcall fn)))))

source

I don't know= about efficiency, but I haven't tried it in deeply nested blocks.
<= /div>

On Mon, May 2, 2022 at 5:04 AM Lars Ingebrigtsen <larsi@gnus.org> wrote:
Jos=C3=A9 J=C3=BAnior <jjnilton@gmail.com> writes:<= br>
> I didn't know how to answer, so I looked how other editors do. I f= ound two behaviors:
>
> 1. Unless the point is right by the parens, it should highlight the cu= rly braces. So in
> this case it would highlight the curly braces.
>
> With the point in these places would highlight the parens, otherwise w= ould highlight
> the curly braces:
>
> {|(|foobar}|)|
>
> 2. Ignore and don't highlight anything.

I guess 2) seems more consistent, but I don't have much of an opinion.<= br> Choosing one or the other of the parentheses seems a bit arbitrary.

--
(domestic pets only, the antidote for overdose, milk.)
=C2=A0 =C2=A0bloggy blog: http://lars.ingebrigtsen.no
--000000000000e1314405de120588--