unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [NonGNU ELPA] New package: blueprint-ts-mode
@ 2023-09-09 10:10 Huan Thieu Nguyen
  2023-09-09 11:45 ` Eli Zaretskii
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Huan Thieu Nguyen @ 2023-09-09 10:10 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 183 bytes --]

Hi hi,

I made a tree-sitter based mode for blueprint files 
<https://github.com/huanie/blueprint-ts-mode>. I'd like to add it to 
NonGNU ELPA.

With best regards!

Nguyen Thieu Huan

[-- Attachment #2: 0001-Submitting-blueprint-ts-mode-package.patch --]
[-- Type: text/x-patch, Size: 793 bytes --]

From 474a6639e6a2acbb2e2630e3f9aa25370de26b2e Mon Sep 17 00:00:00 2001
From: Huan Nguyen <nguyenthieuhuan@gmail.com>
Date: Sat, 9 Sep 2023 11:54:16 +0200
Subject: [PATCH] Submitting blueprint-ts-mode package.

---
 elpa-packages | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/elpa-packages b/elpa-packages
index d8dac1e55e..ed5c29c533 100644
--- a/elpa-packages
+++ b/elpa-packages
@@ -63,6 +63,10 @@
 
  (blow                  :url "https://codeberg.org/akib/emacs-blow")
 
+ (blueprint-ts-mode     :url "https://github.com/huanie/blueprint-ts-mode.git"
+                        :readme "README.org"
+                        :ignored-files ("LICENSE"))
+ 
  (boxquote		:url "https://github.com/davep/boxquote.el.git"
   :readme "README.md"
   :ignored-files ("COPYING"))
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [NonGNU ELPA] New package: blueprint-ts-mode
  2023-09-09 10:10 [NonGNU ELPA] New package: blueprint-ts-mode Huan Thieu Nguyen
@ 2023-09-09 11:45 ` Eli Zaretskii
       [not found]   ` <c462af40-0b28-4c57-8097-18248f352fc3@gmail.com>
  2023-10-02  1:04 ` Stefan Monnier via Emacs development discussions.
  2023-10-02 10:20 ` Philip Kaludercic
  2 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2023-09-09 11:45 UTC (permalink / raw)
  To: Huan Thieu Nguyen; +Cc: emacs-devel

> Date: Sat, 9 Sep 2023 12:10:38 +0200
> From: Huan Thieu Nguyen <nguyenthieuhuan@gmail.com>
> 
> I made a tree-sitter based mode for blueprint files 
> <https://github.com/huanie/blueprint-ts-mode>. I'd like to add it to 
> NonGNU ELPA.

Thanks, but where is the tree-sitter grammar library for this mode?  I
don't see its URL or any other information anywhere in the mode's
source.  How would the users know where to find the grammar?



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [NonGNU ELPA] New package: blueprint-ts-mode
       [not found]   ` <c462af40-0b28-4c57-8097-18248f352fc3@gmail.com>
@ 2023-09-09 12:23     ` Eli Zaretskii
  0 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2023-09-09 12:23 UTC (permalink / raw)
  To: Huan Thieu Nguyen; +Cc: emacs-devel

> Date: Sat, 9 Sep 2023 13:51:55 +0200
> From: Huan Thieu Nguyen <nguyenthieuhuan@gmail.com>
> 
> I've added instructions in the README.org on how to get the grammar.
> 
> The grammar is here <https://github.com/huanie/tree-sitter-blueprint>.

Thanks!



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [NonGNU ELPA] New package: blueprint-ts-mode
  2023-09-09 10:10 [NonGNU ELPA] New package: blueprint-ts-mode Huan Thieu Nguyen
  2023-09-09 11:45 ` Eli Zaretskii
@ 2023-10-02  1:04 ` Stefan Monnier via Emacs development discussions.
  2023-10-02 10:20 ` Philip Kaludercic
  2 siblings, 0 replies; 5+ messages in thread
From: Stefan Monnier via Emacs development discussions. @ 2023-10-02  1:04 UTC (permalink / raw)
  To: emacs-devel

> I made a tree-sitter based mode for blueprint files
> <https://github.com/huanie/blueprint-ts-mode>. I'd like to add it to
> NonGNU ELPA.

Thanks, added,


        Stefan




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [NonGNU ELPA] New package: blueprint-ts-mode
  2023-09-09 10:10 [NonGNU ELPA] New package: blueprint-ts-mode Huan Thieu Nguyen
  2023-09-09 11:45 ` Eli Zaretskii
  2023-10-02  1:04 ` Stefan Monnier via Emacs development discussions.
