Closed liuyinz closed 10 months ago
The readme says this:
There are a few similar packages, but none were quite as convenient as I wanted and some do not seem to be maintained.
So I guess, pro over isolate is that it's maintained and simpler. Con is that (AFAIK) it only supports single-character delimiters (could be a dealbreaker depending on your use case).
support for html tag like <> would be fundamental for this kind of package, @mrcnski Any idea to that ?
@liuyinz You might want to look at embrace. But it seems to be based on expand-region, so you'd need to extend that to add delimiters, whereas surround can already mark between arbitrary delimiters like * and `. I could be wrong though.
I use isolate for quite a few months and satisfied with that, just curious.
The important question is, why are there so many packages to do the same thing?! 😂ðŸ˜
I am going to move this issue to a discussion. I don't really want to maintain a list of other packages features over time, but if it is useful we could turn it into a wiki page. I will try to answer the questions and explain why I wrote the package. Hopefully that will help.
It started with looking for a replacement for evil-surround when I switched back from vi keys to native Emacs bindings. I used Emacs for decades, but tried evil mode a few years back. I took the time to really study the mindset, buying vim books, collecting articles, and playing vim golf. I found it to be super efficient most of the time because there were fewer top-level keys. For example, to select a word, paragraph, or function, the top level key is 'v'. The next key is where you choose word, paragraph, function, etc. (text object in vi) and those are the same regardless of which command you chose: select, delete, etc.[^1]
I did a few packages and used embrace the longest. I was looking for:
In the past, you would build up your Emacs file by copying snippets and downloading lisp files
from various blogs and the Emacs wiki. Once package
, and ELPA, and especially MELPA, became
available, Emacs usage seemed to pick up quite a bit. I try to use maintained packages from
MELPA instead nowadays. I think a lot of duplication comes from not being on MELPA.
(For those concerned about duplication, the maintainers of MELPA do watch for duplication and will reject your package if it duplicates existing ones. For example, I had a package that duplicated tab-jump-out, but I didn't realize it. Instead, I ended up taking over as maintainer of tab-jump-out. So that's good.)
It also needs to be maintained. I used to have code that worked for decades, but with the new Emacs development velocity, I'm finding packages need to be updated. With treesitter support ramping up, I'm expecting a lot of work will need to be done in "structure" related packages.[^3] Isolate has been removed from MELPA and it's repo archived, so I wouldn't want to rely on it.
Another reason is it can be hard to find a package that does what you want if you and the author are using different terminology. Coming from evil-surround, I was looking for "surround". That doesn't always lead you to packages with names like "corral" or "siege" or "isolate". The Emacs wiki used to be the place to go, but now that package managers exist, I don't think as many people update it. If you look for surround there, you'll only find https://www.emacswiki.org/emacs/SurroundRegion. I actually found Reddit to be a more robust way to find similar ones.
[^1]: I find the vi keys are super efficient if you spend a lot of time in one mode or the other. When I first switched to evil keys, I was maintaining a lot of old code. I spent a lot of time searching, moving, and studying existing code. When I started a large new project at work, I spent a lot of time writing new code, and switching modes finally became cumbersome.
[^2]: I am interested in supporting tags if requested, though after a while I rarely used it with evil-surround. To keep the single key design, my plan was to use the single letter 't' to indicate tags were requested, then ask for the tag, just like evil-surround.
If someone wants to use surround and wants tag support, please open a new issue for it.
[^3]: I am expecting all modes to eventually be based on treesitter. I've playing with packages like combobulate and tree-edit to get an idea of what is possible. I'd like to use it to more accurately identify matching pairs.
However, to work in comments and strings, it will need to detect its context and fall back to text based commands.
what's pros and cons with https://github.com/casouri/isolate ?