From: Philip Kaludercic <philipk@posteo.net>
To: Huan Thieu Nguyen <nguyenthieuhuan@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: [NonGNU ELPA] New package: blueprint-ts-mode
Date: Mon, 02 Oct 2023 10:20:25 +0000 [thread overview]
Message-ID: <87y1glfhqu.fsf@posteo.net> (raw)
In-Reply-To: <1e45e194-a180-4d80-bd2b-2b5961d760e8@gmail.com> (Huan Thieu Nguyen's message of "Sat, 9 Sep 2023 12:10:38 +0200")
[-- 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
prev parent reply other threads:[~2023-10-02 10:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87y1glfhqu.fsf@posteo.net \
--to=philipk@posteo.net \
--cc=emacs-devel@gnu.org \
--cc=nguyenthieuhuan@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.