From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] feat: add markdown-ts-mode Date: Sat, 27 Apr 2024 10:18:37 +0000 Message-ID: <87frv7qfb6.fsf@posteo.net> References: <877cgs7m4e.fsf@gmail.com> <86frvga5zc.fsf@gnu.org> <87edazgt7v.fsf@gmail.com> <87h6ftvpzz.fsf@posteo.net> <87plugzxgx.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4910"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , Jostein =?utf-8?Q?Kj=C3=B8nigsen?= , Yuan Fu , "Ergus via Emacs development discussions." To: Rahul Martim Juliato Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Apr 27 12:19:50 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1s0f9p-00017w-Q6 for ged-emacs-devel@m.gmane-mx.org; Sat, 27 Apr 2024 12:19:50 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s0f8n-0002IX-KI; Sat, 27 Apr 2024 06:18:45 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s0f8l-0002IL-Uu for emacs-devel@gnu.org; Sat, 27 Apr 2024 06:18:43 -0400 Original-Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s0f8j-0005tr-JB for emacs-devel@gnu.org; Sat, 27 Apr 2024 06:18:43 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 445B3240029 for ; Sat, 27 Apr 2024 12:18:39 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1714213119; bh=Qi+7PwXvS87CZrF6T2ZRTa1w7k7j2/hnvo/JvEz5hNE=; h=From:To:Cc:Subject:OpenPGP:Date:Message-ID:MIME-Version: Content-Type:From; b=pIpg4FbH6FlY0W0yiQ0se+mQNPK6HeWX6KSgNpP+H+XL5t1VsKO3lrgo3h74qksg1 JaLQc53HQzztrHWtRljYa7eP/fh/xqqSnezPjbFpNNLP3UM7J/UStjsI8nP0+Zs5bU 8khn70O9LFCvQYwfqBW8UezvFTwHt6u1ohl6ZGOyC7On14zN97Kbxdo+DMu/ReTrEd J26Q6eYppHGAuJg8Soah+h8hLnTZydf+bHMDoFopM2GHamWoMP64lB/8f6Kjao7wwQ KmWKMTJT7GoPmS2WKk9n4MjNoG4bOOACFcpQzIbysoY2ws+md5WjIvyZQ2JYZi5EqK XvwiV2wmt61hg== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4VRQXt1Xg8z9rxD; Sat, 27 Apr 2024 12:18:38 +0200 (CEST) In-Reply-To: <87plugzxgx.fsf@gmail.com> (Rahul Martim Juliato's message of "Mon, 22 Apr 2024 22:20:14 -0300") OpenPGP: id=7126E1DE2F0CE35C770BED01F2C3CC513DB89F66; url="https://keys.openpgp.org/vks/v1/by-fingerprint/7126E1DE2F0CE35C770BED01F2C3CC513DB89F66"; preference=signencrypt Received-SPF: pass client-ip=185.67.36.65; envelope-from=philipk@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:318185 Archived-At: Rahul Martim Juliato writes: >> So if I understand correctly, there is no keymap or any convenience >> features that markdown-mode provides, because this is just the >> beginning, right? A large part of major modes for me is not just the >> syntax highlighting and integration into Emacs systems, but also >> bindings that in the case of Markdown would insert links or add/remove >> emphasis. I think it would be nice, if we could add these features in >> the future, and re-use bindings from a package like AucTeX to build on >> existing intuition (org-mode would be an alternative, but I am not a fan >> or their choice of bindings). Some commands to "compile" and preview a >> document would also be nice. > > > Hello there again! > > Please find attached the current version of this patch. > > It now works with the "official" tree-sitter grammar for markdown: > https://github.com/tree-sitter-grammars/tree-sitter-markdown > > Please note (as explained above) the `main branch' is not the default > anymore, but `split_parser' is. > > They splitted the parser into two, one for the body of the document and > another to inline. > > So, in order to test this patch, configure it with: > > (use-package markdown-ts-mode > :ensure nil > :defer t > :mode ("\\.md\\'" . markdown-ts-mode) > :config > (add-to-list 'treesit-language-source-alist '(markdown > "https://github.com/tree-sitter-grammars/tree-sitter-markdown" > "split_parser" "tree-sitter-markdown/src")) > (add-to-list 'treesit-language-source-alist '(markdown-inline > "https://github.com/tree-sitter-grammars/tree-sitter-markdown" > "split_parser" "tree-sitter-markdown-inline/src"))) I have said this before, and will say it again, `treesit-language-source-alist' shouldn't clone moving git repositories but download tarballs (which basically every git host provides as a feature, since git archive is built-in) and use those to build the library. These tarballs should be pinned in the -ts-mode.el files themselves to make using these major modes more reliable. > If you visit a markdown file treesit issues an error, as always, asking > for the grammars. > > Then, install BOTH grammars: > > M-x treesit-install-language-grammar RET markdown RET > M-x treesit-install-language-grammar RET markdown-inline RET > > Reload the `markdown-ts-mode'. > > And everything should be working fine :) > > > @Philip, thanks for bringing that up! I completely agree with you; > aiming for a fully-featured mode is our long-term objective. > > The idea here is to establish a foundation for supporting markdown files > within Emacs, without relying on external packages. That sounds good. > From there, we can delve into discussions about editing and exporting > features. For instance, we could consider mimicking bindings and prompts > from org-mode, as well as exploring integrations if users opt to also > utilize third-party markdown-mode. I would be interested in helping out or at the very least to comment on the development going on, since I had started writing the same mode myself a while back, but never got around to it since because I don't understand how `treesit-font-lock-rules' works. > However, simply having the mode built-in reduces friction significantly > for new ideas and collaborations :) And makes it easier for external packages to rely on the code. Usually I'd also say that it makes Emacs more usable in offline environments, but the fact that the tree-sitter grammars have to for now be downloaded stands in the way of that :/ -- Philip Kaludercic on peregrine