From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: A proposal for the future of open-paren-in-column-0-is-defun-start. Date: Sun, 5 Apr 2020 13:47:35 +0000 Message-ID: <20200405134735.GD5049@ACM> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="125165"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Apr 05 15:48:37 2020 Return-path: Envelope-to: ged-emacs-devel@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 1jL5dd-000WTQ-4F for ged-emacs-devel@m.gmane-mx.org; Sun, 05 Apr 2020 15:48:37 +0200 Original-Received: from localhost ([::1]:48118 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jL5dc-0007md-94 for ged-emacs-devel@m.gmane-mx.org; Sun, 05 Apr 2020 09:48:36 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57439) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jL5ch-0007GI-GN for emacs-devel@gnu.org; Sun, 05 Apr 2020 09:47:40 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jL5cg-0007d1-Dr for emacs-devel@gnu.org; Sun, 05 Apr 2020 09:47:39 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:55013 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1jL5cg-0007c9-3J for emacs-devel@gnu.org; Sun, 05 Apr 2020 09:47:38 -0400 Original-Received: (qmail 19550 invoked by uid 3782); 5 Apr 2020 13:47:36 -0000 Original-Received: from acm.muc.de (p2E5D5461.dip0.t-ipconnect.de [46.93.84.97]) by localhost.muc.de (tmda-ofmipd) with ESMTP; Sun, 05 Apr 2020 15:47:35 +0200 Original-Received: (qmail 7179 invoked by uid 1000); 5 Apr 2020 13:47:35 -0000 Content-Disposition: inline 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:246454 Archived-At: Hello, Emacs. The working of open-paren-in-column-0-is-defun-start is still functional in emacs-27 and master, providing the newish variable comment-use-syntax-ppss is set to nil. When enabled, it still causes problems in, at the very least, CC Mode. For example, in the following: /* ( */ ^ point , (forward-comment -1) spuriously returns nil and doesn't move point. The root of the problem is that back_comment (in syntax.c) has no means of distinguishing open parens in comments and strings from other open parens. I propose giving the function such a means. This would be a text property `syntax-open-paren-in-literal' which would be applied to each and every open paren at column zero inside a literal. back_comment could easily and cheaply test this text-property. `syntax-open-paren-in-literal' would be applied throughout the buffer when it is first loaded into Emacs, and would be kept up to date by "super before/after-change-functions". (These functions would be called at buffer changes regardless of the value of inhibit-modification-hooks. We would want some way of inhibiting them being called on a change of text properties, for efficiency's sake). With this mechanism in place, o-p-i-c-0-i-d-s could safely be left enabled, for speed's sake, without causing the all too familiar bugs in CC Mode. What do people think? -- Alan Mackenzie (Nuremberg, Germany).