From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Re: Algorithm in electric-pair--unbalanced-strings-p unsuitable for CC Mode Date: Mon, 8 Jul 2019 10:05:39 +0000 Message-ID: <20190708100539.GD4529@ACM> References: <20190702160410.GB30597@ACM> <20190702182811.GC30597@ACM> <20190703105804.GA11238@ACM> <20190704165846.GF5564@ACM> <20190704190100.GG5564@ACM> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="80413"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.10.1 (2018-07-13) Cc: emacs-devel To: =?iso-8859-1?Q?Jo=E3o_T=E1vora?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jul 08 12:13:16 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 1hkQe4-000Knb-HJ for ged-emacs-devel@m.gmane.org; Mon, 08 Jul 2019 12:13:16 +0200 Original-Received: from localhost ([::1]:40134 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hkQX5-00085n-1j for ged-emacs-devel@m.gmane.org; Mon, 08 Jul 2019 06:06:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56876) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hkQWu-00085Y-Sg for emacs-devel@gnu.org; Mon, 08 Jul 2019 06:05:54 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hkQWq-0006lN-Ti for emacs-devel@gnu.org; Mon, 08 Jul 2019 06:05:50 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:34526 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1hkQWp-0006jD-HZ for emacs-devel@gnu.org; Mon, 08 Jul 2019 06:05:48 -0400 Original-Received: (qmail 34750 invoked by uid 3782); 8 Jul 2019 10:05:39 -0000 Original-Received: from acm.muc.de (p4FE15FEC.dip0.t-ipconnect.de [79.225.95.236]) by colin.muc.de (tmda-ofmipd) with ESMTP; Mon, 08 Jul 2019 12:05:39 +0200 Original-Received: (qmail 25359 invoked by uid 1000); 8 Jul 2019 10:05:39 -0000 Content-Disposition: inline In-Reply-To: X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-Received-From: 193.149.48.1 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:238403 Archived-At: Hello, Joćo. On Thu, Jul 04, 2019 at 22:44:36 +0100, Joćo Tįvora wrote: > 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. I've done this, and closed bug #36474. > 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. Yes. > 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) I have an idea how to make C-M-* work in these bogus multi-line strings, but it's going to take more than a couple of days to implement. It involves only having the pertinent string fence syntax-table text properties present during fontification and CC Mode's before/after-change-functions. > Joćo -- Alan Mackenzie (Nuremberg, Germany).