* [PATCH] New major-mode: bicep-ts-mode
@ 2023-12-21 14:32 Jostein Kjønigsen
2023-12-22 10:42 ` Stefan Kangas
2024-01-07 18:04 ` Daniel Mendler via Emacs development discussions.
0 siblings, 2 replies; 21+ messages in thread
From: Jostein Kjønigsen @ 2023-12-21 14:32 UTC (permalink / raw)
To: Ergus via Emacs development discussions.; +Cc: Yuan Fu, Theodor Thornhill
[-- Attachment #1: Type: text/plain, Size: 2346 bytes --]
Hey everyone.
QUICK PREFACE
Currently if one works with Microsoft-oriented solutions (C#, .NET, TypeScript, Azure, etc) one often also has to work with Bicep. Bicep is a programming language used to describe Infrastructure-as-Code used for deploying services in Microsoft Azure cloud.
Unfortunately the only editor currently available with useful Bicep-support is Microsoft VSCode. Working with Bicep in Emacs currently is not really feasible.
The Bicep language itself is a type-safe language with an associated open-source toolchain, which in turn gets compiled to JSON-formatted Azure Resource Manager (ARM) templates, which can actually provision resources in Azure.
With appropriate editor-support, working with Bicep is superior to working with the untyped JSON for ARM template purposes. As such, adding support for Bicep to Emacs, would mean most Azure-developers can still stay 100% within Emacs to do their job :)
ABOUT THE PATCH
The attached patch tries to rectify the situation by making introducing tree-sitter based major-mode to handle important aspects of Bicep development:
* provide syntax highligting
* provide indentation
* provide imenu-support
The implementation itself depends on tree-sitter and the tree-sitter grammar developed by Amanda Qureshi (unaffiliated with this effort):
https://github.com/amaanq/tree-sitter-bicep
This grammar compiles and installs cleanly with the default settings found in M-x treesit-install-language-grammar given the repo URL only.
The implementation is fairly basic, but as far as I can see it works well and greatly improve the user-experience for Bicep-development.
NOT yet provided:
* adding Bicep.LangServer LSP-configuration to eglot (although I’ve tested that locally and it seems to work seamlessly once you have the Bicep language-server resolved).
The latter is essential into bringing Emacs to feature-parity with VSCode, but its probably best to land this major-mode, before committing to how that major-mode should be wired up inside Emacs :)
Any opinions?
For more information about Bicep, Microsoft has documentation online: https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/overview?tabs=bicep
Bicep toolchain souce: https://github.com/Azure/bicep
—
Kind Regards
Jostein Kjønigsen

