Making My Emacs Start Faster
wmecole.com
wmecole.com
Launch emacs once ever and use emacsclient for the typical short-duration invoke/shutdown use cases.
#!/bin/sh
emacsclient -t $@ || (emacs --daemon && emacsclient -t $@)
You'll want something like (unless (server-running-p)
(server-start))
in your init file. emacsclient -t --alternative-editor=""
and emacsclient will start the daemon if it hasn't already been started. You can also set the ALTERNATIVE_EDITOR environment variable to "" to achieve the same effect.I have a one-liner shell script called 'em' that just runs 'emacsclient -t $*' so that it can be set as $VISUAL and used by whatever command line tools use that.
https://git.dthompson.us/dotfiles.git/blob/HEAD:/dotfiles/.d...
However, I am bummed by emacsclient's inability to open multiple files from the command line.
And apparently the total lack of a Tab-like experience on Emacs in general. I used to use "vim -p" SO MUCH.
I've also tried evil-tabs, which doesn't work with spacemacs, at all. And eyebrowse doesn't actually use tabs (also it doesn't maintain working directory state when opening a new workspace, fun!)
I dunno, emacs is very much, "Here's a half-implemented solution that pays zero attention to ergonomics. Just... y'know, fix the rest of it so it doesn't totally suck."
And I just don't have the experience to do that yet. Which is why I'm using Spacemacs. Which more or less actually tries to do the ergonomics correctly.
edit: I'm also hoping Cunningham's Law works in my favor here.
Since I'm not very familiar with vim tabs, I'm curious what you get using using vim tabs that you don't get out of emacs buffers?
emacs buffers are (almost exactly) equivalent to vim buffers. vim tabs don't really have an analogue in emacs, but imagine several layouts of (emacs) windows (each window showing a single buffer) you can switch between in a single frame.
Because you never ever start vim in a daemon mode, opening with -p creates a local list of files that you can cycle amongst. Additionally, the top line tells you which file you have open and which files are next and previous in the list of files you cycle through.
I've always just found it rather nice since I tend to jump around between the same handful of files while I'm working and hitting gt two or three times is often faster and more mindless than remembering the keystrokes to invoke helm-projectile-find-file and also the name of the file I want to switch to.
[1] - https://github.com/jwiegley/use-package [2] - https://github.com/jrosdahl/iflipb
emacs --batch --eval '(dump-emacs "em" "/usr/local/bin/emacs")'
This would load everything from your .emacs file into a fresh executable that would then start instantly.Unfortunately, since I've done it last, it seems that this feature has been 'fixed' with emacs now printing that it can only be dumped once. Never had a problem with multiple dumping before.
Like another poster said, there are so many things in Emacs that are half-baked and/or don't play well with other popular extensions. It's really annoying. I wanted to like Emacs, but I'm finding a better experience with Vim.
Edit: As an example of breakages with evil-mode, sometimes evil-mode would end up in a state where pressing 'd' once in normal mode would delete the whole line (which is supposed to be bound to 'dd') and I was unable to access any other combinations with 'd' as a result (e.g. 'd$' to delete to the end of line). It was annoying and happened fairly often, but was not reproducible (as in 'on demand') for me. IIRC, this spanned all buffers and I just had to restart Emacs to fix it.
Coming from Vim I really wanted to like the idea of some fully async editor with Vim ease of navigation and Emacs power packages (org mode, async repl like iPython, etc) so I found the idea of Spacemacs awesome.
But in practice it's just too broken, after almost 2 days where I fully dedicated my time to do something as simple as showing line numbers in a consistent way, showing the Git gutter and showing the syntax checker marks in the gutter and being unable to solve the issue, I just gave up.
Mind you, this is just a small thing that should work right away (and does work right away in Vim), but seems impossible in Emacs because the packages just don't play nicely with each other. Worst, asking for help in Stackoverflow amounts to nothing, seems like the Emacs/Spacemacs just has their config and they don't want to touch it afraid to break it. The open bugs in Github for many of the troubles in Space are just mostly closed without an answer (really, for instance getting the theme colors to actually work in a terminal in OSX is a nightmare and nobody cares about it and the devs just close the bugs without solution).
Still, I'm still thinking about giving one last effort of just ditching Spacemacs and try to config Emacs from origin with evil mode and build from there, let's see.
BRIGHT SIDE: The philosophy being Spacemacs is really nice tough. I've been changing my Vim config to use a consistent approach to the <LEADER> keybindings and it's really productive and intuitive.
I just which there was some package that allowed to see the available keybindings in a small window at the bottom in Vim like you do in Spacemacs. That would be absolutely great.
Here's to wishing for a better sort of programmers environment...
https://www.reddit.com/r/emacs/comments/3kqt6e/2_easy_little...
Spacemacs recommends[0] using `emacs-mac-port` via homebrew on OSX, but warns of the "strange"[1] emacs server behavior:
""" Note that the emacs-mac-port server behaves differently than the regular Emacs server. Details can be found on the emacs-mac-port README[1]. """
Has anyone taken the time to figure out a workaround to make this work in the traditional emacs manner?
[0] https://github.com/syl20bnr/spacemacs#os-x [1] https://github.com/railwaycat/emacs-mac-port/blob/master/REA...
It was slow to load back then on an early 90s HP/UX workstation. And it's slow to load now on a modern quad core i7 machine with 16 gigs of RAM and an SSD drive.
How this can be baffles me. I don't know what they're doing wrong, but it continues to grow and grow.
Depends on what part of your "development system" you're talking about. If your test suite takes a minute to load before it will even execute a single test, I'd argue that you might want to see what can be done about it.