From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: haj@posteo.de (Harald =?utf-8?Q?J=C3=B6rg?=) Newsgroups: gmane.emacs.devel Subject: Handling extensions of programming languages Date: Fri, 19 Mar 2021 19:53:54 +0100 Message-ID: <87o8ff560t.fsf@hajtower> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13047"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) To: Emacs Developer List Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Mar 19 19:55:39 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 1lNKHa-0003I0-TP for ged-emacs-devel@m.gmane-mx.org; Fri, 19 Mar 2021 19:55:38 +0100 Original-Received: from localhost ([::1]:49490 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lNKHZ-0005Nu-Qo for ged-emacs-devel@m.gmane-mx.org; Fri, 19 Mar 2021 14:55:37 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58020) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lNKG2-0004kA-4x for emacs-devel@gnu.org; Fri, 19 Mar 2021 14:54:02 -0400 Original-Received: from mout01.posteo.de ([185.67.36.65]:46286) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lNKFz-0000lQ-Vn for emacs-devel@gnu.org; Fri, 19 Mar 2021 14:54:01 -0400 Original-Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id CA655160060 for ; Fri, 19 Mar 2021 19:53:55 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1616180035; bh=QZpNSJEj5B+OlruiWOdG8uC3O4c+e/TuDmsGp3FI4Xk=; h=From:To:Subject:Date:From; b=eq2OgNRtX34Ik1N6GyisyM64Q8bCEqoRXqNnmNIGMmg3di8vo7QwgNmFj+HrM8uUd fKXJgWM3+HIHV7/pgUdbjuzd+s+cTkJyfBBxPYaL7l1RjI+gHgF1bVmQBJAa37CZNc 4e4TRBbg0IrM3bErhGWIESlhRBMFJ7f0JA8BdjEmbsNfr2+Jxj5JHwWXQvWBU/1jve UU6mXmgK4RKsqawB3NkTD/gWzozAi7FYFF5xOf7VwAoXjPA1P1q5I+KOf03nGZ0is4 VtN/gsrsQA9FeRWZ1FMzqyhE0/TDWHfL7IDo7fk8Clkyuuzt2QdaCCeAlMZ0wfepb2 yUR6Mj8s1zFcg== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4F2CjH2Qb8z6tmg for ; Fri, 19 Mar 2021 19:53:55 +0100 (CET) Received-SPF: pass client-ip=185.67.36.65; envelope-from=haj@posteo.de; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-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:266613 Archived-At: Hello List, today I'm looking for advice or hints how to deal with a task for CPerl mode which might have been solved for other programming languages: How to handle extensions of the language. That's not about user-defined functions, but about extensions that change what needs to be included in imenu, or which affect highlighting (cumbersome but straightforward) and indentation (tricky). * Is it a good idea to implement each of them as a minor mode which only makes sense in CPerl mode buffers? * Or should the extensions be loaded by a command from CPerl mode? * Should that be one multi-file package or should each extension go into a package of its own? Or even a mixture of both, to allow contributions from ELPA and Non-GNU ELPA? * Are there templates or conventions to follow (beyond the rules how to build packages, I'm aware of these)? Background: In Perl, adding new syntax to the language is easy enough so that many developers have done this and published their work as extension modules on CPAN. Some of these extensions have become very popular, some are quite exotic. Occasionally they are competing with each other for the same keywords, but with different syntax. Eventually, popular keywords might make it into the Perl core, with yet another syntax. My first approach was to keep all the code in one place and evaluate all the font-lock and indenting variables at runtime, as buffer-local variables, for the different versions. This works to some extent for highlightingq, but fails if an extension needs different logic for indentation. -- Cheers, haj