unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Yuan Fu <casouri@gmail.com>
To: emacs-devel <emacs-devel@gnu.org>
Subject: [ELPA] Proposing to add express to ELPA
Date: Mon, 31 Jul 2023 11:38:27 -0700	[thread overview]
Message-ID: <0C0218D1-6C00-4E5A-9E6E-6282F170126A@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1757 bytes --]

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 #2: expreg.patch --]
[-- Type: application/octet-stream, Size: 813 bytes --]

From 7e201deb71f324e22d31331c06cf3999a105668b Mon Sep 17 00:00:00 2001
From: Yuan Fu <casouri@gmail.com>
Date: Mon, 31 Jul 2023 11:14:04 -0700
Subject: [PATCH] * elpa-packages (expreg): New package.

---
 elpa-packages | 1 +
 1 file changed, 1 insertion(+)

diff --git a/elpa-packages b/elpa-packages
index 48a0ada..e1470d5 100644
--- a/elpa-packages
+++ b/elpa-packages
@@ -292,6 +292,7 @@
   :doc "doc/ess.texi")
  (excorporate		:url nil)
  (expand-region		:url "https://github.com/magnars/expand-region.el")
+ (expreg                :url "https://github.com/casouri/expreg.git")
  (external-completion   :core "lisp/external-completion.el")
  (exwm			:url "https://github.com/ch11ng/exwm.git")
  (f90-interface-browser :url nil) ;; Was "https://github.com/wence-/f90-iface"
-- 
2.33.1


             reply	other threads:[~2023-07-31 18:38 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-31 18:38 Yuan Fu [this message]
2023-08-01  8:07 ` [ELPA] Proposing to add express to ELPA Philip Kaludercic
2023-08-01 19:09   ` Yuan Fu
2023-08-11 17:14 ` Yuan Fu
2023-08-11 18:10   ` Emanuel Berg
2023-08-11 18:14   ` Philip Kaludercic
2023-08-19  5:09   ` Yuan Fu
2023-08-19  9:04     ` Philip Kaludercic
2023-08-20 17:07       ` Yuan Fu
2023-08-21  1:10     ` Richard Stallman
2023-08-21  4:08       ` Yuan Fu
2023-08-21  9:04         ` Tassilo Horn
2023-08-21  9:23           ` Tassilo Horn
2023-08-22  1:38           ` Yuan Fu
2023-08-22  9:56             ` Tassilo Horn
2023-08-28  7:23               ` Yuan Fu
2023-08-28  7:26                 ` Tassilo Horn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0C0218D1-6C00-4E5A-9E6E-6282F170126A@gmail.com \
    --to=casouri@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).