From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.devel Subject: Re: [ELPA] New Package: p4_16-mode Date: Fri, 17 Nov 2023 07:36:18 +0000 Message-ID: <87edgoq1al.fsf@posteo.net> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14281"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Soham Gumaste Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Nov 17 08:37:07 2023 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 1r3tPX-0003UZ-15 for ged-emacs-devel@m.gmane-mx.org; Fri, 17 Nov 2023 08:37:07 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r3tOv-0000j5-4G; Fri, 17 Nov 2023 02:36:29 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r3tOr-0000iB-0I for emacs-devel@gnu.org; Fri, 17 Nov 2023 02:36:26 -0500 Original-Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r3tOn-0002Pm-R9 for emacs-devel@gnu.org; Fri, 17 Nov 2023 02:36:24 -0500 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 7E378240103 for ; Fri, 17 Nov 2023 08:36:19 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1700206579; bh=U03TdlhpXE9Ti/B1J6cy3CwmwulhuAMbanQPM3GyezE=; h=From:To:Cc:Subject:Autocrypt:Date:Message-ID:MIME-Version:From; b=llpxVvEpNr5xD0yma+jtnP8P8Bhe8zNTYWFFL6lMeulWybsprZdMVgs3YTUTTAICD +5E5ZXpVWkgg2pptkGXw8I3YtjXPbRoeU2PytmatJ4QjwHNkLuPyYJ+jqa2evXxHSY gsJRKn/tGp9shB/pzGVHBJHjz1bk5uNKn6f5zVFYj/vG8OiSmC9snO5YAXbzvCnbHU qbDdSffwJHSfgvUhLH8PHHwMEQEvKlkpXe4F+1r30QZQvbJXlPyXpwIhuz8Y1+Kchl zxHbyriqAaJSGI51GaiG0GebbozX6HWQZRejHbaD2WCtEkdpxQoAuh/mjUDbNmNgng 9QfM3+1miSGBg== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4SWpcM0V7zz6tn4; Fri, 17 Nov 2023 08:36:18 +0100 (CET) In-Reply-To: (Soham Gumaste's message of "Mon, 13 Nov 2023 14:31:04 -0600") Autocrypt: addr=philipk@posteo.net; keydata= mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof z4oM Received-SPF: pass client-ip=185.67.36.66; envelope-from=philipk@posteo.net; helo=mout02.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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:312859 Archived-At: --=-=-= Content-Type: text/plain Soham Gumaste writes: > Hello Emacs Devs, > > I am writing to ask that my package "p4_16-mode.el" be added to ELPA. > The repo is at the following link: > > https://github.com/SohamG/p4_16-mode.el Here are a few quick changes I'd propose: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable diff --git a/p4_16-mode.el b/p4_16-mode.el index 23c2825..f9d146b 100644 --- a/p4_16-mode.el +++ b/p4_16-mode.el @@ -3,26 +3,42 @@ ;; Author: Soham S Gumaste ;; Maintainer: Soham S Gumaste ;; Created: 11 Nov 2023 -;; Original Source: https://github.com/p4lang/tutorials/blob/master/vm/p4_= 16-mode.el -;; Original License: Apache 2.0 -;; Original Author: Vladimir Gurevich -;; Modifications bylicensed under the same license OR the MIT License. +;; Modifications bilicensed under the same license OR the MIT License. =20 ;; Keywords: languages p4_16 =20 ;; This file is not part of GNU Emacs. =20 -;; This file is free software=E2=80=A6 -;; =E2=80=A6 -;; along with this file. If not, see . +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . =20 ;;; Commentary: + ;; P4 (Programming Protocol Independent Packet Processors) is a domain ;; specific language designed to program network fabric devices. ;; This mode has preliminary support for P4_16. It covers the core languag= e, ;; but it is not clear yet, how we can highlight the indentifiers, defined -;; for a particular architecture. Core library definitions are included +;; for a particular architecture. Core library definitions are included =20 +;;; History: + +;; The headers above have no special meaning, and could also be +;; re-written in prose under a special section. Also, was the package +;; really created just a few days ago? + +;; Original Source: https://github.com/p4lang/tutorials/blob/master/vm/p4_= 16-mode.el +;; Original License: Apache 2.0 +;; Original Author: Vladimir Gurevich =20 ;;; Code: (defvar p4_16-mode-hook nil) @@ -30,46 +46,46 @@ ;; Define the keymap (for now it is pretty much default) (defvar p4_16-mode-map (let ((map (make-keymap))) - (define-key map "\C-j" 'newline-and-indent) + (define-key map (kbd "C-j") 'newline-and-indent) map) - "Keymap for P4_16 major mode") + "Keymap for P4_16 major mode.") =20 -;; Syntactic HighLighting +;;; Syntactic Highlighting =20 -;; Main keywords (declarations and operators) +;;;; Main keywords (declarations and operators) (defconst p4_16-keywords - '("action" "apply" - "control" - "default" - "else" "enum" "extern" "exit" - "header" "header_union" - "if" - "match_kind" - "package" "parser" - "return" - "select" "state" "struct" "switch" - "table" "transition" "tuple" "typedef" - "verify") - "P4_16 Standard Keywords") + '("action" "apply" + "control" + "default" + "else" "enum" "extern" "exit" + "header" "header_union" + "if" + "match_kind" + "package" "parser" + "return" + "select" "state" "struct" "switch" + "table" "transition" "tuple" "typedef" + "verify") + "P4_16 Standard Keywords.") =20 (defconst p4_16-annotations '("@name" "@metadata" "@alias") - "P4_16 Standard Annotations") + "P4_16 Standard Annotations.") =20 (defconst p4_16-attributes - '("const" "in" "inout" "out" - ;; Tables - "key" "actions" "default_action" "entries" "implementation" - "counters" "meters") - "P4_16 Object Attributes and Access Specifiers") + '("const" "in" "inout" "out" + ;; Tables + "key" "actions" "default_action" "entries" "implementation" + "counters" "meters") + "P4_16 Object Attributes and Access Specifiers.") =20 (defconst p4_16-variables '("packet_in" "packet_out") - "P4_16 Packet Types") + "P4_16 Packet Types.") =20 (defconst p4_16-operations '("&&&" ".." "++" "?" ":") - "P4_16 Operators") + "P4_16 Operators.") =20 (defconst p4_16-constants '(;; Don't care @@ -83,11 +99,11 @@ "exact" "ternary" "lpm" "range" ;; We can add constants for supported architectures here ) - "P4_16 Standard Constants") + "P4_16 Standard Constants.") =20 (defconst p4_16-types '("bit" "bool" "int" "varbit" "void" "error") - "P4_16 Standard Datatypes") + "P4_16 Standard Datatypes.") =20 (defconst p4_16-primitives '(;; Header methods @@ -102,37 +118,36 @@ "accept" "reject" ;; misc "NoAction") - "P4_16 Standard Primitives") + "P4_16 Standard Primitives.") =20 (defconst p4_16-cpp - '("#include" - "#define" "#undef" - "#if" "#ifdef" "#ifndef" - "#elif" "#else" - "#endif" - "defined" - "#line" "#file")) + '("#include" + "#define" "#undef" + "#if" "#ifdef" "#ifndef" + "#elif" "#else" + "#endif" + "defined" + "#line" "#file")) =20 (defconst p4_16-cppwarn - '("#error" "#warning")) + '("#error" "#warning")) =20 ;; Optimize the strings -(setq p4_16-keywords-regexp (regexp-opt p4_16-keywords 'words)) -(setq p4_16-annotations-regexp (regexp-opt p4_16-annotations 1)) -(setq p4_16-attributes-regexp (regexp-opt p4_16-attributes 'words)) -(setq p4_16-variables-regexp (regexp-opt p4_16-variables 'words)) -(setq p4_16-operations-regexp (regexp-opt p4_16-operations 'words)) -(setq p4_16-constants-regexp (regexp-opt p4_16-constants 'words)) -(setq p4_16-types-regexp (regexp-opt p4_16-types 'words)) -(setq p4_16-primitives-regexp (regexp-opt p4_16-primitives 'words)) -(setq p4_16-cpp-regexp (regexp-opt p4_16-cpp 1)) -(setq p4_16-cppwarn-regexp (regexp-opt p4_16-cppwarn 1)) - +(defvar p4_16-keywords-regexp (regexp-opt p4_16-keywords 'words)) +(defvar p4_16-annotations-regexp (regexp-opt p4_16-annotations 1)) +(defvar p4_16-attributes-regexp (regexp-opt p4_16-attributes 'words)) +(defvar p4_16-variables-regexp (regexp-opt p4_16-variables 'words)) +(defvar p4_16-operations-regexp (regexp-opt p4_16-operations 'words)) +(defvar p4_16-constants-regexp (regexp-opt p4_16-constants 'words)) +(defvar p4_16-types-regexp (regexp-opt p4_16-types 'words)) +(defvar p4_16-primitives-regexp (regexp-opt p4_16-primitives 'words)) +(defvar p4_16-cpp-regexp (regexp-opt p4_16-cpp 1)) +(defvar p4_16-cppwarn-regexp (regexp-opt p4_16-cppwarn 1)) =20 ;; create the list for font-lock. ;; each category of keyword is given a particular face (defconst p4_16-font-lock-keywords - (list + (list ;Perhaps use backquoting? (cons p4_16-cpp-regexp font-lock-preprocessor-face) (cons p4_16-cppwarn-regexp font-lock-warning-face) (cons p4_16-types-regexp font-lock-type-face) @@ -154,16 +169,16 @@ (cons "\\([^_A-Za-z][+-]?\\([0-9]+w\\)?[0-9]+\\)" font-lock-constant= -face) ;;(cons "\\(\\w*\\)" font-lock-variable-name-face) ) - "Default Highlighting Expressions for P4_16") + "Default Highlighting Expressions for P4_16.") =20 (defvar p4_16-mode-syntax-table (let ((st (make-syntax-table))) (modify-syntax-entry ?_ "w" st) (modify-syntax-entry ?/ ". 124b" st) (modify-syntax-entry ?* ". 23" st) - (modify-syntax-entry ?\n "> b" st) + (modify-syntax-entry ?\n "> b" st) st) - "Syntax table for p4_16-mode") + "Syntax table for p4_16-mode.") =20 ;;; Indentation (defvar p4_16-indent-offset 4 @@ -192,7 +207,7 @@ =20 ;; Put everything together (defun p4_16-mode () - "Major mode for editing P4_16 programs" + "Major mode for editing P4_16 programs." (interactive) (kill-all-local-variables) (set-syntax-table p4_16-mode-syntax-table) @@ -201,8 +216,8 @@ (set (make-local-variable 'indent-line-function) 'p4_16-indent-line) (setq major-mode 'p4_16-mode) (setq mode-name "P4_16") - (with-eval-after-load "xcscope" (cscope-minor-mode)) + (when (fboundp 'cscope-minor-mode) (cscope-minor-mode)) (run-hooks 'p4_16-mode-hook)) =20 -;; The most important line (provide 'p4_16-mode) +;;; p4_16-mode.el ends here --=-=-= Content-Type: text/plain Also, would it be imaginable to rename it to p4-16-mode? The mid-symbol underscore looks unusual in a Lisp context > Summary: > P4 (Programming Protocol Independent Packet Processors) is a domain > specific language used to program network fabric devices like NICs or > switches. The project can be found at https://p4.org . This package > adds a major mode for this language. This mode was initially a part of > the github repo "p4lang/tutorials" (Apache 2.0). I have added some > polish, and obtained permission from the repo maintainers to submit > here. I suppose you want to add the package to NonGNU ELPA then? > I do not have write access to the ELPA git repo. Please let me know if > I need to make any modifications. > > Thanks --=-=-=--