@ 2023-10-02 10:20 ` Philip Kaludercic
  2 siblings, 0 replies; 5+ messages in thread
From: Philip Kaludercic @ 2023-10-02 10:20 UTC (permalink / raw)
  To: Huan Thieu Nguyen; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 298 bytes --]

Huan Thieu Nguyen <nguyenthieuhuan@gmail.com> writes:

> Hi hi,
>
> I made a tree-sitter based mode for blueprint files
> <https://github.com/huanie/blueprint-ts-mode>. I'd like to add it to
> NonGNU ELPA.
>
> With best regards!
>
> Nguyen Thieu Huan

A few suggestions and comments from my side:


[-- Attachment #2: Type: text/plain, Size: 3045 bytes --]

diff --git a/blueprint-ts-mode.el b/blueprint-ts-mode.el
index 9a88399..d33e6d0 100644
--- a/blueprint-ts-mode.el
+++ b/blueprint-ts-mode.el
@@ -25,26 +25,34 @@
 ;;; Commentary:
 
 ;; Treesitter based major mode for editing Blueprint files.
-;; Blueprint is a new markup language for GTK4 user interfaces.  For more information see <https://jwestman.pages.gitlab.gnome.org/blueprint-compiler/>.
-;; This mode provides syntax highlighting, eglot integration and Treesitter based navigation.
+
+;; Blueprint is a new markup language for GTK4 user interfaces.  For
+;; more information see
+;; <https://jwestman.pages.gitlab.gnome.org/blueprint-compiler/>.
+;; This mode provides syntax highlighting, eglot integration and
+;; Treesitter based navigation.
 
 ;;; Code:
 
 (require 'treesit)
-(require 'rx)
+(eval-when-compile (require 'rx))
 (require 'eglot)
 
+(defgroup blueprint ()
+  "Tree-sitter support for Blueprint files."
+  :prefix "blueprint-ts-"
+  :group 'languages)
+
 (defcustom blueprint-ts-mode-indent-offset 2
   "Number of spaces for each indentation step in `json-ts-mode'."
-  :version "29.1"
   :type 'integer
-  :safe 'integerp
-  :group 'blueprint)
+  :safe #'integerp)
 
 (defvar blueprint-ts-mode--keywords
   '("menu" "item" "section" "styles" "using" "bind" "template")
   "Blueprint keywords for tree-sitter font-locking.")
 
+;; Why a macro?
 (defmacro blueprint-ts-mode--treesit-font-lock-rules (language &rest rules)
   "Wrapper around `treesit-font-lock-rules'.
 `LANGUAGE' is the treesitter language to use.
@@ -62,7 +70,7 @@
      ((node-is ")") parent-bol 0)
      ((node-is "]") parent-bol 0)
      ((n-p-gp "object" "child" "object_content")
-      prev-sibling 0) ;; [child_type] indent
+      prev-sibling 0) ;; [child_type] indent (is this a meaningful comment?)
      ((parent-is "object_content") parent-bol blueprint-ts-mode-indent-offset)
      ((parent-is "template") parent-bol blueprint-ts-mode-indent-offset)
      ((parent-is "styles") parent-bol blueprint-ts-mode-indent-offset)
@@ -101,7 +109,6 @@
 ;;;###autoload
 (define-derived-mode blueprint-ts-mode prog-mode "Blueprint"
   "Blueprint major mode using treesitter."
-  :group 'blueprint
   (when (treesit-ready-p 'blueprint)
     (treesit-parser-create 'blueprint)
     ;; Comments
@@ -118,7 +125,7 @@
 		(rx (or "template" "object" "menu")))
     (setq-local treesit-sentence-type-regexp (rx (or "menu_attribute" "property")))
     ;; Font-lock
-    (setq-local treesit-font-lock-level 4)
+    (setq-local treesit-font-lock-level 4) ;isn't this a user option?
     (setq-local treesit-font-lock-feature-list
 		'((comment variable)
 		  (string keyword type)
@@ -128,9 +135,8 @@
     (treesit-major-mode-setup)))
 
 (add-to-list 'auto-mode-alist '("\\.blp\\'" . blueprint-ts-mode))
-(add-to-list 'eglot-server-programs
+(add-to-list 'eglot-server-programs	;is there some way around having to load Eglot?
              '(blueprint-ts-mode . ("blueprint-compiler" "lsp")))
 
-
 (provide 'blueprint-ts-mode)
 ;;; blueprint-ts-mode.el ends here

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-10-02 10:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-09 10:10 [NonGNU ELPA] New package: blueprint-ts-mode Huan Thieu Nguyen
2023-09-09 11:45 ` Eli Zaretskii
     [not found]   ` <c462af40-0b28-4c57-8097-18248f352fc3@gmail.com>
2023-09-09 12:23     ` Eli Zaretskii
2023-10-02  1:04 ` Stefan Monnier via Emacs development discussions.
2023-10-02 10:20 ` Philip Kaludercic

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).