all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Rahul Martim Juliato <rahuljuliato@gmail.com>,
	Yuan Fu <casouri@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: [PATCH] feat: add markdown-ts-mode
Date: Sat, 20 Apr 2024 09:44:07 +0300	[thread overview]
Message-ID: <86frvga5zc.fsf@gnu.org> (raw)
In-Reply-To: <877cgs7m4e.fsf@gmail.com> (message from Rahul Martim Juliato on Sat, 20 Apr 2024 00:23:45 -0300)

> From: Rahul Martim Juliato <rahuljuliato@gmail.com>
> Date: Sat, 20 Apr 2024 00:23:45 -0300
> 
> I've been using Emacs without any extra packages as an educational
> experiment after years of package hording.
> 
> 
> One of the few things I've been missing is a way of displaying some sort
> of syntax highlight for markdown documents.
> 
> 
> It feels a bit frustrating opening a README.md file with a single face
> color, since Emacs from the box can handle so much.  I am sure others
> might have shared this feeling before.
> 
> 
> This patch is a modified version of a package I've recently published on
> MELPA, screenshots are available here:
> https://github.com/LionyxML/markdown-ts-mode
> 
> 
> It is a very basic mode that provides syntax highlight and imenu support
> using treesitter grammar from
> https://github.com/tree-sitter-grammars/tree-sitter-markdown
> 
> 
> The idea here is to provide minimal support to Emacs and continue
> building up features in the future.
> 
> 
> It is the first time I contribute to Emacs devel, so please let me know
> if I did something wrong or anything is not at the expected standards.

Thanks, please see a couple of comments below.  I've CC'ed Yuan as
well, in case he has comments.

> >From 364f61b03d601d2cb3aeb1687da2d1b2a232474c Mon Sep 17 00:00:00 2001
> From: Rahul Martim Juliato <rahul.juliato@gmail.com>
> Date: Fri, 19 Apr 2024 23:21:20 -0300
> 
> ---
>  etc/NEWS                           |   5 ++
>  lisp/progmodes/markdown-ts-mode.el | 106 +++++++++++++++++++++++++++++
>  2 files changed, 111 insertions(+)
>  create mode 100644 lisp/progmodes/markdown-ts-mode.el

Please accompany the patches with a ChangeLog-style commit log
message; see CONTRIBUTE for the details.  In this case, you'd need a
very minimal one, something like:

  * lisp/progmodes/markdown-ts-mode.el: New file.
  * etc/NEWS: Announce the new mode.

> +---
> +*** New major mode 'markdown-ts-mode'.
> +A major mode based on the tree-sitter library for editing Markdown files.

How about mentioning this in the user manual as well?  It doesn't have
to be anything more than just the name of the mode.

> diff --git a/lisp/progmodes/markdown-ts-mode.el b/lisp/progmodes/markdown-ts-mode.el

Should this mode live in lisp/textmodes/ instead?  Markdown is AFAIU a
mode for text with markup, it isn't a programming language.

> +(defun markdown-ts-setup ()
> +  "Setup treesit for `markdown-ts-mode'."
> +  (setq-local treesit-font-lock-settings markdown-ts--treesit-settings)
> +  (treesit-major-mode-setup))
> +
> +;;;###autoload
> +(define-derived-mode markdown-ts-mode fundamental-mode "markdown[ts]"
> +  "Major mode for editing Markdown using tree-sitter grammar."
> +  (setq-local font-lock-defaults nil
> +	      treesit-font-lock-feature-list '((delimiter)
> +					       (paragraph)))

I wonder whether this mode should inherit from Text mode instead, and
consequently have some text-related commands, perhaps aided by the
tree-sitter grammar?  WDYT?  We could, of course, add commands later,
but the decision to have Text mode as the parent of this one should be
made now.



  reply	other threads:[~2024-04-20  6:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-20  3:23 [PATCH] feat: add markdown-ts-mode Rahul Martim Juliato
2024-04-20  6:44 ` Eli Zaretskii [this message]
2024-04-20 17:45   ` Jostein Kjønigsen
2024-04-21  5:50     ` Rahul Martim Juliato
2024-04-22  7:02       ` Philip Kaludercic
2024-04-23  1:20         ` Rahul Martim Juliato
2024-04-27 10:18           ` Philip Kaludercic

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=86frvga5zc.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=casouri@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=rahuljuliato@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.