Getting Emacs 29 to Automatically Use Tree-sitter Modes · robbmann

This page summarizes the projects mentioned and recommended in the original post on /r/emacs

InfluxDB - Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
www.influxdata.com
featured
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
  • treesit-auto

    Automatic installation, usage, and fallback for tree-sitter major modes in Emacs 29

  • /u/casouri posted an article recently about getting started with tree-sitter. Unfortunately, it mentioned that automatic switching between those tree-sitter modes and the default modes (e.g. between python-mode and python-ts-mode won't be coming just yet, but there was a suggested workaround. I took a slightly different approach from what was outlined, and wound up with treesit-auto.el, which is customizable, and I think hits all the intended behavior.

  • tree-sitter-module

    Building script for tree-sitter language definitions

  • ;; FIRST: git clone https://github.com/casouri/tree-sitter-module ;; bash batch.sh ;; THEN : sudo cp dist/* /usr/local/lib ;; FINALLY: (setq treesit-extra-load-path '("/usr/local/lib")) ;; Treesit ;; Eglot (setq treesit-eglot-modes '((:ts (bash-mode . bash-ts-mode) :pacman "bash-language-server") (:ts (c++-mode . c++-ts-mode) :pacman "ccls") (:ts (c-mode . c-ts-mode) :pacman "ccls") (:ts (cpp-mode . cpp-ts-mode) :pacman "ccls") (:ts (c-sharp-mode . sharp-ts-mode)) (:ts (cmake-mode . cmake-ts-mode)) (:ts (css-mode . css-ts-mode) :pacman "vscode-css-languageserver") (:ts (dockerfile-mode . dockerfile-ts-mode)) (:ts (elixir-mode . elixir-ts-mode)) (:ts (glsl-mode . glsl-ts-mode)) (:ts (go-mode . go-ts-mode) :pacman "gopls") (:ts (heex-mode . heex-ts-mode)) (:ts (html-mode . html-ts-mode) :pacman "vscode-html-languageserver") (:ts (java-mode . java-ts-mode)) (:ts (javascript-mode . js-ts-mode) :pacman "typescript-language-server") (:ts (js-json-mode . json-ts-mode) :pacman "vscode-json-languageserver") (:ts (julia-mode . julia-ts-mode)) (:ts (make-mode . make-ts-mode)) (:ts (markdown-mode . markdown-ts-mode)) (:ts (python-mode . python-ts-mode) :pacman "jedi-language-server") (:ts (typescript-mode . typescript-ts-mode) :pacman "typescript-language-server") (:ts (proto-mode . proto-ts-mode)) (:ts (ruby-mode . ruby-ts-mode)) (:ts (rust-mode . rust-ts-mode) :pacman "rust-analyzer") (:ts (sql-mode . sql-ts-mode)) (:ts (toml-mode . toml-ts-mode)) (:ts (tsx-mode . tsx-ts-mode)) (:ts (verilog-mode . verilog-ts-mode)) (:ts (vhdl-mode . vhdl-ts-mode)) (:ts (wgsl-mode . wgsl-ts-mode)) (:ts (yaml-mode . yaml-ts-mode) :pacman "yaml-language-server"))) ;; Not mature yet: ;; (push '(org-mode . org-ts-mode) major-mode-remap-alist) ;; (push '(perl-mode . perl-ts-mode) major-mode-remap-alist) ;; cpan Perl::LanguageServer (require 'treesit) ;; Function to parse the above and make an install command (if (treesit-available-p) (let ((pacman-install-list (list ))) (dolist (ts-pm treesit-eglot-modes) (let ((majmode-remap (plist-get ts-pm :ts)) (pacman-cmd (plist-get ts-pm :pacman))) ;; bind default major-mode to ts-mode (push majmode-remap major-mode-remap-alist) ;; populate install cmd (if pacman-cmd (unless (member pacman-cmd pacman-install-list) (push pacman-cmd pacman-install-list))))) (let ((install-cmd (concat "pacman -S --needed " (--reduce (concat acc " " it) pacman-install-list)))) (message install-cmd))) (user-error "Treesitter not available"))

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • Mastering JSX Editing in Emacs with Tree-sitter

    1 project | dev.to | 15 May 2024
  • MySQL or Top Alternatives in 2024 and How to Choose One

    4 projects | dev.to | 15 May 2024
  • SSD death, tricky read-only filesystems, and systemd magic?

    1 project | news.ycombinator.com | 15 May 2024
  • A Linux guy buys a MacBook Pro

    1 project | news.ycombinator.com | 15 May 2024
  • Show HN: Smart website search powered by open models

    1 project | news.ycombinator.com | 15 May 2024