emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ELPA] Proposing to add express to ELPA


From: Yuan Fu
Subject: [ELPA] Proposing to add express to ELPA
Date: Mon, 31 Jul 2023 11:38:27 -0700

Hi all,

Since Emacs 29 is now released, I’d like to propose adding expreg to ELPA. 
Expreg can be considered a lite version of expand-region. The notable 
difference is its use of tree-sitter for language-specific expansions. I also 
took the liberty to do things differently than expand-region, eg, expreg uses a 
smaller number of expanders [1]; it is easier to debug when the expansion isn’t 
what you expected; and it only provides two functions for expansion and 
contraction, and one variable for adding/removing expanders—no transient maps 
and other “smart” features, nor different variables to set for each major mode.

The obvious downsides is that, of course, it’s pretty useless on anything other 
than lisp if you don’t have tree-sitter grammars and major mode installed. You 
can use it in a non-tree-sitter major mode, as long the tree-sitter grammar 
exists. You only need to create a parser and expreg will automatically use the 
parser [2].

I’ve been using it for months and ironed out all sorts of edge-cases, and can 
recommend it for daily usage.

You can find the repository here: https://github.com/casouri/expreg
And I attached a patch for ELPA. It’s been awhile since I last made a patch for 
ELPA, I hope I did it right.

[1] Default expanders include: expreg--subword expreg--word expreg--list 
expreg--string expreg--treesit expreg--comment expreg--paragraph

[2] Something like (add-hook 'xxx-mode-hook (lambda () (treesit-parser-create 
'xxx)))

PS. I find it amusing that, among the total 632 LOC, only 17 are responsible 
for the tree-sitter support, the main purpose of this package; all the rest are 
code dealing with correctly expanding lists, strings and comments with 
syntax-ppss.

Thanks,
Yuan

Attachment: expreg.patch
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]