From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: CC Mode and electric-pair "problem". Date: Tue, 26 Jun 2018 20:09:04 +0000 Message-ID: <20180626200904.GD4464@ACM> References: <20180617201351.GA4580@ACM> <20180618103654.GA9771@ACM> <20180618154227.GB3973@ACM> <20180619050244.GA3946@ACM> <20180626185235.GC4464@ACM> <8736x9mivr.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1530044143 20138 195.159.176.226 (26 Jun 2018 20:15:43 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 26 Jun 2018 20:15:43 +0000 (UTC) User-Agent: Mutt/1.9.4 (2018-02-28) Cc: Glenn Morris , Emacs developers , Tino Calancha To: =?iso-8859-1?Q?Jo=E3o_T=E1vora?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jun 26 22:15:39 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fXuNF-00058f-8Q for ged-emacs-devel@m.gmane.org; Tue, 26 Jun 2018 22:15:37 +0200 Original-Received: from localhost ([::1]:55162 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fXuPM-000782-GE for ged-emacs-devel@m.gmane.org; Tue, 26 Jun 2018 16:17:48 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55355) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fXuPE-00077t-Q7 for emacs-devel@gnu.org; Tue, 26 Jun 2018 16:17:41 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fXuPA-0005bx-Qc for emacs-devel@gnu.org; Tue, 26 Jun 2018 16:17:40 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:43377 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1fXuPA-0005bQ-K5 for emacs-devel@gnu.org; Tue, 26 Jun 2018 16:17:36 -0400 Original-Received: (qmail 94305 invoked by uid 3782); 26 Jun 2018 20:17:35 -0000 Original-Received: from acm.muc.de (p5B1471C9.dip0.t-ipconnect.de [91.20.113.201]) by colin.muc.de (tmda-ofmipd) with ESMTP; Tue, 26 Jun 2018 22:17:34 +0200 Original-Received: (qmail 20372 invoked by uid 1000); 26 Jun 2018 20:09:04 -0000 Content-Disposition: inline In-Reply-To: <8736x9mivr.fsf@gmail.com> 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.21 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:226752 Archived-At: Hello, Joćo. On Tue, Jun 26, 2018 at 20:45:44 +0100, Joćo Tįvora wrote: > Hi Alan, > Alan Mackenzie writes: > >> [ .... ] > >> Maybe we're looking at this the wrong way. > >> How about this idea: we add a new syntax flag to Emacs, ", which > >> terminates any open string, the same way the syntax > terminates any > >> open comment. We could then set this syntax flag on newline. > > This isn't a sensible idea. because it wouldn't solve any of the > > problems we have with the string-fence syntax. > You realize you're replying to your own suggestion, right? (just > checking...) I do, yes. :-) > > This would have the advantage of making fontification easy, whilst still > > allowing syntactic operations within an invalid string. For example, in > > char *foo = "( > > )" > > , the "s would have "one-line string quote" syntax and be fontified with > > warning face, but a C-M-n from the ( would still move point to after the > > ), and all the electric-pair-mode stuff would still work. > Ignoring any complications or complexity that would arise from it, that > sounds great (though more important than supporting e-p-m is having > C-M-u work from inside the string, which I suppose is included). Indeed. The whole point is that if the syntax scanning starts outside the one-line string, the newline acts as a terminator. If it starts inside the string, the newline doesn't act as anything special. The complications would come with things like scan-sexps, which when starting after a newline and scanning backward, would have to check for a one-line " in the line. I don't see such complications as being unmanageable. > Joćo -- Alan Mackenzie (Nuremberg, Germany).