[-- Attachment #2.1: Type: text/html, Size: 3272 bytes --]
[-- Attachment #2.2: bicep-ts-model.el --]
[-- Type: application/octet-stream, Size: 5800 bytes --]
;;; bicep-ts-mode.el --- tree-sitter support for Bicep -*- lexical-binding: t; -*-
;; Copyright (C) 2024-2024 Free Software Foundation, Inc.
;; Author : Jostein Kjønigsen <jostein@kjonigsen.net>
;; Maintainer : Jostein Kjønigsen <jostein@kjonigsen.net>
;; Created : December 2023
;; Keywords : bicep languages tree-sitter
;; This file is part of GNU Emacs.
;; GNU Emacs 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.
;; GNU Emacs 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;;
;;; Code:
(require 'treesit)
(declare-function treesit-parser-create "treesit.c")
(declare-function treesit-induce-sparse-tree "treesit.c")
(declare-function treesit-node-start "treesit.c")
(declare-function treesit-node-type "treesit.c")
(declare-function treesit-node-child "treesit.c")
(declare-function treesit-node-child-by-field-name "treesit.c")
(defcustom bicep-ts-mode-indent-offset 2
"Number of spaces for each indentation step in `bicep-ts-mode'."
:version "29.1"
:type 'natnum
:safe 'natnump
:group 'bicep)
(defvar bicep-ts-mode--syntax-table
(let ((table (make-syntax-table)))
(modify-syntax-entry ?= "." table)
(modify-syntax-entry ?\' "\"" table)
(modify-syntax-entry ?\n "> b" table)
table)
"Syntax table for `bicep-ts-mode'.")
(defvar bicep-ts-mode--indent-rules
`((bicep
((node-is "}") parent-bol 0)
((parent-is "object") parent-bol bicep-ts-mode-indent-offset)
((parent-is "for_statement") parent-bol bicep-ts-mode-indent-offset))))
(defvar bicep-ts-mode--keywords
'("var" "param" "resource"
"module" "type" "metadata"
"targetScope" "output"
"for" "in")
"Bicep keywords for tree-sitter font-locking.")
(defvar bicep-ts-mode--font-lock-settings
(treesit-font-lock-rules
:language 'bicep
:feature 'comment
'((comment) @font-lock-comment-face)
:language 'bicep
:feature 'delimiter
'(("=") @font-lock-delimiter-face)
:language 'bicep
:feature 'keyword
`([,@bicep-ts-mode--keywords] @font-lock-keyword-face)
:language 'bicep
:feature 'definition
'((parameter_declaration
(identifier) @font-lock-variable-name-face
(type) @font-lock-type-face)
(variable_declaration
(identifier) @font-lock-variable-name-face)
(resource_declaration
(identifier) @font-lock-variable-name-face)
(module_declaration
(identifier) @font-lock-variable-name-face)
(type_declaration
(identifier) @font-lock-type-face)
(type_declaration
(builtin_type) @font-lock-type-face)
(output_declaration
(identifier) @font-lock-variable-name-face)
(output_declaration
(type) @font-lock-type-face))
:language 'bicep
:feature 'number
'((number)
@font-lock-number-face)
:language 'bicep
:feature 'string
'((string_content) @font-lock-string-face)
:language 'bicep
:feature 'boolean
'((boolean) @font-lock-constant-face)
:language 'bicep
:feature 'functions
'((call_expression
function: (identifier) @font-lock-function-name-face))
:language 'bicep
:feature 'error
:override t
'((ERROR) @font-lock-warning-face))
"Font-lock settings for BICEP.")
(defun bicep-ts-mode--defun-name (node)
"Return the defun name of NODE.
Return nil if there is no name or if NODE is not a defun node."
(treesit-node-text
(treesit-node-child node 1)
t))
;;;###autoload
(define-derived-mode bicep-ts-mode prog-mode "Bicep"
"Major mode for editing BICEP, powered by tree-sitter."
:group 'bicep-mode
:syntax-table bicep-ts-mode--syntax-table
(when (treesit-ready-p 'bicep)
(treesit-parser-create 'bicep)
;; Comments
(setq-local comment-start "# ")
(setq-local comment-end "")
;; Indent.
(setq-local treesit-simple-indent-rules bicep-ts-mode--indent-rules)
;; Navigation.
(setq-local treesit-defun-type-regexp
(rx (or "module_declaration" "type_declaration" "variable_declaration"
"parameter_declaration" "resource_declaration" "output_declaration")))
(setq-local treesit-defun-name-function #'bicep-ts-mode--defun-name)
;; Font-lock.
(setq-local treesit-font-lock-settings bicep-ts-mode--font-lock-settings)
(setq-local treesit-font-lock-feature-list
'((comment delimiter keyword)
(definition number string boolean)
(functions)
(error)))
;; Imenu.
(setq-local treesit-simple-imenu-settings
'(("Modules" "\\`module_declaration\\'" nil nil)
("Types" "\\`type_declaration\\'" nil nil)
("Variables" "\\`variable_declaration\\'" nil nil)
("Parameters" "\\`parameter_declaration\\'" nil nil)
("Resources" "\\`resource_declaration\\'" nil nil)
("Outputs" "\\`output_declaration\\'" nil nil)))
(treesit-major-mode-setup)))
(if (treesit-ready-p 'bicep)
(add-to-list 'auto-mode-alist '("\\.bicep\\'" . bicep-ts-mode)))
(provide 'bicep-ts-mode)
;;; bicep-ts-mode.el ends here
[-- Attachment #2.3: Type: text/html, Size: 212 bytes --]
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] New major-mode: bicep-ts-mode
2023-12-21 14:32 [PATCH] New major-mode: bicep-ts-mode Jostein Kjønigsen
@ 2023-12-22 10:42 ` Stefan Kangas
2023-12-22 11:55 ` Jostein Kjønigsen
2024-01-07 18:04 ` Daniel Mendler via Emacs development discussions.
1 sibling, 1 reply; 21+ messages in thread
From: Stefan Kangas @ 2023-12-22 10:42 UTC (permalink / raw)
To: Jostein Kjønigsen, Ergus via Emacs development discussions.
Cc: Yuan Fu, Theodor Thornhill
Jostein Kjønigsen <jostein@secure.kjonigsen.net> writes:
> Any opinions?
Makes sense to me.
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] New major-mode: bicep-ts-mode
2023-12-22 10:42 ` Stefan Kangas
@ 2023-12-22 11:55 ` Jostein Kjønigsen
2023-12-24 14:32 ` Stefan Kangas
0 siblings, 1 reply; 21+ messages in thread
From: Jostein Kjønigsen @ 2023-12-22 11:55 UTC (permalink / raw)
To: Stefan Kangas, Ergus via Emacs development discussions.
Cc: Yuan Fu, Theodor Thornhill
[-- Attachment #1.1: Type: text/plain, Size: 401 bytes --]
Great. Attach is a newer revision which handles syntax-highlighting of user-defined types slightly better :)
--
Vennlig hilsen
Jostein Kjønigsen
jostein@kjonigsen.net 🍵 jostein@gmail.com
https://jostein.kjønigsen.no
On Fri, Dec 22, 2023, at 11:42, Stefan Kangas wrote:
> Jostein Kjønigsen <jostein@secure.kjonigsen.net> writes:
>
> > Any opinions?
>
> Makes sense to me.
>
[-- Attachment #1.2: Type: text/html, Size: 1165 bytes --]
[-- Attachment #2: bicep-ts-mode.el --]
[-- Type: application/octet-stream, Size: 5599 bytes --]
;;; bicep-ts-mode.el --- tree-sitter support for Bicep -*- lexical-binding: t; -*-
;; Copyright (C) 2023-2023 Free Software Foundation, Inc.
;; Author : Jostein Kjønigsen <jostein@kjonigsen.net>
;; Maintainer : Jostein Kjønigsen <jostein@kjonigsen.net>
;; Created : December 2023
;; Keywords : bicep languages tree-sitter
;; This file is part of GNU Emacs.
;; GNU Emacs 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.
;; GNU Emacs 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;;
;;; Code:
(require 'treesit)
(declare-function treesit-parser-create "treesit.c")
(declare-function treesit-induce-sparse-tree "treesit.c")
(declare-function treesit-node-start "treesit.c")
(declare-function treesit-node-type "treesit.c")
(declare-function treesit-node-child "treesit.c")
(declare-function treesit-node-child-by-field-name "treesit.c")
(defcustom bicep-ts-mode-indent-offset 2
"Number of spaces for each indentation step in `bicep-ts-mode'."
:version "29.1"
:type 'natnum
:safe 'natnump
:group 'bicep)
(defvar bicep-ts-mode--syntax-table
(let ((table (make-syntax-table)))
(modify-syntax-entry ?= "." table)
(modify-syntax-entry ?\' "\"" table)
(modify-syntax-entry ?\n "> b" table)
table)
"Syntax table for `bicep-ts-mode'.")
(defvar bicep-ts-mode--indent-rules
`((bicep
((node-is "}") parent-bol 0)
((parent-is "object") parent-bol bicep-ts-mode-indent-offset)
((parent-is "for_statement") parent-bol bicep-ts-mode-indent-offset))))
(defvar bicep-ts-mode--keywords
'("var" "param" "resource"
"module" "type" "metadata"
"targetScope" "output"
"for" "in")
"Bicep keywords for tree-sitter font-locking.")
(defvar bicep-ts-mode--font-lock-settings
(treesit-font-lock-rules
:language 'bicep
:feature 'comment
'((comment) @font-lock-comment-face)
:language 'bicep
:feature 'delimiter
'(("=") @font-lock-delimiter-face)
:language 'bicep
:feature 'keyword
`([,@bicep-ts-mode--keywords] @font-lock-keyword-face)
:language 'bicep
:feature 'definition
'((parameter_declaration
(identifier) @font-lock-variable-name-face
(type) @font-lock-type-face)
(variable_declaration
(identifier) @font-lock-variable-name-face)
(resource_declaration
(identifier) @font-lock-variable-name-face)
(module_declaration
(identifier) @font-lock-variable-name-face)
(type_declaration
(identifier) @font-lock-type-face)
((builtin_type) @font-lock-type-face)
(output_declaration
(identifier) @font-lock-variable-name-face)
(output_declaration
(type) @font-lock-type-face))
:language 'bicep
:feature 'number
'((number)
@font-lock-number-face)
:language 'bicep
:feature 'string
'((string_content) @font-lock-string-face)
:language 'bicep
:feature 'boolean
'((boolean) @font-lock-constant-face)
:language 'bicep
:feature 'functions
'((call_expression
function: (identifier) @font-lock-function-name-face))
:language 'bicep
:feature 'error
:override t
'((ERROR) @font-lock-warning-face))
"Font-lock settings for BICEP.")
(defun bicep-ts-mode--defun-name (node)
"Return the defun name of NODE.
Return nil if there is no name or if NODE is not a defun node."
(treesit-node-text
(treesit-node-child node 1)
t))
;;;###autoload
(define-derived-mode bicep-ts-mode prog-mode "Bicep"
"Major mode for editing BICEP, powered by tree-sitter."
:group 'bicep-mode
:syntax-table bicep-ts-mode--syntax-table
(when (treesit-ready-p 'bicep)
(treesit-parser-create 'bicep)
;; Comments
(setq-local comment-start "# ")
(setq-local comment-end "")
;; Indent.
(setq-local treesit-simple-indent-rules bicep-ts-mode--indent-rules)
;; Navigation.
(setq-local treesit-defun-type-regexp
(rx (or "module_declaration" "type_declaration" "variable_declaration"
"parameter_declaration" "resource_declaration" "output_declaration")))
(setq-local treesit-defun-name-function #'bicep-ts-mode--defun-name)
;; Font-lock.
(setq-local treesit-font-lock-settings bicep-ts-mode--font-lock-settings)
(setq-local treesit-font-lock-feature-list
'((comment delimiter keyword)
(definition number string boolean)
(functions)
(error)))
;; Imenu.
(setq-local treesit-simple-imenu-settings
'(("Modules" "\\`module_declaration\\'" nil nil)
("Types" "\\`type_declaration\\'" nil nil)
("Variables" "\\`variable_declaration\\'" nil nil)
("Parameters" "\\`parameter_declaration\\'" nil nil)
("Resources" "\\`resource_declaration\\'" nil nil)
("Outputs" "\\`output_declaration\\'" nil nil)))
(treesit-major-mode-setup)))
(if (treesit-ready-p 'bicep)
(add-to-list 'auto-mode-alist '("\\.bicep\\'" . bicep-ts-mode)))
(provide 'bicep-ts-mode)
;;; bicep-ts-mode.el ends here
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] New major-mode: bicep-ts-mode
2023-12-22 11:55 ` Jostein Kjønigsen
@ 2023-12-24 14:32 ` Stefan Kangas
2024-01-02 7:52 ` Jostein Kjønigsen
0 siblings, 1 reply; 21+ messages in thread
From: Stefan Kangas @ 2023-12-24 14:32 UTC (permalink / raw)
To: jostein, Ergus via Emacs development discussions.
Cc: Yuan Fu, Theodor Thornhill
Jostein Kjønigsen <jostein@secure.kjonigsen.net> writes:
> Great. Attach is a newer revision which handles syntax-highlighting of
> user-defined types slightly better :)
Thanks, let's see if anyone else has any comments.
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] New major-mode: bicep-ts-mode
2023-12-24 14:32 ` Stefan Kangas
@ 2024-01-02 7:52 ` Jostein Kjønigsen
2024-01-03 7:16 ` Yuan Fu
0 siblings, 1 reply; 21+ messages in thread
From: Jostein Kjønigsen @ 2024-01-02 7:52 UTC (permalink / raw)
To: Stefan Kangas
Cc: Jostein Kjønigsen, Ergus via Emacs development discussions.,
Yuan Fu, Theodor Thornhill
[-- Attachment #1: Type: text/plain, Size: 507 bytes --]
> On 24 Dec 2023, at 15:32, Stefan Kangas <stefankangas@gmail.com> wrote:
>
> Jostein Kjønigsen <jostein@secure.kjonigsen.net> writes:
>
>> Great. Attach is a newer revision which handles syntax-highlighting of
>> user-defined types slightly better :)
>
> Thanks, let's see if anyone else has any comments.
Using this version I’ve found that array-type values was not indented properly (at all really).
Attached is a slightly modified version which fixes this issue.
—
Jostein
[-- Attachment #2: bicep-ts-mode.el --]
[-- Type: application/octet-stream, Size: 5878 bytes --]
;;; bicep-ts-mode.el --- tree-sitter support for Bicep -*- lexical-binding: t; -*-
;; Copyright (C) 2023-2023 Free Software Foundation, Inc.
;; Author : Jostein Kjønigsen <jostein@kjonigsen.net>
;; Maintainer : Jostein Kjønigsen <jostein@kjonigsen.net>
;; Created : December 2023
;; Keywords : bicep languages tree-sitter
;; This file is part of GNU Emacs.
;; GNU Emacs 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.
;; GNU Emacs 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;;
;;; Code:
(require 'treesit)
(declare-function treesit-parser-create "treesit.c")
(declare-function treesit-induce-sparse-tree "treesit.c")
(declare-function treesit-node-start "treesit.c")
(declare-function treesit-node-type "treesit.c")
(declare-function treesit-node-child "treesit.c")
(declare-function treesit-node-child-by-field-name "treesit.c")
(defcustom bicep-ts-mode-indent-offset 2
"Number of spaces for each indentation step in `bicep-ts-mode'."
:version "29.1"
:type 'natnum
:safe 'natnump
:group 'bicep)
(defvar bicep-ts-mode--syntax-table
(let ((table (make-syntax-table)))
(modify-syntax-entry ?= "." table)
(modify-syntax-entry ?\' "\"" table)
(modify-syntax-entry ?\n "> b" table)
table)
"Syntax table for `bicep-ts-mode'.")
(defvar bicep-ts-mode--indent-rules
`((bicep
((node-is "}") parent-bol 0)
((node-is "]") parent-bol 0)
((parent-is "array") parent-bol bicep-ts-mode-indent-offset)
((parent-is "object") parent-bol bicep-ts-mode-indent-offset)
((parent-is "for_statement") parent-bol bicep-ts-mode-indent-offset))))
(defvar bicep-ts-mode--keywords
'("var" "param" "resource"
"module" "type" "metadata"
"targetScope" "output"
"for" "in")
"Bicep keywords for tree-sitter font-locking.")
(defvar bicep-ts-mode--font-lock-settings
(treesit-font-lock-rules
:language 'bicep
:feature 'comment
'((comment) @font-lock-comment-face)
:language 'bicep
:feature 'delimiter
'(("=") @font-lock-delimiter-face)
:language 'bicep
:feature 'keyword
`([,@bicep-ts-mode--keywords] @font-lock-keyword-face)
:language 'bicep
:feature 'definition
'((parameter_declaration
(identifier) @font-lock-variable-name-face
(type) @font-lock-type-face)
(variable_declaration
(identifier) @font-lock-variable-name-face)
(resource_declaration
(identifier) @font-lock-variable-name-face)
(module_declaration
(identifier) @font-lock-variable-name-face)
(type_declaration
(identifier) @font-lock-type-face)
((builtin_type) @font-lock-type-face)
(output_declaration
(identifier) @font-lock-variable-name-face)
(output_declaration
(type) @font-lock-type-face))
:language 'bicep
:feature 'number
'((number)
@font-lock-number-face)
:language 'bicep
:feature 'string
'((string_content) @font-lock-string-face)
:language 'bicep
:feature 'boolean
'((boolean) @font-lock-constant-face)
:language 'bicep
:feature 'functions
'((call_expression
function: (identifier) @font-lock-function-name-face))
:language 'bicep
:feature 'error
:override t
'((ERROR) @font-lock-warning-face))
"Font-lock settings for BICEP.")
(defun bicep-ts-mode--defun-name (node)
"Return the defun name of NODE.
Return nil if there is no name or if NODE is not a defun node."
(treesit-node-text
(treesit-node-child node 1)
t))
;;;###autoload
(define-derived-mode bicep-ts-mode prog-mode "Bicep"
"Major mode for editing BICEP, powered by tree-sitter."
:group 'bicep-mode
:syntax-table bicep-ts-mode--syntax-table
(when (treesit-ready-p 'bicep)
(treesit-parser-create 'bicep)
;; Comments
(setq-local comment-start "# ")
(setq-local comment-end "")
;; Indent.
(setq-local treesit-simple-indent-rules bicep-ts-mode--indent-rules)
;; Navigation.
(setq-local treesit-defun-type-regexp
(rx (or "module_declaration" "type_declaration" "variable_declaration"
"parameter_declaration" "resource_declaration" "output_declaration")))
(setq-local treesit-defun-name-function #'bicep-ts-mode--defun-name)
;; Font-lock.
(setq-local treesit-font-lock-settings bicep-ts-mode--font-lock-settings)
(setq-local treesit-font-lock-feature-list
'((comment delimiter keyword)
(definition number string boolean)
(functions)
(error)))
;; Imenu.
(setq-local treesit-simple-imenu-settings
'(("Modules" "\\`module_declaration\\'" nil nil)
("Types" "\\`type_declaration\\'" nil nil)
("Variables" "\\`variable_declaration\\'" nil nil)
("Parameters" "\\`parameter_declaration\\'" nil nil)
("Resources" "\\`resource_declaration\\'" nil nil)
("Outputs" "\\`output_declaration\\'" nil nil)))
(treesit-major-mode-setup)))
(if (treesit-ready-p 'bicep)
(add-to-list 'auto-mode-alist '("\\.bicep\\'" . bicep-ts-mode)))
(provide 'bicep-ts-mode)
;;; bicep-ts-mode.el ends here
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] New major-mode: bicep-ts-mode
2024-01-02 7:52 ` Jostein Kjønigsen
@ 2024-01-03 7:16 ` Yuan Fu
2024-01-04 4:52 ` Stefan Kangas
0 siblings, 1 reply; 21+ messages in thread
From: Yuan Fu @ 2024-01-03 7:16 UTC (permalink / raw)
To: Jostein Kjønigsen
Cc: Stefan Kangas, Jostein Kjønigsen,
Ergus via Emacs development discussions., Theodor Thornhill
> On Jan 1, 2024, at 11:52 PM, Jostein Kjønigsen <jostein@secure.kjonigsen.net> wrote:
>
>
>> On 24 Dec 2023, at 15:32, Stefan Kangas <stefankangas@gmail.com> wrote:
>>
>> Jostein Kjønigsen <jostein@secure.kjonigsen.net> writes:
>>
>>> Great. Attach is a newer revision which handles syntax-highlighting of
>>> user-defined types slightly better :)
>>
>> Thanks, let's see if anyone else has any comments.
>
> Using this version I’ve found that array-type values was not indented properly (at all really).
>
> Attached is a slightly modified version which fixes this issue.
>
> —
> Jostein
>
> <bicep-ts-mode.el>
Looks good. Should we merge it now?
Yuan
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] New major-mode: bicep-ts-mode
2024-01-03 7:16 ` Yuan Fu
@ 2024-01-04 4:52 ` Stefan Kangas
2024-01-05 19:10 ` Jostein Kjønigsen
0 siblings, 1 reply; 21+ messages in thread
From: Stefan Kangas @ 2024-01-04 4:52 UTC (permalink / raw)
To: Yuan Fu, Jostein Kjønigsen
Cc: Jostein Kjønigsen, Ergus via Emacs development discussions.,
Theodor Thornhill
Yuan Fu <casouri@gmail.com> writes:
> Looks good. Should we merge it now?
No objections from me as long as Jostein thinks it's ready, but:
- It should be called out in NEWS.
- Don't forget updating `auto-mode-alist' if that makes sense.
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] New major-mode: bicep-ts-mode
2024-01-04 4:52 ` Stefan Kangas
@ 2024-01-05 19:10 ` Jostein Kjønigsen
0 siblings, 0 replies; 21+ messages in thread
From: Jostein Kjønigsen @ 2024-01-05 19:10 UTC (permalink / raw)
To: Stefan Kangas
Cc: Yuan Fu, Jostein Kjønigsen,
Ergus via Emacs development discussions., Theodor Thornhill
[-- Attachment #1: Type: text/plain, Size: 658 bytes --]
> On 4 Jan 2024, at 05:52, Stefan Kangas <stefankangas@gmail.com> wrote:
>
>> Looks good. Should we merge it now?
>
> No objections from me as long as Jostein thinks it's ready, but:
I’m happy with it for now!
> - It should be called out in NEWS.
Done!
> - Don't forget updating `auto-mode-alist' if that makes sense.
I’ve added it in the major-mode itself. I assume this is the right place to add it?
Updated is a patch based on latest git master which combines all these changes, and also adds code to obtain and build the Bicep language-grammar alongside the other languages.
—
Kind Regards
Jostein Kjønigsen

[-- Attachment #2.1: Type: text/html, Size: 1243 bytes --]
[-- Attachment #2.2: 0001-Add-support-for-Bicep-files-via-tree-sitter-based-ma.patch --]
[-- Type: application/octet-stream, Size: 8571 bytes --]
From b7aa90ae365cb08984f2b2fc6fd2e8f45018b6fe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jostein=20Kj=C3=B8nigsen?= <jostein@kjonigsen.net>
Date: Fri, 5 Jan 2024 19:58:19 +0100
Subject: [PATCH] Add support for Bicep-files via tree-sitter based major-mode
* admin/notes/tree-sitter/build-module/batch.sh: Add bicep grammar to list.
* admin/notes/tree-sitter/build-module/build.sh: Add org for bicep grammar.
* etc/NEWS: Updated news.
* lisp/progmodes/bicep-ts-mode.el: New major-mode bicep-ts-mode.
---
admin/notes/tree-sitter/build-module/batch.sh | 1 +
admin/notes/tree-sitter/build-module/build.sh | 7 +-
etc/NEWS | 4 +
lisp/progmodes/bicep-ts-mode.el | 179 ++++++++++++++++++
4 files changed, 189 insertions(+), 2 deletions(-)
create mode 100644 lisp/progmodes/bicep-ts-mode.el
diff --git a/admin/notes/tree-sitter/build-module/batch.sh b/admin/notes/tree-sitter/build-module/batch.sh
index 9988d1eae4e..6ed2888d1d8 100755
--- a/admin/notes/tree-sitter/build-module/batch.sh
+++ b/admin/notes/tree-sitter/build-module/batch.sh
@@ -2,6 +2,7 @@
languages=(
'bash'
+ 'bicep'
'c'
'cmake'
'cpp'
diff --git a/admin/notes/tree-sitter/build-module/build.sh b/admin/notes/tree-sitter/build-module/build.sh
index 969187b7f92..46fe3d2d8db 100755
--- a/admin/notes/tree-sitter/build-module/build.sh
+++ b/admin/notes/tree-sitter/build-module/build.sh
@@ -25,12 +25,15 @@ sourcedir=
grammardir="tree-sitter-${lang}"
case "${lang}" in
- "dockerfile")
- org="camdencheek"
+ "bicep")
+ org="amaanq"
;;
"cmake")
org="uyha"
;;
+ "dockerfile")
+ org="camdencheek"
+ ;;
"elixir")
org="elixir-lang"
;;
diff --git a/etc/NEWS b/etc/NEWS
index 7bbfbf9512d..7790d887a93 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1244,6 +1244,10 @@ A major mode based on the tree-sitter library for editing Elixir files.
*** New major mode 'lua-ts-mode'.
A major mode based on the tree-sitter library for editing Lua files.
+---
+*** New major mode 'bicep-ts-mode'.
+A major mode based on the tree-sitter library for editing Bicep files.
+
** Minibuffer and Completions
+++
diff --git a/lisp/progmodes/bicep-ts-mode.el b/lisp/progmodes/bicep-ts-mode.el
new file mode 100644
index 00000000000..fa42da5e270
--- /dev/null
+++ b/lisp/progmodes/bicep-ts-mode.el
@@ -0,0 +1,179 @@
+;;; bicep-ts-mode.el --- tree-sitter support for Bicep -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2023-2023 Free Software Foundation, Inc.
+
+;; Author : Jostein Kjønigsen <jostein@kjonigsen.net>
+;; Maintainer : Jostein Kjønigsen <jostein@kjonigsen.net>
+;; Created : December 2023
+;; Keywords : bicep languages tree-sitter
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs 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.
+
+;; GNU Emacs 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+;;
+
+;;; Code:
+
+(require 'treesit)
+
+(declare-function treesit-parser-create "treesit.c")
+(declare-function treesit-induce-sparse-tree "treesit.c")
+(declare-function treesit-node-start "treesit.c")
+(declare-function treesit-node-type "treesit.c")
+(declare-function treesit-node-child "treesit.c")
+(declare-function treesit-node-child-by-field-name "treesit.c")
+
+(defcustom bicep-ts-mode-indent-offset 2
+ "Number of spaces for each indentation step in `bicep-ts-mode'."
+ :version "29.1"
+ :type 'natnum
+ :safe 'natnump
+ :group 'bicep)
+
+(defvar bicep-ts-mode--syntax-table
+ (let ((table (make-syntax-table)))
+ (modify-syntax-entry ?= "." table)
+ (modify-syntax-entry ?\' "\"" table)
+ (modify-syntax-entry ?\n "> b" table)
+ table)
+ "Syntax table for `bicep-ts-mode'.")
+
+(defvar bicep-ts-mode--indent-rules
+ `((bicep
+ ((node-is "}") parent-bol 0)
+ ((node-is "]") parent-bol 0)
+ ((parent-is "array") parent-bol bicep-ts-mode-indent-offset)
+ ((parent-is "object") parent-bol bicep-ts-mode-indent-offset)
+ ((parent-is "for_statement") parent-bol bicep-ts-mode-indent-offset))))
+
+(defvar bicep-ts-mode--keywords
+ '("var" "param" "resource"
+ "module" "type" "metadata"
+ "targetScope" "output"
+ "for" "in")
+ "Bicep keywords for tree-sitter font-locking.")
+
+(defvar bicep-ts-mode--font-lock-settings
+ (treesit-font-lock-rules
+ :language 'bicep
+ :feature 'comment
+ '((comment) @font-lock-comment-face)
+
+ :language 'bicep
+ :feature 'delimiter
+ '(("=") @font-lock-delimiter-face)
+
+ :language 'bicep
+ :feature 'keyword
+ `([,@bicep-ts-mode--keywords] @font-lock-keyword-face)
+
+ :language 'bicep
+ :feature 'definition
+ '((parameter_declaration
+ (identifier) @font-lock-variable-name-face
+ (type) @font-lock-type-face)
+ (variable_declaration
+ (identifier) @font-lock-variable-name-face)
+ (resource_declaration
+ (identifier) @font-lock-variable-name-face)
+ (module_declaration
+ (identifier) @font-lock-variable-name-face)
+ (type_declaration
+ (identifier) @font-lock-type-face)
+ ((builtin_type) @font-lock-type-face)
+ (output_declaration
+ (identifier) @font-lock-variable-name-face)
+ (output_declaration
+ (type) @font-lock-type-face))
+
+ :language 'bicep
+ :feature 'number
+ '((number)
+ @font-lock-number-face)
+
+ :language 'bicep
+ :feature 'string
+ '((string_content) @font-lock-string-face)
+
+ :language 'bicep
+ :feature 'boolean
+ '((boolean) @font-lock-constant-face)
+
+ :language 'bicep
+ :feature 'functions
+ '((call_expression
+ function: (identifier) @font-lock-function-name-face))
+
+ :language 'bicep
+ :feature 'error
+ :override t
+ '((ERROR) @font-lock-warning-face))
+ "Font-lock settings for BICEP.")
+
+(defun bicep-ts-mode--defun-name (node)
+ "Return the defun name of NODE.
+Return nil if there is no name or if NODE is not a defun node."
+ (treesit-node-text
+ (treesit-node-child node 1)
+ t))
+
+;;;###autoload
+(define-derived-mode bicep-ts-mode prog-mode "Bicep"
+ "Major mode for editing BICEP, powered by tree-sitter."
+ :group 'bicep-mode
+ :syntax-table bicep-ts-mode--syntax-table
+
+ (when (treesit-ready-p 'bicep)
+ (treesit-parser-create 'bicep)
+
+ ;; Comments
+ (setq-local comment-start "# ")
+ (setq-local comment-end "")
+
+ ;; Indent.
+ (setq-local treesit-simple-indent-rules bicep-ts-mode--indent-rules)
+
+ ;; Navigation.
+ (setq-local treesit-defun-type-regexp
+ (rx (or "module_declaration" "type_declaration" "variable_declaration"
+ "parameter_declaration" "resource_declaration" "output_declaration")))
+ (setq-local treesit-defun-name-function #'bicep-ts-mode--defun-name)
+
+ ;; Font-lock.
+ (setq-local treesit-font-lock-settings bicep-ts-mode--font-lock-settings)
+ (setq-local treesit-font-lock-feature-list
+ '((comment delimiter keyword)
+ (definition number string boolean)
+ (functions)
+ (error)))
+
+ ;; Imenu.
+ (setq-local treesit-simple-imenu-settings
+ '(("Modules" "\\`module_declaration\\'" nil nil)
+ ("Types" "\\`type_declaration\\'" nil nil)
+ ("Variables" "\\`variable_declaration\\'" nil nil)
+ ("Parameters" "\\`parameter_declaration\\'" nil nil)
+ ("Resources" "\\`resource_declaration\\'" nil nil)
+ ("Outputs" "\\`output_declaration\\'" nil nil)))
+
+ (treesit-major-mode-setup)))
+
+(if (treesit-ready-p 'bicep)
+ (add-to-list 'auto-mode-alist '("\\.bicep\\'" . bicep-ts-mode)))
+
+(provide 'bicep-ts-mode)
+
+;;; bicep-ts-mode.el ends here
--
2.43.0
[-- Attachment #2.3: Type: text/html, Size: 234 bytes --]
^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH] New major-mode: bicep-ts-mode
2023-12-21 14:32 [PATCH] New major-mode: bicep-ts-mode Jostein Kjønigsen
2023-12-22 10:42 ` Stefan Kangas
@ 2024-01-07 18:04 ` Daniel Mendler via Emacs development discussions.
2024-01-07 20:26 ` Stefan Kangas
1 sibling, 1 reply; 21+ messages in thread
From: Daniel Mendler via Emacs development discussions. @ 2024-01-07 18:04 UTC (permalink / raw)
To: Jostein Kjønigsen
Cc: Ergus via Emacs development discussions., Yuan Fu,
Theodor Thornhill, Dmitry
Jostein Kjønigsen <jostein@secure.kjonigsen.net> writes:
> Currently if one works with Microsoft-oriented solutions (C#, .NET, TypeScript,
> Azure, etc) one often also has to work with Bicep. Bicep is a programming
> language used to describe Infrastructure-as-Code used for deploying services in
> Microsoft Azure cloud.
>
> Unfortunately the only editor currently available with useful Bicep-support is
> Microsoft VSCode. Working with Bicep in Emacs currently is not really feasible.
>
> The Bicep language itself is a type-safe language with an associated open-source
> toolchain, which in turn gets compiled to JSON-formatted Azure Resource
> Manager (ARM) templates, which can actually provision resources in Azure.
>
> With appropriate editor-support, working with Bicep is superior to working with
> the untyped JSON for ARM template purposes. As such, adding support for Bicep
> to Emacs, would mean most Azure-developers can still stay 100% within Emacs
> to do their job :)
Stefan Kangas <stefankangas@gmail.com> writes:
> Daniel Mendler via "Emacs development discussions." writes:
>> Also, recently there has also been a
>> discussion to add a `bicep-ts-mode' to Emacs core, with the argument
>> being that VSCode supports it. Makes sense, it is a Microsoft product to
>> help using Microsoft products. The description of Bicep on Github
>> (https://github.com/Azure/bicep) is "Bicep is a declarative language for
>> describing and deploying Azure resources". Does Bicep really need to be
>> part of Emacs core? Couldn't it be added to ELPA instead?
>
> I think we should be sympathetic to arguments such as the above, yes,
> but why not ask this question in the Bicep thread instead? :-)
Agree, the question if `bicep-ts-mode' should be added to ELPA instead
of core should be discussed in the Bicep thread.
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] New major-mode: bicep-ts-mode
2024-01-07 18:04 ` Daniel Mendler via Emacs development discussions.
@ 2024-01-07 20:26 ` Stefan Kangas
2024-01-07 23:25 ` Stefan Monnier
0 siblings, 1 reply; 21+ messages in thread
From: Stefan Kangas @ 2024-01-07 20:26 UTC (permalink / raw)
To: Daniel Mendler, Jostein Kjønigsen
Cc: Ergus via Emacs development discussions., Yuan Fu,
Theodor Thornhill, Dmitry, Stefan Monnier, Philip Kaludercic
Daniel Mendler via "Emacs development discussions."
<emacs-devel@gnu.org> writes:
> Jostein Kjønigsen <jostein@secure.kjonigsen.net> writes:
>> Currently if one works with Microsoft-oriented solutions (C#, .NET, TypeScript,
>> Azure, etc) one often also has to work with Bicep. Bicep is a programming
>> language used to describe Infrastructure-as-Code used for deploying services in
>> Microsoft Azure cloud.
>>
>> Unfortunately the only editor currently available with useful Bicep-support is
>> Microsoft VSCode. Working with Bicep in Emacs currently is not really feasible.
>>
>> The Bicep language itself is a type-safe language with an associated open-source
>> toolchain, which in turn gets compiled to JSON-formatted Azure Resource
>> Manager (ARM) templates, which can actually provision resources in Azure.
>>
>> With appropriate editor-support, working with Bicep is superior to working with
>> the untyped JSON for ARM template purposes. As such, adding support for Bicep
>> to Emacs, would mean most Azure-developers can still stay 100% within Emacs
>> to do their job :)
>
> Stefan Kangas <stefankangas@gmail.com> writes:
>> Daniel Mendler via "Emacs development discussions." writes:
>>> Also, recently there has also been a
>>> discussion to add a `bicep-ts-mode' to Emacs core, with the argument
>>> being that VSCode supports it. Makes sense, it is a Microsoft product to
>>> help using Microsoft products. The description of Bicep on Github
>>> (https://github.com/Azure/bicep) is "Bicep is a declarative language for
>>> describing and deploying Azure resources". Does Bicep really need to be
>>> part of Emacs core? Couldn't it be added to ELPA instead?
>>
>> I think we should be sympathetic to arguments such as the above, yes,
>> but why not ask this question in the Bicep thread instead? :-)
>
> Agree, the question if `bicep-ts-mode' should be added to ELPA instead
> of core should be discussed in the Bicep thread.
[Copying in Stefan and Philip.]
The basic question is: Would bicep-mode might make more sense in GNU
ELPA or in Emacs itself?
I don't know anything about Bicep or what it does specifically, but I'm
starting to lean towards GNU ELPA, myself. The basic reason is that
adding Bicep to core could be seen as promoting Azure, given that it
seems to only be useful for using that service specifically.
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] New major-mode: bicep-ts-mode
2024-01-07 20:26 ` Stefan Kangas
@ 2024-01-07 23:25 ` Stefan Monnier
2024-01-08 11:30 ` Jostein Kjønigsen
0 siblings, 1 reply; 21+ messages in thread
From: Stefan Monnier @ 2024-01-07 23:25 UTC (permalink / raw)
To: Stefan Kangas
Cc: Daniel Mendler, Jostein Kjønigsen,
Ergus via Emacs development discussions., Yuan Fu,
Theodor Thornhill, Dmitry, Philip Kaludercic
> The basic question is: Would bicep-mode might make more sense in GNU
> ELPA or in Emacs itself?
For me it's clearly GNU ELPA.
[ Then again, IMO most of the new *-ts-modes should be in GNU
ELPA. ]
Stefan
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] New major-mode: bicep-ts-mode
2024-01-07 23:25 ` Stefan Monnier
@ 2024-01-08 11:30 ` Jostein Kjønigsen
2024-01-08 19:23 ` Stefan Kangas
0 siblings, 1 reply; 21+ messages in thread
From: Jostein Kjønigsen @ 2024-01-08 11:30 UTC (permalink / raw)
To: Stefan Monnier
Cc: Stefan Kangas, Daniel Mendler,
Ergus via Emacs development discussions., Yuan Fu,
Theodor Thornhill, Dmitry, Philip Kaludercic
[-- Attachment #1: Type: text/plain, Size: 1024 bytes --]
> On 8 Jan 2024, at 00:25, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>
>> The basic question is: Would bicep-mode might make more sense in GNU
>> ELPA or in Emacs itself?
>
> For me it's clearly GNU ELPA.
> [ Then again, IMO most of the new *-ts-modes should be in GNU
> ELPA. ]
>
>
> Stefan
>
I’ve helped implement other *-ts-modes which has real uses across the board (c#, typescript, toml), and as such I think they are nice to have in Emacs core.
I agree this one is different from those in that it is used almost exclusively to target Microsoft Azure, and that it has no other general purpose computing type use-cases outside that.
This is why I asked the question to begin with, since the answer was non-obvious to me.
If people decide ELPA is best, I’m fine with that. The most important thing for me is just being able to work with “all” my stuff efficiently inside Emacs, and that this mode is available *somewhere*.
—
Kind Regards
Jostein Kjønigsen
[-- Attachment #2: Type: text/html, Size: 1561 bytes --]
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] New major-mode: bicep-ts-mode
2024-01-08 11:30 ` Jostein Kjønigsen
@ 2024-01-08 19:23 ` Stefan Kangas
2024-01-09 0:33 ` Stefan Monnier
0 siblings, 1 reply; 21+ messages in thread
From: Stefan Kangas @ 2024-01-08 19:23 UTC (permalink / raw)
To: Jostein Kjønigsen, Stefan Monnier
Cc: Daniel Mendler, Ergus via Emacs development discussions., Yuan Fu,
Theodor Thornhill, Dmitry, Philip Kaludercic
Jostein Kjønigsen <jostein@secure.kjonigsen.net> writes:
> If people decide ELPA is best, I’m fine with that. The most important
> thing for me is just being able to work with “all” my stuff
> efficiently inside Emacs, and that this mode is available *somewhere*.
OK, let's go with GNU ELPA.
Could you set up the repository and let us know where it is?
Then we can add it.
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] New major-mode: bicep-ts-mode
2024-01-08 19:23 ` Stefan Kangas
@ 2024-01-09 0:33 ` Stefan Monnier
2024-01-09 19:12 ` Jostein Kjønigsen
0 siblings, 1 reply; 21+ messages in thread
From: Stefan Monnier @ 2024-01-09 0:33 UTC (permalink / raw)
To: Stefan Kangas
Cc: Jostein Kjønigsen, Daniel Mendler,
Ergus via Emacs development discussions., Yuan Fu,
Theodor Thornhill, Dmitry, Philip Kaludercic
>> If people decide ELPA is best, I’m fine with that. The most important
>> thing for me is just being able to work with “all” my stuff
>> efficiently inside Emacs, and that this mode is available *somewhere*.
> OK, let's go with GNU ELPA.
> Could you set up the repository and let us know where it is?
> Then we can add it.
Of course, we can also host it directly in `elpa.git`.
Stefan
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] New major-mode: bicep-ts-mode
2024-01-09 0:33 ` Stefan Monnier
@ 2024-01-09 19:12 ` Jostein Kjønigsen
2024-01-09 19:16 ` Stefan Kangas
2024-01-09 19:24 ` Philip Kaludercic
0 siblings, 2 replies; 21+ messages in thread
From: Jostein Kjønigsen @ 2024-01-09 19:12 UTC (permalink / raw)
To: Stefan Monnier, Stefan Kangas
Cc: Daniel Mendler, Ergus via Emacs development discussions., Yuan Fu,
Theodor Thornhill, Dmitry, Philip Kaludercic
[-- Attachment #1: Type: text/plain, Size: 686 bytes --]
On 09.01.2024 01:33, Stefan Monnier wrote:
>> OK, let's go with GNU ELPA.
>> Could you set up the repository and let us know where it is?
>> Then we can add it.
> Of course, we can also host it directly in `elpa.git`.
>
>
> Stefan
>
Before reading this email, I created this bare-bones repo:
https://github.com/josteink/bicep-ts-mode
I'd be more happy if we can make it part elpa.git, since that to me
sounds like a better "home" for an Emacs-package, but I must admit I've
never actually contributed a package directly to ELPA earlier.
Is there a process I would need to follow, or could someone else help
land it there, based on the source provided so far?
--
Jostein
[-- Attachment #2: Type: text/html, Size: 1321 bytes --]
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] New major-mode: bicep-ts-mode
2024-01-09 19:12 ` Jostein Kjønigsen
@ 2024-01-09 19:16 ` Stefan Kangas
2024-01-14 4:43 ` Stefan Monnier
2024-01-09 19:24 ` Philip Kaludercic
1 sibling, 1 reply; 21+ messages in thread
From: Stefan Kangas @ 2024-01-09 19:16 UTC (permalink / raw)
To: Jostein Kjønigsen, Stefan Monnier
Cc: Daniel Mendler, Ergus via Emacs development discussions., Yuan Fu,
Theodor Thornhill, Dmitry, Philip Kaludercic
Jostein Kjønigsen <jostein@secure.kjonigsen.net> writes:
> I'd be more happy if we can make it part elpa.git, since that to me
> sounds like a better "home" for an Emacs-package, but I must admit I've
> never actually contributed a package directly to ELPA earlier.
>
> Is there a process I would need to follow, or could someone else help
> land it there, based on the source provided so far?
See README in elpa.git and ask here if you have any questions.
I think you should apply for commit access for this workflow to be
really practical. Stefan M, is that correct?
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] New major-mode: bicep-ts-mode
2024-01-09 19:16 ` Stefan Kangas
@ 2024-01-14 4:43 ` Stefan Monnier
2024-01-15 9:56 ` Jostein Kjønigsen
2024-01-15 17:35 ` Philip Kaludercic
0 siblings, 2 replies; 21+ messages in thread
From: Stefan Monnier @ 2024-01-14 4:43 UTC (permalink / raw)
To: Stefan Kangas
Cc: Jostein Kjønigsen, Daniel Mendler,
Ergus via Emacs development discussions., Yuan Fu,
Theodor Thornhill, Dmitry, Philip Kaludercic
Stefan Kangas [2024-01-09 11:16:36] wrote:
> Jostein Kjønigsen <jostein@secure.kjonigsen.net> writes:
>> I'd be more happy if we can make it part elpa.git, since that to me
>> sounds like a better "home" for an Emacs-package, but I must admit I've
>> never actually contributed a package directly to ELPA earlier.
>>
>> Is there a process I would need to follow, or could someone else help
>> land it there, based on the source provided so far?
>
> See README in elpa.git and ask here if you have any questions.
>
> I think you should apply for commit access for this workflow to be
> really practical. Stefan M, is that correct?
Yes, but doesn't Jostein already have it? IIRC the alternative was to
host the major mode in `emacs.git` and Jostein has two other major
modes in `emacs.git`, so how does he maintain those?
Stefan
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] New major-mode: bicep-ts-mode
2024-01-14 4:43 ` Stefan Monnier
@ 2024-01-15 9:56 ` Jostein Kjønigsen
2024-01-15 17:35 ` Philip Kaludercic
1 sibling, 0 replies; 21+ messages in thread
From: Jostein Kjønigsen @ 2024-01-15 9:56 UTC (permalink / raw)
To: Stefan Monnier
Cc: Stefan Kangas, Daniel Mendler,
Ergus via Emacs development discussions., Yuan Fu,
Theodor Thornhill, Dmitry, Philip Kaludercic
[-- Attachment #1: Type: text/plain, Size: 921 bytes --]
> On 14 Jan 2024, at 05:43, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>
> Stefan Kangas [2024-01-09 11:16:36] wrote:
>>
>>
>> I think you should apply for commit access for this workflow to be
>> really practical. Stefan M, is that correct?
>
> Yes, but doesn't Jostein already have it? IIRC the alternative was to
> host the major mode in `emacs.git` and Jostein has two other major
> modes in `emacs.git`, so how does he maintain those?
>
>
> Stefan
>
Hey Stefan.
I don’t have commit access. I never requested it, and my patches usually got merged within a few days anyway, so I didn’t fully see the need.
I wouldn’t object to getting it, but it’s not a critical bus-factor for me either.
Looking at it in this particular case, I’m not getting anywhere on the ELPA flow right now, so this might be the appropriate time to make that change? :)
—
Jostein
[-- Attachment #2: Type: text/html, Size: 1430 bytes --]
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] New major-mode: bicep-ts-mode
2024-01-14 4:43 ` Stefan Monnier
2024-01-15 9:56 ` Jostein Kjønigsen
@ 2024-01-15 17:35 ` Philip Kaludercic
2024-01-15 19:20 ` Stefan Monnier
1 sibling, 1 reply; 21+ messages in thread
From: Philip Kaludercic @ 2024-01-15 17:35 UTC (permalink / raw)
To: Stefan Monnier
Cc: Stefan Kangas, Jostein Kjønigsen, Daniel Mendler,
Ergus via Emacs development discussions., Yuan Fu,
Theodor Thornhill, Dmitry
Stefan Monnier <monnier@iro.umontreal.ca> writes:
> Stefan Kangas [2024-01-09 11:16:36] wrote:
>> Jostein Kjønigsen <jostein@secure.kjonigsen.net> writes:
>>> I'd be more happy if we can make it part elpa.git, since that to me
>>> sounds like a better "home" for an Emacs-package, but I must admit I've
>>> never actually contributed a package directly to ELPA earlier.
>>>
>>> Is there a process I would need to follow, or could someone else help
>>> land it there, based on the source provided so far?
>>
>> See README in elpa.git and ask here if you have any questions.
>>
>> I think you should apply for commit access for this workflow to be
>> really practical. Stefan M, is that correct?
>
> Yes, but doesn't Jostein already have it? IIRC the alternative was to
> host the major mode in `emacs.git` and Jostein has two other major
> modes in `emacs.git`, so how does he maintain those?
Did I miss something (see also <87bk9us421.fsf@posteo.net>), or what is
the reason for not taking the usual route of mirroring some external
repository, as is some with the vast majority of ELPA packages.
>
>
> Stefan
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] New major-mode: bicep-ts-mode
2024-01-15 17:35 ` Philip Kaludercic
@ 2024-01-15 19:20 ` Stefan Monnier
0 siblings, 0 replies; 21+ messages in thread
From: Stefan Monnier @ 2024-01-15 19:20 UTC (permalink / raw)
To: Philip Kaludercic
Cc: Stefan Kangas, Jostein Kjønigsen, Daniel Mendler,
Ergus via Emacs development discussions., Yuan Fu,
Theodor Thornhill, Dmitry
> Did I miss something (see also <87bk9us421.fsf@posteo.net>), or what is
> the reason for not taking the usual route of mirroring some external
> repository, as is some with the vast majority of ELPA packages.
I don't think you missed anything. What happened is that Jostein has
already several packages in `emacs.git` so I assumed he had commit
access, so I suggested to keep the new package in `elpa.git` which would
save us from any mirroring (along with the risk of forking 🙂).
But I have no objection to keeping it in some external repository like
we do for most (but not all) other packages. Also, it can be changed
easily later on, so it's really not an important decision.
Stefan
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] New major-mode: bicep-ts-mode
2024-01-09 19:12 ` Jostein Kjønigsen
2024-01-09 19:16 ` Stefan Kangas
@ 2024-01-09 19:24 ` Philip Kaludercic
1 sibling, 0 replies; 21+ messages in thread
From: Philip Kaludercic @ 2024-01-09 19:24 UTC (permalink / raw)
To: Jostein Kjønigsen
Cc: Stefan Monnier, Stefan Kangas, Daniel Mendler,
Ergus via Emacs development discussions., Yuan Fu,
Theodor Thornhill, Dmitry
Jostein Kjønigsen <jostein@secure.kjonigsen.net> writes:
> On 09.01.2024 01:33, Stefan Monnier wrote:
>>> OK, let's go with GNU ELPA.
>>> Could you set up the repository and let us know where it is?
>>> Then we can add it.
>> Of course, we can also host it directly in `elpa.git`.
>>
>>
>> Stefan
>>
> Before reading this email, I created this bare-bones repo:
> https://github.com/josteink/bicep-ts-mode
>
> I'd be more happy if we can make it part elpa.git, since that to me
> sounds like a better "home" for an Emacs-package, but I must admit
> I've never actually contributed a package directly to ELPA earlier.
Most packages on ELPA are not primarily hosted inside of elpa.git, but
just mirrored, see
https://git.savannah.gnu.org/cgit/emacs/elpa.git/tree/elpa-packages
So this doesn't have to be a concern, it would be simpler to use an
external repository that you already have access to.
> Is there a process I would need to follow, or could someone else help
> land it there, based on the source provided so far?
>
> --
> Jostein
^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2024-01-15 19:20 UTC | newest]
Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-21 14:32 [PATCH] New major-mode: bicep-ts-mode Jostein Kjønigsen
2023-12-22 10:42 ` Stefan Kangas
2023-12-22 11:55 ` Jostein Kjønigsen
2023-12-24 14:32 ` Stefan Kangas
2024-01-02 7:52 ` Jostein Kjønigsen
2024-01-03 7:16 ` Yuan Fu
2024-01-04 4:52 ` Stefan Kangas
2024-01-05 19:10 ` Jostein Kjønigsen
2024-01-07 18:04 ` Daniel Mendler via Emacs development discussions.
2024-01-07 20:26 ` Stefan Kangas
2024-01-07 23:25 ` Stefan Monnier
2024-01-08 11:30 ` Jostein Kjønigsen
2024-01-08 19:23 ` Stefan Kangas
2024-01-09 0:33 ` Stefan Monnier
2024-01-09 19:12 ` Jostein Kjønigsen
2024-01-09 19:16 ` Stefan Kangas
2024-01-14 4:43 ` Stefan Monnier
2024-01-15 9:56 ` Jostein Kjønigsen
2024-01-15 17:35 ` Philip Kaludercic
2024-01-15 19:20 ` Stefan Monnier
2024-01-09 19:24 ` Philip Kaludercic
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.