News for hackers. Stuff that matters.
Re:Emacs: Mastering Eshell by gorjusborg on Wednesday August 17, 2022 @04:18PM (#32501185)
I'm a long-time vim user, but I like to program the parens-y languages, so tried my hand at emacs a while back.

Somehow, over decades, I had never heard about this cross-platform shell built into emacs. There doesn't seem to be much fanfare about it (at least from an outsider's perspective), but having a consistent shell available on any platform emacs runs on is really cool.

Re:Emacs: Mastering Eshell by mftb on Wednesday August 17, 2022 @05:44PM (#32502106)
I'm also a a long time vi user. I can't say why you hadn't heard about Eshell. I can say that Emacs has several such shell/terminal things most with different approaches.

My own most recent experience was I did a weekend experiment to switch over to Emacs. I've been trying to find more and more reasons to write various flavors of Lisp. My experiment was going well until I got to this part of Emacs. I realized a lot of my existing workflows depend on at some point bringing text into the editor, composing more text and sending it to the shell. From a programming perspective the different approaches I tried in Emacs (Eshell, dired and at least two more) seemed really cool, but the performance was unacceptable. I was left with blank screens, flashing cursors and scraps of text.

Does someone know is there one of the Emacs approaches to interacting with a shell or performing shell-like activities, that has dramatically better/native-like performance?

Re:Emacs: Mastering Eshell by chriswarbo on Wednesday August 17, 2022 @07:01PM (#32502902)
One major problem is Emacs's poor performance when lines get really long (e.g. 1 MB). That's rarely a problem when using Emacs as a text editor, but it can happen quite a lot when running shells.

I've managed to avoid this by setting my shell to a script which pipes bash through GNU fold, so long lines are broken up before Emacs ever sees them (around 1000 characters; slightly earlier if there's whitespace). Rather extreme, but I really like shell-mode (not really a fan of eshell)

Re:Emacs: Mastering Eshell by mark_h on Wednesday August 17, 2022 @07:32PM (#32503199)
There was a recent (a couple of weeks ago) commit that claims to rectify the long lines performance issue, for what it's worth.
Re:Emacs: Mastering Eshell by jhoechtl on Thursday August 18, 2022 @02:07AM (#32505887)
That is really interesting. May you take the effort and identify the commit?

EDIT: Nevermind, search to the rescue

This might be the discussion: https://lists.gnu.org/archive/html/emacs-devel/2022-08/msg00...

These might be the commits: https://git.savannah.gnu.org/cgit/emacs.git/commit/etc/NEWS?...

https://git.savannah.gnu.org/cgit/emacs.git/commit/etc/NEWS?...

Re:Emacs: Mastering Eshell by mark_h on Thursday August 18, 2022 @03:29AM (#32506426)
Re:Emacs: Mastering Eshell by jhoechtl on Thursday August 18, 2022 @05:45AM (#32507303)
Just tried it out. For my personal workflow when working on overlong lines, the performance gain is HUGE! From unusable to actually decent. Not using find-file-literally and even syntax highlighting enabled.
Re:Emacs: Mastering Eshell by mark_h on Thursday August 18, 2022 @06:38AM (#32507635)
That's great to hear, thanks! I haven't tested it in anger yet, and I'm not going to pretend to understand the display-code changes.
Re:Emacs: Mastering Eshell by sceadu on Thursday August 18, 2022 @09:26AM (#32509246)
FYI newer versions of emacs are supposed to handle long lines better
Re:Emacs: Mastering Eshell by hsbauauvhabzb on Wednesday August 17, 2022 @07:21PM (#32503098)
Thanks, I’ve faced this issue but didn’t know about gnu fold.
Re:Emacs: Mastering Eshell by chriswarbo on Wednesday August 17, 2022 @08:36PM (#32503733)
Be aware that bash doesn't like being piped, and changes some of its behaviour. I work around that using expect:

- Here's the script itself https://github.com/Warbo/warbo-utilities/blob/master/raw/wra...

- Here's the accompanying expect file https://github.com/Warbo/warbo-utilities/blob/master/raw/wra...

- Here's my patched version of GNU fold, which removes some buffering https://github.com/Warbo/warbo-utilities/blob/master/raw/fol...

- Here's the resulting Nix package (along with some tests) https://github.com/Warbo/warbo-utilities/blob/master/scripts...

Re:Emacs: Mastering Eshell by comfypotato on Thursday August 18, 2022 @05:25AM (#32507183)
emacs-libvterm is bundled in Doom I think. This is how (I think) I ended up hearing about it from a friend (I don't actually use Doom). It's great. It has a very intuitive resolution to the issue of processing emacs keystrokes vs. terminal input, and it has a "copy-mode" that lets you grab output from the terminal.
Re:Emacs: Mastering Eshell by sc4les on Wednesday August 17, 2022 @05:50PM (#32502176)
vterm
Re:Emacs: Mastering Eshell by agency on Wednesday August 17, 2022 @10:19PM (#32504450)
Tangential, but I've been playing around with Clojure lately. I thought my days of actually-using-vim were behind me as I just use the vim plugin in VS Code for my day job but I found that the most mature Clojure VS Code plugin (Calva) doesn't work great with vim keybindings so I decided to see how neovim had progressed (hadn't looked at it in a few years).

I ended up getting setup really easily with Conjure[1]. It's a neovim plugin written in Fennel[2], a Lisp dialect that compiles to Lua. I'm writing my whole neovim configuration in lisp. It sounds like the setup to some emacs vs vim joke but it's actually pretty cool!

[1] https://github.com/Olical/conjure

[2] https://fennel-lang.org/

Re:Emacs: Mastering Eshell by lf-non on Wednesday August 17, 2022 @04:56PM (#32501618)
Yes, I moved the other way and have been using vim for last two years or so. Eshell is the only main thing I still miss from emacs despite not being a lisper.

I have found it quite hard to explain others what exactly is great about eshell, because most people instinctively equate it with embedded terminals found in vscode etc. But it is really nice to have a shell where you can do most of the things you could in bash/zsh and also have complete programmatic access to the editor environment.

Re:Emacs: Mastering Eshell by buscoquadnary on Wednesday August 17, 2022 @06:13PM (#32502381)
Check out Doom Emacs, I was a long term vimmer then picked up Doom and it converted me pretty quickly over to an Emacs guy now.
Re:Emacs: Mastering Eshell by mistahchris on Wednesday August 17, 2022 @08:04PM (#32503483)
Same for me. I've been using emacs now for several years after being a long time vim user. I have never missed vim after switching. Emacs is amazingly powerful. And I never got to a point where Doom felt limiting. I only ever need to make minor customization on top of Doom's packages and it's super easy and I actually like elisp _way_ better than vimscript.

Anyways I don't really care for text editor wars or whatever. I just wanted to second this person's experience with vim -> emacs via Doom Emacs.

Re:Emacs: Mastering Eshell by VTimofeenko on Wednesday August 17, 2022 @08:09PM (#32503519)
I'm in the same boat, made the switch for the org-mode ~month ago. Doom is amazing, and most of my custom config was not necessary, the default modules are super sane.

I do miss nvim's configuration in lua though.

Re:Emacs: Mastering Eshell by mcbuilder on Thursday August 18, 2022 @12:52AM (#32505448)
Doom Emacs convert of about 4 years here, and Evil mode user for about 6 and I summarize my thoughts with: vim is the best text editor, it just happens that the best implementation is inside Emacs.
Re:Emacs: Mastering Eshell by alfiedotwtf on Thursday August 18, 2022 @01:01AM (#32505509)
> There doesn't seem to be much fanfare about it

I think there's two sides. The people who aren't familiar with Emacs will ask why should I care about this, and the people who are familiar with Emacs will most likely already know of the power that Emacs can bring and when faced with eshell for the first time just think "of course Emacs can do that, it's Emacs after all"

Re:Emacs: Mastering Eshell by dotancohen on Wednesday August 17, 2022 @04:55PM (#32501596)
Have you seen the new VIM shell in 8.1?
Re:Emacs: Mastering Eshell by ngcc_hk on Thursday August 18, 2022 @06:02AM (#32507409)
Found it hard. Instead just gvim or macvim with vim lisp adoption.