Unnamed repository; edit this file 'description' to name the repository.
-rw-r--r--book/src/generated/lang-support.md1
-rw-r--r--languages.toml10
-rw-r--r--runtime/queries/mail/highlights.scm28
-rw-r--r--runtime/queries/mail/textobjects.scm13
4 files changed, 52 insertions, 0 deletions
diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md
index 4dd49ec3..7b161904 100644
--- a/book/src/generated/lang-support.md
+++ b/book/src/generated/lang-support.md
@@ -134,6 +134,7 @@
| log | ✓ | | | |
| lpf | ✓ | | | |
| lua | ✓ | ✓ | ✓ | `lua-language-server` |
+| mail | ✓ | ✓ | | |
| make | ✓ | | ✓ | |
| markdoc | ✓ | | | `markdoc-ls` |
| markdown | ✓ | | | `marksman`, `markdown-oxide` |
diff --git a/languages.toml b/languages.toml
index a93db7d3..c24e49a7 100644
--- a/languages.toml
+++ b/languages.toml
@@ -1677,6 +1677,16 @@ name = "tablegen"
source = { git = "https://github.com/Flakebi/tree-sitter-tablegen", rev = "3e9c4822ab5cdcccf4f8aa9dcd42117f736d51d9" }
[[language]]
+name = "mail"
+scope = "text.mail"
+file-types = ["eml"]
+injection-regex = "mail|eml|email"
+
+[[grammar]]
+name = "mail"
+source = { git = "https://github.com/ficcdaf/tree-sitter-mail", rev = "8e60f38efbae1cc5f22833ae13c5500dd0f3b12f" }
+
+[[language]]
name = "markdown"
scope = "source.md"
injection-regex = "md|markdown"
diff --git a/runtime/queries/mail/highlights.scm b/runtime/queries/mail/highlights.scm
new file mode 100644
index 00000000..ed06b568
--- /dev/null
+++ b/runtime/queries/mail/highlights.scm
@@ -0,0 +1,28 @@
+; header fields
+[
+ (header_field_email)
+ (header_field_subject)
+ (header_field)
+] @keyword
+
+; delimited punctuation
+(header_separator) @punctuation.delimiter
+(email_delimiter) @punctuation.delimiter
+
+; email subject contents
+(header_subject
+ (subject) @markup.bold)
+; extra metadata headers
+(header_other
+ (header_unstructured) @comment)
+
+; Addressee Name (Firstname, Lastname, etc.)
+(atom) @variable
+
+; Email Address
+(email) @string
+
+; Quoted Reply
+(quote_marker) @punctuation.special
+(quote_contents) @markup.quote
+
diff --git a/runtime/queries/mail/textobjects.scm b/runtime/queries/mail/textobjects.scm
new file mode 100644
index 00000000..07191dc6
--- /dev/null
+++ b/runtime/queries/mail/textobjects.scm
@@ -0,0 +1,13 @@
+(atom_block
+ (atom) @entry.inside) @entry.around
+
+(email_address) @entry.around
+(header_other
+ (header_unstructured) @entry.around)
+
+(quoted_block)+ @comment.around
+
+(body_block)+ @function.around
+
+(header_subject
+ (subject) @function.around)