reddit / emacs
Starting fresh?
broken_symlink · 2022-04-21 13:51
I've been using my emacs setup for almost 7 years now and I feel like its time to start fresh. Theres a lot of cruft in there and some of the packages dont even work currently anymore, because they are no longer actively developed, things like irony, rtags, and elpy. I can also remove a lot of packages from my setup because I no longer need them. I've used helm this whole time, but I think maybe its time to give ivy a try and also switch to lsp.
Anyone else just start fresh after using their setup for a long time?
theMachine0094 · 2022-04-21 13:57
My setup wasn't quite that old. It was 2 years old when I decided to overhaul it. But I handled it like a rewrite rather than deleting everything and starting over.
orzechod · 2022-04-21 14:37
I'd be surprised if many of us here _hadn't_ declared emacs bankruptcy at some point or another.
MarcusE1W · 2022-04-21 14:41
Maybe not for the experts, but otherwise a good tool to start an emacs configuration
https://emacs.amodernist.com/
pathemata · 2022-04-21 15:30
I started fresh a coupled years ago.
Things that helped:
1. Everything in its `use-package`. If I don't use anymore, just disabled. Eventually, delete it.
2. Keep things independent with `:after`, if I disable one package it should not impact others.
2. Everything is deferred by hooks, bindings, or commands. Therefore, adding a package should not impact on initial load time.
akirakom · 2022-04-21 15:40
Recently I have started fresh and imported some useful functions from my previous config. It was four years old. It was not that old, but I wanted to change how I organize my configuration and wanted to reduce the total amount of configuration.
Ivy is not the latest trend in completion, even though it is still quite powerful. Nowadays people use consult, embark, marginalia, etc. which are modular packages for completion. I sometimes miss helm, but the point of the latest packages is reusability. Especially with embark, you can reduce your configuration for alternative actions.
IterativeSieve · 2022-04-21 16:07
Absolutely. I highly recommend you try a literate config this time around, it can really cut down on the "why the hell did I do this" factor 4 or 5 years down the road.
deaddyfreddy · 2022-04-21 16:14
> Anyone else just start fresh after using their setup for a long time?
Not from scratch, but I did a pretty large rewrite several years ago, moving from my own NIH init system to `use-package`. Other than that, I've been mostly adding/removing `use-package` sections over time
Horrih · 2022-04-21 16:35
I did the same a few months back
A good exercice as mentioned
- organize your config in sections, with the built in outline mode for example to have foldable sections and subsections. It's simple : asection starts with a ;;; comment, a subsection with ;;;; 1nd so on.
Or a fully literate config with org if you are into that sort of things
- use package everywhere : 90% of packages on lazy loading, :custom instead of setq, etc
- document every single line of your config. It will help you realize what you want to keep and what's useless
jcastp · 2022-04-21 18:05
Yes, I did that. Twice.
I had an old config mess, literate config in org mode, made by copying, pasting and blindly changing things in the snippets, until I had something working. At that time I did not know too much about how emacs worked, so blame my ignorance for it.
First time I declared bankrupcy, I tried Doom emacs. Shinny, good looking, very well maintained, extensible ... but so many intertwined wheels for me and, although you can look under the hood, I felt like I was not in control (kind of stupid thought, if you think about it, but ...).
So I started again. Now I use the same literate config in org mode, quelpa and quelpa-use-package, but mainly, I have put some effort to try to understand how emacs works, the "magic" behind those packages and what I add in my new config.
Anyway, from time to time, I assess the config and get rid what I don't use anymore, and incorporate other packages that I think could be interesting (spoiler: usually, I end purging them eventually).
MangyCanine · 2022-04-21 18:09
No, but I periodically edit and maintain it. New stuff gets added, unused old stuff gets deleted.
Bankruptcy is for people who don’t do maintenance (or for those who switch to something completely different, like spacemacs, or for those who don’t know emacs-lisp).
northstar90210 · 2022-04-21 18:10
I just restarted using [Emacs Onboard](https://github.com/monkeyjunglejuice/emacs.onboard.git) as a template. It's claim to fame is that it does not load in additional packages. In this way like better-defaults, but much more coverage. I'm a long time helm user who is tempted by ivy, but why not try icomplete-mode, which is built in? I really enjoy (fido-vertical-mode 1).
However I do have a version of my init file which uses straight.el to load in environments as I need them. Then, I use one emacs session for gnus, another for irc, another for Project A, etc.
Perhaps the biggest game changer in my new init file is [chemacs2](https://github.com/plexus/chemacs2.git). This allows one to choose one among many possible ".emacs.d" directories to use for the emacs that is being invoked.
char1zard4 · 2022-04-21 18:13
I did a similar thing a couple weeks ago, after using emacs for 3-4 years, I found that cleaning up my .emacs and reassessing all the installed packages was enough for me, made me realize I should probably make some new useful global keybindings and start using use-package
wolfjb · 2022-04-21 19:15
I started fresh not that long ago. Rewrote everything in my configuration, no `use-package` for me, but I did `macroexpand` a bit of that configuration to learn how it worked and then use that knowledge to my advantage. Overall a good experience. Now I am one of the maintainers for Rational Emacs which has the goal of being a good starting point for writing your own config. You can find it on github (https://github.com/SystemCrafters/rational-emacs) if you are interested in seeing our approach.
jumpUpHigh · 2022-04-21 19:23
very nice points.
BlaFasl_sagIchdoch · 2022-04-21 19:31
package-install paradox
paradox-update-packages
samsjj · 2022-04-21 19:39
I recently moved from 24.5 to 27.2 and i am in the process of rewriting from scratch.
I started with use-package and trying out some new packages like diff-hl, magit.
planning to move from flx-ido/smex to selectrum,consult,marginalia.
following changes improved my load time as well.
1) removed (package-initialize) from init.el as its already called in 27.2 automatically.
created a new file \~/.emacs.d/early-init.el and moved the following there from init.el.
this reduced around 0.4 secs in load time.
(push '(tool-bar-lines . 0) default-frame-alist) ; hide toolbar
(push '(vertical-scroll-bars) default-frame-alist) ; hide scrollbar
(push '(menu-bar-lines . 0) default-frame-alist) ; hide menubar
(add-to-list 'default-frame-alist '(font . "Courier 10 Pitch")) ; set font
(add-to-list 'default-frame-alist '(fullscreen . maximized)) ; start every frame maximized.
trying to see if emacs --daemon mode works for my use cases.
xtifr · 2022-04-21 20:17
Yes, after around the same amount of time. My init file was full of things I didn't need any more or never really ended up using, "convenience" functions that weren't actually all that convenient, settings I didn't remember what they were supposed to do, and a lot of poorly written elisp. So I decided to scrap it all, go as vanilla as possible, start using customize wherever possible, and, in general, stop tweaking things just for the sake of tweaking them, and start focusing more on what I actually *used!*
I don't regret the time spent in experimental mode at all. It was both entertaining and educational. But at some point, I just realized I was ready to move past playground mode and focus on Emacs as more of an actual *tool!* I still mess around with elisp to have fun--I've written a couple of incomplete and not very good games, for example--but my main config has remained relatively small and simple for many years now.
NoisyFrequency · 2022-04-21 21:05
You can read my dotemacs [here if you'd like](https://gitlab.com/nathanfurnal/dotemacs) I have isolated the packages with `use-package` deferred to when they're needed, added a couple useful functions, etc.
I also have a setup for most programming language I use or like to play with.
driden87 · 2022-04-21 21:15
This is also good for, a newb. It is a good list of packages I should be taking a look at. Thanks for the link
github-alphapapa · 2022-04-21 21:18
Sure, but you don't have to throw away your old, comfortable, known-good config to try a new one. Use [with-emacs.sh](https://github.com/alphapapa/with-emacs.sh) to run as many Emacs configs as you like.
github-alphapapa · 2022-04-21 21:18
FYI, see https://github.com/alphapapa/with-emacs.sh, which is easier to use than chemacs.
Hamilton950B · 2022-04-21 21:25
I've done that once, when I moved from Gosling emacs to epoch in the early 1990s. I also did a major overhaul when I switched to gnu emacs in the mid 1990s. I've still got crap like this in my ~/.emacs:
(if (= emacs-major-version 21)
(load "python-21" t))
tmierz · 2022-04-21 21:39
Elpy is not working?????????
kaushalmodi · 2022-04-21 21:43
I haven't 🙋♂️
redblobgames · 2022-04-21 22:21
I came to say something similar.
If you're throwing it away, it's because you kept adding things without removing things you don't want. If you solve *that* problem instead, you won't feel the need to start fresh.
flamingbear · 2022-04-21 22:51
We call it emacs bankruptcy, and we do it all the time.
Well, I used to I haven't done it in a while, now I just groom my config startup every once in a while. I also just gave up elpy and started using lsp.
Good luck.
flamingbear · 2022-04-21 22:56
Nope, it's fine, just looking for someone to maintain it.
https://github.com/jorgenschaefer/elpy#important-note-looking-for-a-maintainer
a-c-d-w · 2022-04-21 23:49
I've declared emacs bankruptcy ... 7 times? in about two years XD I might be a little extreme tho
broken_symlink · 2022-04-22 01:46
Load times is one of the big problems I have right now. I'm also not using use-package at all. I'll keep that in mind when I start over.
karthink · 2022-04-22 02:11
My init.el is about 14000 lines and I have ~185 packages installed (about 350,000 loc). With autoloads + `with-eval-after-load` (which is use-package's `:defer`), my emacs boot time is 0.20-0.25 seconds, slower than `emacs -q` but effectively instant.
karthink · 2022-04-22 02:13
It's not that rare. 17 year old init.el (technically .emacs) and counting.
However it's only the same in a ship-of-Theseus sense, since it's not a backwards compatible init.el.
bakerk98 · 2022-04-22 03:30
Thats cool. I hope mine gets like that one day. I have it commented with blurbs from when I started.
Phil-Hudson · 2022-04-22 05:36
Unless it's impossible for you for some reason, I'd recommend that you switch your work pattern to never quit Emacs. Start Emacs in daemon mode and use `emacsclient` to open individual files. You can/should also permanently associate `emacsclient` with all relevant file types. Startup time then becomes practically irrelevant.
Mango-D · 2022-04-22 08:33
If you're starting fresh, I'd recommend using a literate config.
hmeh922 · 2022-04-22 08:57
How are you measuring it? Are you including early-init and after-init hooks? Just curious because mine is around 300 and there are a few things I just can’t seem to shave.
karthink · 2022-04-22 10:46
Via `emacs-startup-hook`, which runs after all the other init hooks. (Except `window-setup-hook`)
SlowValue · 2022-04-22 11:23
I'm using Emacs some decades now, but I never started fresh. I refactored my config several times.
The first major refactoring, was splitting my init.el into some smaller files (like "dired.rc.el", "help.rc.el", "c-programming.rc.el", "modeline.rc.el", "ivy.rc.el", "org.rc.el" and so on). I added the additional ".rc" to the filename to prevent filename conflicts with packages. "ivy.rc.el" for example is about `ivy` related packages and config. If a file gets to big, I split it based on topic, e.g now I have "ivy.rc.el" and "ivy-rich.rc.el", because I have a lot ivy-rich modifications. My init.el is mostly a loader for all those files (example: `(load "dired.rc" nil t)`). This helps a lot when bisecting the config or finding loading time issues. It makes it easy to switch major components like "helm" -> "ivy". I also have the commonly known `gc-cons-threshold`-hack and some benchmarking code around all loading.
Second useful refactoring, was using `use-package` this reduces loading time and makes it easy to replace|insert|remove single packages.
Now I don't feel the need to "start fresh" because I can handle the complexity (around 6000 LOC for config and startup time approx 0.8 seconds)
noi-gai · 2022-04-22 11:35
I had mine in 2009, having started in 2000 and after 3 years pause.
This configuration had been evolved with my use until today after having learned the lesson. No more .emacs bankruptcy!
hmeh922 · 2022-04-22 13:02
What do you print to know the time?
karthink · 2022-04-22 15:32
I put this at the top of my early-init file.
(let ((emacs-start-time (current-time)))
(add-hook 'emacs-startup-hook
(lambda ()
(let ((elapsed (float-time (time-subtract (current-time) emacs-start-time))))
(message "[Emacs initialized in %.3fs]" elapsed)))))
hmeh922 · 2022-04-22 16:43
Thanks, yea that's the same timing method I have. Do you use straight.el? There is a part of its startup that is significant that I can't shake. 300ms is fast enough, but just curious if I'm missing anything obvious.
```
void • 118ms • Between early-init and init
init • 9ms • Load Compiled Config
config • 43ms • straight.el
config • 11ms • Emacs Customization
config • 3ms • Helpful
config • 7ms • Direnv/envrc
config • 12ms • Nano
config • 5ms • File tree viewer (treemacs)
config • 23ms • Mini Frame
config • 7ms • Start Emacs server
→★ loaded early-init.el: 119 ms, init.el: 172 ms, post: 10 ms, total: 301 ms
```
dpoggio · 2022-04-22 16:58
I start fresh quite often, sometimes using different keyboards. I tend to write minor modes now to enable/disable some behavior depending on how I feel like, or the tasks I want to do.
super-linux-nerd · 2022-04-22 17:15
Built in `M-x emacs-init-time`
EmDashNine · 2022-04-22 17:21
I tend to start over with each new machine. This way, I just learn emacs's defaults, and don't dependent on tweaks that I either can't live without or that might conflict with an extension I want to use.
I basically stick to the debian-packaged versions of things and emacs itself. This way, I'm always ready to hit the ground running on a new instance, physical machine, or OS upgrade. In my early days of using emacs, I lost my .emacs a few times, and had to start over. This was before git made it easy to back up your dotfiles.
I don't spend a lot of time on keybindings. If a command is new to me, I just `M-x` it, using tab completion, apropos, or describe-mode. Eventually I will memorize the default keybinding if a command has one and I use it enough. If I spent all my time working in a particular language or project, this might not be good enough. But I'm a polyglot and nomadic emacs user. I might install a lot of extensions via `apt`.
The only things I tend to add to *every* .emacs file are small preference tweaks like: `(column-number-mode)` and `(global-auto-revert-mode)`, and a small little snippet of elisp to strip trailing white-space when I save file. Frankly, I wish these were defaults, and I'm not sure why they aren't. Does anybody *not* want to see the column number? If you're using `git`, then auto-revert-mode is essential to avoid serious confusion.
Recently I started using org mode. One of the things I *don't* like about it is how much configuration it required in my .emacs to be usable, rather being self-contained within the org files. Now I understand that some org-mode variables can be file-local, so I might re-think how I set up org-mode in the future.
Being somewhat of a computing nomad, I don't like being chained to dotfiles. I rather prefer to keep projects in self-contained git repositories, and keep as much of the infrastructure they depend on within repo itself.
My advice is to just move your .emacs off to one side and see how it feels.
EmDashNine · 2022-04-22 17:23
This looks interesting! Thanks for the link.
jcdix · 2022-04-22 19:19
I feel I represent the kind of emacs user who uses it for its functionality in doing certain things but who have no idea how to tinker under the hood. In particular, I use it for org and org roam. So for me what I find very frustrating about emacs is that installing new packages can do mysterious things that suddenly knock out some features that you like and got used to. For instance, recently I suddenly can't open or read epubs because nov.el throws an error after I upgraded packages. Another example is I love the all-the-icons-dired look. At some point the icon for folders changed to a file icon for some unknown reason and I have no idea how to fix it. So to your question, yes, I now feel the need to redo everything from scratch, because I have no idea how to fix those 2 problems. But it feels like having to build the house over again, because the upstairs faucet isn't working.
aqjo · 2022-04-22 21:15
I'm a bit of a newb, returning to Emacs. I've been enjoying daviwil's System Crafters videos, and particularly his use of org and Org Babel to create his init.el. Seems like a much more clean and organized way of doing it.
Link to his repo: https://github.com/daviwil/emacs-from-scratch
https://www.youtube.com/watch?v=kkqVTDbfYp4
karthink · 2022-04-23 00:37
> Do you use straight.el?
I do. The only thing I've tweaked with straight is to remove `'find-at-startup` from `straight-check-for-modifications`.
hmeh922 · 2022-04-23 01:59
K, thanks. My `(emacs-init-time)` with `emacs -Q` is 180ms, so I think I'm about as good as I'm going to get. I'm using native-comp, not sure if that makes any difference.
hmeh922 · 2022-04-23 02:00
FWIW, I never quit emacs unless I am working on my config. I work on my config a lot, so the quick startup is something I appreciate.
yedefash · 2022-04-28 23:24
can you share your config ?
203 Packages loaded in 3.63 seconds