From: Eshel Yaron Date: Thu, 20 Feb 2025 20:57:25 +0000 (+0100) Subject: * lisp/textmodes/markdown-ts-mode.el: Cleanup. X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=52905cce5040b9cdaf585fdd0e7586f4a7a60251;p=emacs.git * lisp/textmodes/markdown-ts-mode.el: Cleanup. --- diff --git a/lisp/textmodes/markdown-ts-mode.el b/lisp/textmodes/markdown-ts-mode.el index 62fa23c7105..78402e3c0cb 100644 --- a/lisp/textmodes/markdown-ts-mode.el +++ b/lisp/textmodes/markdown-ts-mode.el @@ -1,4 +1,4 @@ -;;; markdown-ts-mode.el --- tree sitter support for Markdown -*- lexical-binding: t; -*- +;;; markdown-ts-mode.el --- major mode for Markdown -*- lexical-binding: t; -*- ;; Copyright (C) 2024-2025 Free Software Foundation, Inc. @@ -41,7 +41,6 @@ :feature 'delimiter '([ "[" "]" "(" ")" ] @shadow) - :language 'markdown :feature 'paragraph '([((setext_heading) @font-lock-keyword-face) @@ -73,18 +72,17 @@ (defun markdown-ts-imenu-node-p (node) "Check if NODE is a valid entry to imenu." - (equal (treesit-node-type (treesit-node-parent node)) - "atx_heading")) + (equal (treesit-node-type (treesit-node-parent node)) "atx_heading")) (defun markdown-ts-imenu-name-function (node) "Return an imenu entry if NODE is a valid header." (let ((name (treesit-node-text node))) (if (markdown-ts-imenu-node-p node) - (thread-first (treesit-node-parent node)(treesit-node-text)) + (treesit-node-text (treesit-node-parent node)) name))) (defun markdown-ts-setup () - "Setup treesit for `markdown-ts-mode'." + "Setup tree-sitter for `markdown-ts-mode'." (setq-local treesit-font-lock-settings markdown-ts--treesit-settings) (treesit-major-mode-setup)) @@ -92,12 +90,13 @@ (define-derived-mode markdown-ts-mode text-mode "Markdown" "Major mode for editing Markdown using tree-sitter grammar." (setq-local font-lock-defaults nil - treesit-font-lock-feature-list '((delimiter) - (paragraph) - (paragraph-inline))) + treesit-font-lock-feature-list '((delimiter) + (paragraph) + (paragraph-inline))) (setq-local treesit-simple-imenu-settings - `(("Headings" markdown-ts-imenu-node-p nil markdown-ts-imenu-name-function))) + `(("Headings" + markdown-ts-imenu-node-p nil markdown-ts-imenu-name-function))) (when (treesit-ready-p 'markdown) (treesit-parser-create 'markdown-inline) @@ -106,8 +105,5 @@ (derived-mode-add-parents 'markdown-ts-mode '(markdown-mode)) -(if (treesit-ready-p 'markdown) - (add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-ts-mode))) - (provide 'markdown-ts-mode) ;;; markdown-ts-mode.el ends here