5 ms·
This is compelling! But I ended up abandoning Emacs in previous attempts to switch to it. In case anyone can help solve the pain points I remember: 1. Which pr
by modernerd 4y ago
This is compelling! But I ended up abandoning Emacs in previous attempts to switch to it. In case anyone can help solve the pain points I remember:
1. Which project management tools do you recommend? (I think I was using Projectile in the past, but from what I recall it left buffers from previous projects open when switching to other projects, which ended up being kind of annoying.)
2. Any advice about automatic whitespace/indentation handling with Emacs?
Ideally I want to have Emacs automatically:
- Use a prettier config if present.
- Fall back to editorconfig if present.
- Infer whitespace from the file if no formatting configs are found.
- Match and auto-format indentation when pasting text.
That's pretty much how it works with VS Code. I really struggled to recreate this in Emacs the last time I tried, and as silly as it sounds it ultimately put me off using Emacs. (I work across a lot of repos with different languages and conventions; with Emacs I had to double-check every commit for whitespace issues, but with VS Code I rarely think about it.)
3. How do you handle long-running processes in Emacs? I struggled to find a way to run multiple build processes in the background and quickly switch between/kill/read output/restart them. (Is M-x compile the right approach, or is there something else?)
4. Is libvterm still the best terminal emulator for Emacs? From VS Code/tmux I'm used to being able to summon multiple terminal instances with different tabs/ splits, and the experience in Emacs felt less good last time I tried to recreate this.
- Apollo00 4y ago>Is libvterm still the best terminal emulator for Emacs? From VS Code/tmux I'm used to being able to summon multiple terminal instances with different tabs/ splits, and the experience in Emacs felt less good last time I tried to recreate this. vterm is awesome, I recommend using multi-vterm if you want more than one
- ilovecaching 4y agoWere you trying to make your own config, or use something prerolled like Doom?
- modernerd 4y agoI started with Doom to discover what features were available/useful to me. Then I built my own config from scratch recreating/borrowing only those features. I got pretty close apart from the above sticking points. I only moved on when I realised how much time I was spending writing Emacs Lisp to solve my remaining pain points. I miss it, though!
- arc-in-space 4y agoprojectile does have a command to kill all buffers from the current project that I regularly use fwiw
- irjoe 4y ago> 2. Any advice about automatic whitespace/indentation handling with Emacs? I use prettier-mode and editorconfig-mode. Everything is formatted on save so works well for me.
- ParetoOptimal 4y ago1. project.el and tabspaces 2. I think you'll want to write some elisp for this. I use apheleia though, maybe it does this? 3. async-shell-command or... hmm... there is a emacs binding to a go library for managing async processes I can't recall the name of. 4. vterm is best in the sense of most support for ncurses things. I personally try to use eshell for everything. As far as different tabs/splits emacs should be able to do that. Can you give a specific example of something you had trouble with?
- modernerd 4y agoThanks for these tips! I'll explore tabspaces, apheleia, async-shell-command (and the Go lib) — all of those are new to me. > Can you give a specific example of something you had trouble with? I hoped to recreate multiple long-running terminal sessions in splits and tabs, similar to functionality I now use from: Neovim (plugin): https://github.com/akinsho/toggleterm.nvim https://github.com/akinsho/toggleterm.nvim VS Code (built-in): https://code.visualstudio.com/docs/terminal/basics#_managing-terminals https://code.visualstudio.com/docs/terminal/basics#_managing... I just found “popper”, which didn't exist the last time I looked. It seems like a pretty close substitute: https://github.com/karthink/popper https://github.com/karthink/popper
- ParetoOptimal 4y ago> I hoped to recreate multiple long-running terminal sessions in splits and tabs, similar to functionality I now use from: > Neovim (plugin): https://github.com/akinsho/toggleterm.nvim https://github.com/akinsho/toggleterm.nvim > VS Code (built-in): https://code.visualstudio.com/docs/terminal/basics#_managing https://code.visualstudio.com/docs/terminal/basics#_managing... The example in that vscode link can be replicated in emacs by: 1. having a single buffer open 2. C-x 2 (split-window-below) 3. C-x o (other-buffer) 4. C-x 3 (split-window-right) 5. C-x 3 (split-window-right) 6. C-x + (balance windows) If that seems unwieldy you can also make a macro to automate such a thing or anything your imagination can come up with. Then any function you make (such as saving that macro to a name) can be bound to a keybinding of your choice. If that's interesting to you, also see "Keyboard Macros are Misunderstood": https://www.masteringemacs.org/article/keyboard-macros-are-misunderstood https://www.masteringemacs.org/article/keyboard-macros-are-m... In fact, if you really want to understand Emacs in addition to replicating your current vscode workflow or even to augment your current workflows you should check out his book that was recently updated for Emacs 28: https://www.masteringemacs.org/book#free-sample https://www.masteringemacs.org/book#free-sample He typically updates the book pretty quickly, so you'll get any future updates he may make. I still highly recommend the current version after having ready 5 or 6 chapters recently and feeling like I leveled up my own understanding.
- deleted 4y ago[deleted]
- Kalq 4y ago1.projectile-kill-buffers or the built-in project-kill-buffers will do that for the current project. You could run that before switching projects. 2. https://github.com/radian-software/apheleia https://github.com/radian-software/apheleia 3. There might be a way to do this but I'm not sure. Emacs being inherently single threaded probably makes this difficult. But yes, I use M-x (re)compile. 4. libvterm is the best still imo. You can definitely do multiple instances and there's even different tab modes in Emacs now.
- sping 4y ago> 3. There might be a way to do this but I'm not sure. Emacs being inherently single threaded probably makes this difficult. But yes, I use M-x (re)compile. Emacs has zero issue with multiple compilations - they're handled asynchronously. If threading was an issue it would kill Emacs with just one active compilation let alone many. The lack of threading in Emacs is a significant issue, but simultaneously nowhere near as restrictive and troublesome as many people seem to believe. It's irritating that Emacs inhibits simultaneous compilations by default, but that's literally simply down to buffer naming. Emacs uncompromisingly uses a buffer called "*compilation*" for compiliation and will only run one at a time in a buffer. There are simple hacks floating around to have compilation create a unique buffer name, then it happily runs as many as you like. Also, `projectile` has the setting `projectile-per-project-compilation-buffer` which enables this by putting the project name in the compilation buffer name. I do echo the sentiment that it is not an easy out-of-the-box experience, and the learning curve is steep, though this is the sort of configuration that I assume the likes of doom set up by default. But even then, starting with doom is a much more significant endeavor than starting with VS Code. But once you learn and develop your Emacs set up it becomes a delightful, malleable, and extremely powerful environment that's comfortable like an old leather chair, and where it isn't, you make it just how you want it. Some of us were lucky enough to accumulate proficiency over years and decades starting in a time when there weren't easier options with comparable power. I love to have people join us and appreciate it, but it's not an easy process to get to the payoff.
- modernerd 4y agoThank you for the kind reply and pointers! Apheleia in particular was new to me — I don't think it even existed last time I looked. So good to see the Emacs community continuing to thrive and invent.
- MiyamotoAkira 4y agoFor number 1 I use perspective with projectile. https://github.com/nex3/perspective-el https://github.com/nex3/perspective-el https://github.com/bbatsov/persp-projectile https://github.com/bbatsov/persp-projectile
- m01 4y ago3. Can't you launch your compilation (or similar) and then M-x rename-buffer? EDIT: try `g` for "refresh"/recompile. Maybe that's just me though, not sure this is an official method.
- Syntonicles 4y agoI use projectile and perspective. Everything is integrated into my Ivy/Counsel and I have simple self documenting shortcuts for everything using General keybindings. Until I set this up correctly the leftover buffers bothered me. Now it's part of my workflow. I often have code from two projects side-by-side in split windows. Projectile restricts all of my actions to the appropriate project Autocomplete, code navigation, file search, fuzzy greps, everything uses the buffer's project as context. With just two key presses I can close all buffers for any open project.
- blep_ 4y agoFor 1, also remember that you can just run multiple copies of emacs for different projects. Nobody says you have to use all the packages that ostensibly solve some problem you have.
- NateEag 4y agoFor #2, I've been pretty happy with dtrt-indent (https://github.com/jscheid/dtrt-indent https://github.com/jscheid/dtrt-indent) for DWIM indentation bouncing between projects. I have yet to try apheleia, but I wouldn't be surprised if just enabling apheleia, dtrt-indent, electric-indent-mode (a built-in I don't use, but which may cover your indent-on-paste desire), and editorconfig-mode (https://github.com/editorconfig/editorconfig-emacs https://github.com/editorconfig/editorconfig-emacs) in prog-mode-hook just did what you wanted.
- sph 4y agoI recommend dtrt-indent and ws-butler for your whitespace concerns