From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Re: Algorithm in electric-pair--unbalanced-strings-p unsuitable for CC Mode Date: Thu, 4 Jul 2019 22:44:36 +0100 Message-ID: References: <20190702131632.GA30597@ACM> <20190702160410.GB30597@ACM> <20190702182811.GC30597@ACM> <20190703105804.GA11238@ACM> <20190704165846.GF5564@ACM> <20190704190100.GG5564@ACM> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000059a9c058ce1e3c6" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="31445"; mail-complaints-to="usenet@blaine.gmane.org" Cc: emacs-devel To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jul 04 23:46:15 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hj9YT-0007yv-8X for ged-emacs-devel@m.gmane.org; Thu, 04 Jul 2019 23:46:13 +0200 Original-Received: from localhost ([::1]:48956 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hj9YR-0005bz-Hx for ged-emacs-devel@m.gmane.org; Thu, 04 Jul 2019 17:46:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57184) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hj9X7-0004bZ-M4 for emacs-devel@gnu.org; Thu, 04 Jul 2019 17:44:50 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hj9X6-0007D1-L8 for emacs-devel@gnu.org; Thu, 04 Jul 2019 17:44:49 -0400 Original-Received: from mail-io1-xd32.google.com ([2607:f8b0:4864:20::d32]:42273) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hj9X6-0007Cn-Gn for emacs-devel@gnu.org; Thu, 04 Jul 2019 17:44:48 -0400 Original-Received: by mail-io1-xd32.google.com with SMTP id u19so15156875ior.9 for ; Thu, 04 Jul 2019 14:44:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=cIh8qUeyul03u5oARUcImMuU4cDbohxi3+D1QMheFsQ=; b=BHzMWxeAGdhOcXtaav/irotqHckzuOVXSAB62Hcl67p8dG5sVIjZNuYVNrew7qpxx0 8sS405hf54+ZX5le7mlWBMxZr+ynFvOZtHJsARlCtg+GtTrFOLgQUJ3ZxOWIx/snHnfg UApnt8y+oh/z5g5ZoOA6DOmfNCgxn39uRclhzY6Fzt9Z4VcQzcEPUkGFs+NO0EBVulT4 ZKNmu/IYlCQVtUkZXGDK2LWU1XDTtuHYjlyOTfNGpL8Z9x+PnDtrgLhu8NqFd0skwKPT 53j44zhcNPplp6UqbF7J+WwfcMz4C2pxvTej3YYmF96V6xj3d0BhlZZknRwwtdqEpks4 weow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=cIh8qUeyul03u5oARUcImMuU4cDbohxi3+D1QMheFsQ=; b=C1OqP9PQBrqztuPsjHmN4cOfkSd3CStHtMQ2DZUhnezVolX9q4fyyn9KK/ZeN7s7vw bGVEVa6esQJN1ZenctxGKbIAchyn6Ybh2vWUn8hgRKWAhSEV+7r/Rpc+2EkFHsCib4MB TD1TcdoIzm17+3oJVKOeVwBcsBMLjM+9kJg86RN/vRNdMRQCe21FU0tks6SYO9+NqEZe Ko1CpgiORG3aF9Fd0DdL7jyQeNStO16kXgKk8KMVmIkO7pVAJp1iMShIRxtt0BqSQjVT bnNcgWE1KIJ/7FtdmnyfegAOOJJ6MFpaEIyHiSqi2lMjC/oF62gk4Z/DhuyM3P+IrzIP XwrA== X-Gm-Message-State: APjAAAUP8vxYgSASllq0AT8MhZI9SpIsjVpnCO+cM8a+oUJ48tVR7PWw KJi9bj75sQWODfsoT2Bk9nktb5+byMUBGM8J8fUWY6/k X-Google-Smtp-Source: APXvYqwwi0R5UAQQ680Gr1mz5KU315ukgEjxU96Iy2pcpYyNCureuQQmtuAVZ1bQHzqy4NWXkmWo/eOjertVhe22dVo= X-Received: by 2002:a05:6638:3d6:: with SMTP id r22mr309795jaq.71.1562276687876; Thu, 04 Jul 2019 14:44:47 -0700 (PDT) In-Reply-To: <20190704190100.GG5564@ACM> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::d32 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:238365 Archived-At: --000000000000059a9c058ce1e3c6 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Jul 4, 2019 at 8:01 PM Alan Mackenzie wrote: > + ;; Prepare for the use of `electric-pair-mode': > + (eval-after-load "elec-pair" > + '(when (and (boundp 'electric-pair-inhibit-predicate) > + (fboundp 'electric-pair-cc-inhibit-predicate)) > + (make-local-variable 'electric-pair-inhibit-predicate) > + (setq electric-pair-inhibit-predicate > + #'electric-pair-cc-inhibit-predicate))) > What you are doing here is perfectly legal. I designed the electric-pair-inhibit-predicate variable to be external to users and other modes, presuming those users know what they are doing. You can use add-function or setq the variable directly. I prefer the former, but it's probably not available in emacs 24. It's your choice. The function you put there shouldn't be in the elec-pair.el library, so I suggest you put it in cc-mode.el or wherever you feel it fits. It'll probably save you that fboundp check. Naturally, this doesn't fix the C-M-* navigation in multi-line strings (as you know, if that were fixed, you woundn't need this tweak) Jo=C3=A3o --000000000000059a9c058ce1e3c6 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Thu, Jul 4, 2019 at 8:01 PM Alan Mackenzie <acm@muc.de> wrote:

> + =C2=A0;; Pre= pare for the use of `electric-pair-mode':
> + =C2=A0(eval-after-l= oad "elec-pair"
> + =C2=A0 =C2=A0'(when (and (boundp &#= 39;electric-pair-inhibit-predicate)
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 (fboundp 'electric-pair-cc-inhibit-predicate))
= > + =C2=A0 =C2=A0 =C2=A0 (make-local-variable 'electric-pair-inhibit= -predicate)
> + =C2=A0 =C2=A0 =C2=A0 (setq electric-pair-inhibit-pred= icate
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0#'electric-pai= r-cc-inhibit-predicate)))
>

What you are doing= here is perfectly legal.=C2=A0 I designed the
electric-pair-inhi= bit-predicate variable to be external to users and
other mod= es, presuming those users know what they are doing.
You can use a= dd-function or setq the variable directly. I prefer
the form= er, but it's probably not available in emacs 24.=C2=A0 It's
your choice.

The function you put there sh= ouldn't be in the elec-pair.el
library, so I suggest you put= it in cc-mode.el or wherever you
feel it fits.=C2=A0 It'= ;ll probably save you that fboundp check.

Natu= rally, this doesn't fix the C-M-* navigation in multi-line
strings (as you know, if that were fixed, you woundn't need
this tweak)

Jo=C3=A3o
--000000000000059a9c058ce1e3c6--