From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: `open-paren-in-column-0-is-defun-start` (was: cc-mode fontification feels random) Date: Wed, 09 Jun 2021 09:14:49 -0400 Message-ID: References: <86a85d26-75c0-e4a3-e8d3-244c5346dd3a@dancol.org> <83r1hehnz9.fsf@gnu.org> <83lf7mhl3n.fsf@gnu.org> <73ff18bf-66dc-7d7a-a0db-8edc2cdceba8@gmx.at> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27914"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Richard Stallman , eliz@gnu.org, acm@muc.de, dancol@dancol.org, emacs-devel@gnu.org To: martin rudalics Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Jun 09 15:16:16 2021 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 1lqy47-0006zt-AT for ged-emacs-devel@m.gmane-mx.org; Wed, 09 Jun 2021 15:16:15 +0200 Original-Received: from localhost ([::1]:41624 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lqy46-0004SY-5C for ged-emacs-devel@m.gmane-mx.org; Wed, 09 Jun 2021 09:16:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54042) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lqy2u-0003Y5-P4 for emacs-devel@gnu.org; Wed, 09 Jun 2021 09:15:00 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:22949) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lqy2r-0003TX-Sy; Wed, 09 Jun 2021 09:14:59 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 96BD610028B; Wed, 9 Jun 2021 09:14:51 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 2FA92100006; Wed, 9 Jun 2021 09:14:50 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1623244490; bh=IUBtyaHeSkmYQTpOP6rhJCcfZAGfxzoSeiBYsDAECF0=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=LOGl6RbYWrU/MQl7JtqYPSf5zRqdduasUecQZGktAfBGSZRpFx5s095wRAIXtwxMl xUJqMoIQC7RK5HW2/dKQUrWnjnYXHkzFIQR+ITqY1rpj+VwotEU1wv5qPZ1RjRxP18 Mx1gqXE011f3UU+tXv+yu90iume/6z88WjF95wrrRzlulzeGn3n9kSROrPH26T+ieo ixHexSh8MWqjXaEXqUvFCwMy6AFHnuTg0WwP8Ts6fMBcB0QWvmNX6loUtZergqU3ur 31Q4GYyCzfaAbmrm3Bkk/Dnv/ntFUGCtcMNLiitP55zd0T55rSqfa3igqNjzv2p6mo EdLNHFMG2AS0A== Original-Received: from alfajor (69-196-163-239.dsl.teksavvy.com [69.196.163.239]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id B9E37120EB0; Wed, 9 Jun 2021 09:14:49 -0400 (EDT) In-Reply-To: (martin rudalics's message of "Wed, 9 Jun 2021 10:34:09 +0200") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:270597 Archived-At: > It was rather the use of the idiom "We can use hacks like this one". I > see `open-paren-in-column-0-is-defun-start' as a way to subdivide code > into chunks that may be edited and processed independently. Currently, > we use a monolithic approach (one that works on the whole buffer from > its beginning) for fontification and a chunk-wise approach (as in the > default `beginning-of-defun') for editing proper. I see two problems with `open-paren-in-column-0-is-defun-start` (opic0ids): - The implementation was a lot simpler than what's needed for your notion of "chunk-wise editing", thus leading to somewhat arbitrary behaviors because we only used the opic0ids property when it was convenient, rather than using it at every place where it could change the behavior. - this convention is imposed on top of the definition of the language, so it's like editing "C with the opic0ids convention" rather than editing "C". This works fine if your file is indeed written in "C with the opic0ids convention", but no so well otherwise. And that convention is specific to Emacs (I can imagine other editors supporting a similar convention, but most likely it won't be exactly the same one since it's not a widely known convention), so unless all the coders agree to use Emacs you'll probably want to enforce that convention via some kind of "sanity check" maybe running in a CI. - I don't think a major mode for language Foo should default to assuming that the buffer is written in "Foo with the opic0ids convention". Stefan