reddit / emacs
There and back again... again...
Ronis_BR · 2022-08-12 16:55
Hi!
Yes, this is another post about someone switching editors. I know, there are a lot, but I think those are important because that kind of posts drove my decisions in the past.
I move constantly between editors (Vim => Emacs => Neovim => Emacs => Neovim => Vscode (1 day) => Neovim => ...). The only thing that is nonnegotiable is modal editing.
Last time I switched from Emacs because of the \*\*huge\*\* amount of time it takes to open (no, I do not like emacsclient). IIRC, it was taking 8s to start in my machine. Hence, I migrate to Neovim and Lua.
Neovim is a fantastic project! Lua will bring it to a new level! However, I started to miss a GUI and some polished tools I had in Emacs. All GUIs in Neovim are almost a terminal in a graphical application. It really does not add something new. Furthermore, since Lua integration is relatively new, I often find some rough edges. 99% can be fixed relatively easily. However, I just do not have time anymore to tweak my configuration as I had back in the day.
So, I heard about gccemacs and tried again. WOW! That's a game changer!
After 20 min compiling everything shipped with Doom emacs by default (yes, this is the bad side of the tradeoff), Emacs starts in less than 2s. It is even faster than my Neovim with all plugins. So, if anyone quit Emacs because of performance, give it one more try. Just do not mind the initial compilation time...
Finally, I just want to thanks the amazing job of u/hlissner, Doom Emacs is amazing and you can use it out-of-the-box. Exactly what I need now.
anaumann · 2022-08-12 16:59
If you embraced the emacsclient, editing a file could be as quick as opening a new frame/window ;)
Jokes aside.. a full-blown IDE doesn't boot in 2s either.. so having the option of running the main emacs instance in the background and only opening windows on demand is quite nifty.. Especially when considering than people tend to do more and more in emacs the longer they're using it.
Ronis_BR · 2022-08-12 17:01
Yes, I need to give emacsclient a try. However, last time there were some problems in macOS. I do not know if those are fixed. VSCode takes more than 2s here to open and be functional, so I am happy :D
anaumann · 2022-08-12 17:04
Ah, MacOS :D Ok, I have to admit, I gave up and kept an emacs window open at all times for the six months a former employer forced me to use a macbook, but when it's working as intended, it's great :)
But my MacOS problems were probably just me not being used to any Mac less than 30 years old :D
Ronis_BR · 2022-08-12 17:06
:D yes, Emacs in macOS is not as smooth as it is in Linux. However, the project emacs-mac seems very interesting.
anaumann · 2022-08-12 17:10
By the time I got to installing emacs, I was already frustrated that 99% of "meaningful" settings were to be found in the accessibility preferences :D I felt more broken than I already am :)
timmymayes · 2022-08-12 17:23
For me I use emacs for just about everything when coding so it's just always open. I do my email, task management, writing, editing, file management, have a js repl for interactive testing etc. I really only use a browser and emacs.
Ronis_BR · 2022-08-12 17:30
Nice! I am on the other side: I use Emacs just as an editor. However, I will try to accomplish more tasks using it.
themathiasdahl · 2022-08-12 20:53
If you haven't looked at use-package yet, have a look at some init files that people share on Github that uses it. My Emacs loads in around 2 seconds because of it, and I'm not even using native compilation. I use a fair deal if packages.
[deleted] · 2022-08-12 20:55
[deleted]
CulturMultur · 2022-08-12 21:30
Any guides how to setup js repl in Emacs? I occasionally need to do js development and still using jsfiddle or codeine for those purposes, would love to have it in Emacs.
agentlemanwrote · 2022-08-12 21:35
I strongly recommend trying emacs-plus, installable with brew.
7890yuiop · 2022-08-13 00:24
FYI gccemacs doesn't help with start times -- if your old start time was 8s and your new start time is 2s then something else has changed. I'm glad you've landed in a good place, though.
Hooxen · 2022-08-13 01:00
right a slow emacs is as inconvenient as a slow boot time. if u are rebooting to open a new file each time that’s painful too but there’s no need to. keep it running all the time, with exwm you can even “boot into emacs” and all your woes and worries just melt away
Ronis_BR · 2022-08-13 02:17
Really?! That’s very strange because installing without gccemacs the same setup takes almost 6s to start. What can be happening?
PhantomSeahorse · 2022-08-13 02:29
How does your emacs take 8 seconds to be open??
Ronis_BR · 2022-08-13 02:30
I also want to know :) But it was many many years ago.
7890yuiop · 2022-08-13 02:33
Ok, colour me surprised. That hasn't been my experience at all (nor my understanding of how things work), but I certainly can't nay-say it if that's what's happening for you. You'd need to build the same Emacs version with and without `--with-native-compilation` in order to test properly. I may be misunderstanding something, though.
Ronis_BR · 2022-08-13 03:11
I don’t know :) but it was some years ago
frozenzeta · 2022-08-13 04:43
\> However, I just do not have time anymore to tweak my configuration as I had back in the day.
So damn true! I used to spend so much time tweaking my Emacs configs. It had been working, fine-ish, not perfect, but already built into my muscle memory.
wlrstsk · 2022-08-13 05:36
why would you close it even if you just use it as an editor? that seems like closing your web browser after visiting a site.
emacsclient works well enough that you can have an ide like intellij invoke emacs for editing and then jump back to the ide for refactoring, debugging, etc.
addendum:
i’ve use gui emacs versions on macos (initially aquamacs and now gnu emacs) for 10+ years, and so it’s “just another app” i keep open. if you want to stay in the terminal, that’s really what emacsclient is for.
na85 · 2022-08-13 06:13
I run emacs-mac. It's excellent. I don't byte-compile and I too don't like emacsclient. My emacs starts in single-digit seconds.
It's a shame you like modal editing. We could have been friends.
jimehgeek · 2022-08-13 10:20
When it comes to startup time, the emacs config is actually rather important, and doom-emacs has had a lot of effort put into fast a startup time.
The FAQ was rewritten about a week ago removing most of the details, so here’s a link to it before the rewrite: https://github.com/doomemacs/doomemacs/blob/43ddb109703c25a105c4d2e156f6055ffc58181b/docs/faq.org#how-does-doom-start-up-so-quickly
About 3-4 years ago I stole a bunch of doom-emacs’ startup tricks for my own config and got startup time down from around 7s to about 2s.
deaddyfreddy · 2022-08-13 10:43
>no, I do not like emacsclient
any reasonable grounds?
​
> Emacs starts in less than 2s
Emacs 27.1, no native comp, no doom, no straight, `emacs-init-time` is usually between 1 and 1.5 seconds.
deaddyfreddy · 2022-08-13 10:47
> I use Emacs just as an editor.
writing email is text editing, file names are text, shell commands are text, even IM is texting after all
deaddyfreddy · 2022-08-13 10:55
while upvoted, `use-package` doesn't give you fast loading per se, you have to combine some techniques to achieve that:
* use `:defer t` when possible (actually, for most packages adding major modes it is)
* use `:custom` instead of `setq` in `:config` (to avoid `:config` part, cause it requires a package to load)
* use `:after`, if you want a package to load only after other ones
* while debugging, set `use-package-verbose` to `t` to see which packages slow down your startup
curioushom · 2022-08-13 13:30
Thanks for the `custom` vs `config` clarification!
timmymayes · 2022-08-13 15:21
Ok for a starting point my base javascript setup I got from this blog: [https://www.chadstovern.com/javascript-in-emacs-revisited/](https://www.chadstovern.com/javascript-in-emacs-revisited/)
I've done some modification from there but this gives you some idea of my starting point, also in case my setup code doesn't work its probably because of my rjsx-mode hook if you're not using that.
Also I'm on ubuntu and installed node. I essentially followed the read me on the github:
[https://github.com/redguardtoo/js-comint](https://github.com/redguardtoo/js-comint)
Also I think 'js-send-region-and-go is a custom command so if that isn't working just omit that key binding.
\`\`\`
(require 'js-comint)
(setq inferior-js-program-command "node --interactive")
(setenv "NODE\_NO\_READLINE" "1")
(add-hook 'rjsx-mode-hook 'my-js-comint-keys)
(defun my-js-comint-keys ()
"My Keys for sending to the js-comint repl"
(interactive)
(local-set-key (kbd "C-x C-e") 'js-send-last-sexp)
(local-set-key (kbd"C-c b") 'js-send-buffer)
(local-set-key (kbd"C-c r") 'js-send-region)
(local-set-key (kbd"C-c C-r") 'js-send-region-and-go))
\`\`\`