Skip to content

Commit

Permalink
Merge branch 'master' of github.com:renzmann/renzmann.github.io
Browse files Browse the repository at this point in the history
  • Loading branch information
renzmann committed Feb 5, 2023
2 parents ecda502 + 972fa5a commit f6eb95f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 13 deletions.
21 changes: 15 additions & 6 deletions all-posts.org
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,18 @@ machine. If a language's tree-sitter grammar is installed, it will use that
mode. If not, it will use the original major mode. Simple as that!

*** For the impatient: ~treesit-auto.el~
The package I wound up with is available on GitHub as [[https://github.com/renzmann/treesit-auto.el][treesit-auto.el]]. Using
=package-vc-install=, you can get it right away, and just =use-package= or =require=
to load it:
The package I wound up with is available on GitHub and MELPA as [[https://github.com/renzmann/treesit-auto][treesit-auto.el]].
So long as MELPA is on your =package-archives= list like this:

#+begin_src emacs-lisp
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
#+end_src

Then you can use =M-x package-refresh-contents= followed by =M-x package-install
RET treesit-auto=.

If you also like having a local copy of the git repository itself, then
=package-vc-install= is a better fit:

#+begin_example
M-x package-vc-install RET https://github.com/renzmann/treesit-auto.el
Expand All @@ -43,12 +52,12 @@ Then, in your configuration file:
(use-package treesit-auto
:demand t
:config
(treesit-auto-apply-remap))
(global-treesit-auto-mode))
#+end_src

Once I learn how ELPA and MELPA work, I'll try to publish this package there, too.
See the README on GitHub for all the goodies you can put in the =:config= block.

*** How the ~treesit-auto.el~ works
*** Origins of ~treesit-auto.el~
The recommendation in Yuan's article was to use =define-derived-mode= along with
=treesit-ready-p=. In the NEWS (=C-h n=), however, I noticed a new variable
=major-mode-remap-alist=, which at a glance appears suitable for a similar cause.
Expand Down
24 changes: 17 additions & 7 deletions content/posts/emacs-treesit-auto.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
---
title: "Getting Emacs 29 to Automatically Use Tree-sitter Modes"
author: ["Enzmann"]
date: 2023-01-22T00:00:00-05:00
lastmod: 2023-01-23T12:55:27-05:00
lastmod: 2023-01-31T06:26:00-05:00
categories: ["emacs"]
draft: false
weight: 2001
Expand All @@ -24,9 +25,18 @@ mode. If not, it will use the original major mode. Simple as that!

## For the impatient: `treesit-auto.el` {#for-the-impatient-treesit-auto-dot-el}

The package I wound up with is available on GitHub as [treesit-auto.el](https://github.com/renzmann/treesit-auto.el). Using
`package-vc-install`, you can get it right away, and just `use-package` or `require`
to load it:
The package I wound up with is available on GitHub and MELPA as [treesit-auto.el](https://github.com/renzmann/treesit-auto).
So long as MELPA is on your `package-archives` list like this:

```emacs-lisp
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
```

Then you can use `M-x package-refresh-contents` followed by `M-x package-install
RET treesit-auto`.

If you also like having a local copy of the git repository itself, then
`package-vc-install` is a better fit:

```text
M-x package-vc-install RET https://github.com/renzmann/treesit-auto.el
Expand All @@ -38,13 +48,13 @@ Then, in your configuration file:
(use-package treesit-auto
:demand t
:config
(treesit-auto-apply-remap))
(global-treesit-auto-mode))
```

Once I learn how ELPA and MELPA work, I'll try to publish this package there, too.
See the README on GitHub for all the goodies you can put in the `:config` block.


## How the `treesit-auto.el` works {#how-the-treesit-auto-dot-el-works}
## Origins of `treesit-auto.el` {#origins-of-treesit-auto-dot-el}

The recommendation in Yuan's article was to use `define-derived-mode` along with
`treesit-ready-p`. In the NEWS (`C-h n`), however, I noticed a new variable
Expand Down

0 comments on commit f6eb95f

Please sign in to comment.