1. 73

I recently started getting into emacs and org-mode. I understand everyone has their own way of organizing their dotfiles and config. I would like to checkout how others are organizing their config (be it packages or color schemes). I eventually would like to setup my own emacs config but need some ideas/direction on how to!

Thank you all!

  1.  

  2. 16

    Some tips from personal experience:

    1. Make an ~/.emacs.d directory and put it in source control. Delete ~/.emacs (the file).
    2. Make a ~/.emacs.d/init.el, file with nothing in it. Make small changes, one by one, and see how they affect your workflow.
    3. Don’t make too many changes at once. Commit them to source control so you can reference them later on.
    4. When (and if) you start breaking up your configs, you’ll have the benefit of having them source-controlled in ~/.emacs.d.

    I’ve been using emacs for programming for ~7 years now. My config is here. I’ve mostly kept to vanilla emacs, my biggest flight of fancy is heavily relying on M-x shell as a regular, editable emacs buffer, kinda like the win panes in Acme. I use org-mode for basic project management and personal notes, but I don’t leverage any of the fancy agenda- tools, schedulers, etc. I also have my own color theme, which is available on melpa. I recommend making a theme as a way to get started with emacs packaging & melpa.

    Also, Sacha Chua is a great source for emacs stuff, both for beginners and advanced users.

    Good luck!

    1. 2

      Make an ~/.emacs.d directory and put it in source control. Delete ~/.emacs (the file).

      Alternately, if your .emacs file dates back to prior to support for .emacs.d/, then either: 1- make double dang sure that .emacs file is source-controlled, or 2- consider .emacs bankruptcy and fall back to my parent post’s advice.

      1. 2

        I follow very nearly the same approach, with one major exception.

        On my work machine, I have both a .emacs and a ~/.emacs.d/init.el file. The vast bulk of my configuration is in the latter and versioned as you suggest. But the former wraps a call to (load "~/.emacs.d/init") with some machine-specific setup (secrets, adding network shares to paths, setting environment vars for local tools, etc.).

        1. 1

          awesome! I love the very minimal color scheme. I don’t like the dark mode themes and actually prefer white. Thanks for sharing the repo!

          1. 1

            Nice!, I also prefer minimal themes. Mine is here (although I prefer dark mode): https://git.sr.ht/~aerique/emacs-theme-aerique

            Although, compared to yours my theme is already a little gaudy :-D

            1. 1

              I follow the above as well and I highly recommend it.

            2. 9

              Fun stuff! I’ve been meaning to do a write-up on this but haven’t gotten around to it yet. I may not be a master, but I maintain a number of themes (base16, monokai-pro, and grayscale being my favorites).

              My config has gone through a number of revisions both in and out of org-mode, with evil-mode, with normal bindings, etc. This is where I’ve settled for the time being.

              https://github.com/belak/dotfiles/tree/master/emacs.d

              Advantages to a config in org-mode: everything is in one file, org is amazing, and it’s easy to leave comments in a format that allows for more than just text.

              Disadvantages: everything is in one file, completion and linting of code blocks has never worked quite right in org files for me, and it can be slower

              Here are a number of things I can recommend for every config:

              • use-package - this makes config much easier and is the reason separate files works for me. It makes it easy to separate packages into different blocks (the main advantage you get from org-mode blocks) and removes a lot of boilerplate often used to speed up config loading.
              • straight - this is an alternative to package.el. It’s at least worth looking into. I’m using it because it makes it a lot easier for me to maintain my own packages without having a manual cloning process.
              • ido, helm, or ivy/swiper - pick one of these. ido is built-in but there are lots of good packages that expand it. helm is a huge package that does a ton of awesome things and ivy is a lighter weight package that’s still fully featured. I prefer ido because it’s fairly minimal.
              • If you want code completion, company-mode is amazing. I’ve been moving away from this for performance reasons, but I may revisit it later.
              • flycheck does an amazing job with linting.
              • magit is the best git wrapper I’ve used… ever
              • projectile made project navigation super easy. I would strongly recommend this for anyone who sometimes works in multiple projects at a time.

              If you’re looking for a good config framework, there are a few really solid ones I’ve used in the past, but I’m picky so I don’t tend to use them:

              • doom-emacs is a well-maintained project built on a really solid base that gets tons of updates. This is evil-mode focused but recently had better emacs bindings submitted as well.
              • spacemacs is evil-mode focused, but also has emacs bindings. It’s tried and true.
              1. 4

                I’ve tried spacemacs, although i like it, I think its too much magic. I would like to get my hands in and learn how to configure things myself.

                Thanks for sharing your config. If you ever write a blogpost, please share it in the community!

                1. 1

                  Thanks for grayscale. I’ve been using it exclusively for a long time.

                  1. 1

                    grayscale looks very zenburn’ish to me…

                    1. 1

                      Yep! I ended up using the zenburn colors as highlights. The general idea was taken from the original duo themes for atom where brighter colors are supposed to be “more important”, but even after that, there were still things like warnings, errors, diff colors, etc… so I went with the zenburn colors because I found they worked well with grayscale.

                2. 7

                  It is a towering edifice fashioned of a dark metal, all twisted loops and foreboding recesses. The land around it is blasted and barren, save for a sharp-edged grass that grows in tattered clumps.

                  Uh, mostly I haven’t done much with it, but I really like ace-jump-mode for navigation. I’ve got use-package, ido, a few flycheck integrations, and some Clojure-specific stuff.

                  It’s all in version control and thank heaven for that.

                  1. 7

                    I have an extensive literate configuration that configures many different subsystems, changes many default, etc. It’s rather verbose, but I hope it’s written in a way that even someone with minimal experiences my understand. I loosely inspired, but shorter and simpler configuration be found here (but watch out, the comments are in German!).

                    Since you mention wanting to configure Emacs, I’d recommend reading other peoples configurations, be they small or huge (I’ve linked a few in my config, under 1.3 Inspirations for writing this configuration). Try to pick up what you like as you go along, test it in the scratch buffer, and ideally only copy what you understand. Your best friend will be the help subsystem. C-h f and C-h v open manuals with hyper-text and, if installed, links to the source definitions. Reading the Emacs and Elisp manual can also be interesting, but I would take my time to do that (just don’t forget, it’s all a C-h i away).


                    I have a de-facto standardized system in how I adopt new code:

                    1. Play with code or configurations in *scratch*, make it work
                    2. If unsure, copy it to custom.el in my .emacs.d, see how it works.
                    3. If it looks good, create a section in my literate configuration (what’s published above)
                    4. If it doesn’t cause problems, add it to my git repository

                    This cycle ensures that I don’t mess up my working configuration, but that I have room to experiment. I’d recommend considering something along these lines.


                    The tricky part about Emacs is that it is usable without knowing any (Emacs) Lisp, but your usability will be inhibited. Knowing how to write your own commands opens a totally new dimension. Personally, I didn’t really use any of these things for the longest time, and that was when I kept switching back and forth between Emacs and Vi(m). After I took the time to sit down and learn the basics, I switched to using Emacs a lot more.

                    There’s so much to learn – even ignoring Org mode: Eshell, TRAMP, GUD, Magit, calc are all totally worthwhile subsystems, and that’s setting aside all the programming modes. What I value on top of everything is comfortability, having a system you don’t fight. And from everything I have used, Emacs is the most comfortable, even if one might have had a rough start.

                    1. 3

                      ohh shit! this is exactly what i was looking for, configuration with some explanation. Thanks for sharing the link!

                      1. 1

                        My pleasure, I’m always happy when my configuration is helpful to others.

                    2. 4

                      I have been using spacemacs for a few years with a custom config that I’ve slowly built. I made a couple half-hearted attempts at switching to vanilla emacs, but each time I realized that I rely on a massive amount of spacemacs functionality that I’d need to recreate.

                      https://github.com/bi1yeu/dotfiles/blob/master/spacemacs/init.el

                      1. 4

                        Doom Emacs (https://github.com/hlissner/doom-emacs) works well for me currently. What I like (compared to other Emacs distros) is that it isolates user configuration to three simple files: config.el (where you typically insert your setqs), packages.el (where you can easily add 3rd party modes that aren’t packaged yet by Doom) and init.el (with Doom-specific configuration). I just need to store those three files in a git repo and I can regenerate my Emacs configuration from scratch if something goes wrong.

                        Unfortunately, things often go wrong in these Emacs distros :/ but at least Doom has facilities for rescuing things.

                        1. 4

                          Another happy Doom-er here (ok doomer?)

                        2. 4

                          I’ll admit mine is an organically grown mess…. I had a go a couple of years ago and modularising it and versioning it in mercurial….. but then I discover Melpa and I got very busy and….

                          At this point it’s just better for me to bow out and mention the wonderful Sacha Chua and recommend you scan her very useful Emacs News for relevant posts.

                          https://sachachua.com/blog/

                          1. 3

                            I have in a nix overlay a nix expression that builds an emacs with everything I want, including all the supporting programs (git etc) being hardcoded paths to the nix store. It is inspired by BAUER.

                            1. 3

                              I have an ~/.config/emacs/emacs.org file which tangles to ~/.emacs.d/init.el. I do it like this for two reasons: first, I like literate programming (when it makes sense), and second, it makes it easier to keep my Emacs configuration in source control with the rest of my stuff.

                              I don’t touch the colour scheme because I use Emacs in the terminal, so don’t need to. With regards to packages, I have a vi-like setup using Evil, and don’t use many quality-of-life packages like Helm/Ivy, company mode, or whatever (although I do recommend these). I also don’t use org - I use Deft as an interface to notes in a custom plain text format.

                              Despite not using many packages, I do have packages to let me do most text oriented activities in Emacs - notmuch (I’ve recently switched from mu4e), elfeed, mpc, magit, eshell, eww, erc, for example.

                              1. 2

                                I went through a few iterations and declared Emacs bankruptcy a few times. I tried spacemacs in between and kinda liked it, but it had too much for my taste. Now I am back to a rather simple basic config: https://github.com/pxlpnk/emacs.d

                                I am trying to find more ergonomic approaches to use emacs. Anyone has experience with Xah flykeys, ergoemacs or similar?

                                1. 2

                                  I was on spacemacs for a long time, but eventually got frustrated with the “magic” that kept breaking things or behaved differently from what I would’ve liked, so a couple of months ago I went and built my own setup from scratch.

                                  Quick overview:

                                  • evil (I’ve been a vim user for most of my life, before I switched to emacs a couple of years ago)
                                  • spacemacs-inspired control scheme, with SPC as the leader key
                                  • way faster than spacemacs though, cold startup in <0.5s (stole some optimisations from doom)
                                  • config in a literal org file
                                  • leaning heavily on:
                                    • evil
                                    • ivy
                                    • general
                                    • projectile/persp-mode
                                    • straight
                                    • eshell

                                  I’m using org-mode for all kinds of note-taking and journalling, and also restclient, but none of the fancy non-text-editing modes otherwise (email, irc, etc.). Magit of course.

                                  1. 2

                                    Mine is a literate Org mode document that tangles to ~/.emacs.d/init.el as some others have mentioned. I started out with “better defaults” (I think?) and copying various people’s config, but ended up with lots of stuff that I didn’t understand. At some point I stripped back to almost nothing and built it back up with only things I knew & understood. Over the years it’s grown to be quit elong :-)

                                    Here are some features of my config:

                                    • Org mode literate config, tangling to ~/.emacs.d/init.el
                                    • I use use-package and its system-packages integration to install non-emacs packages from my Emacs config.
                                    • I read (personal) mail in Emacs, using Notmuch, with mbsync/isync for fetching and msmtp for sending mail
                                    • I wrote a Hydra theme switcher to allow me to more easily experiment with different themes
                                    1. 2

                                      I use Nix + Home Manager to get the packages that I want:

                                      https://github.com/danieldk/nix-home/blob/master/cfg/emacs.nix

                                      The configuration parts are a bit boring. I just took my pre-Nixemacs configuration and readFile it to put it in the right locations. I should probably rewrite the Nix stuff as well, this is from when I just started using Nix, there is probably no need to create symlinks in ~.

                                      1. 2

                                        I got fed up with package.el making it difficult to get a repeatable setup, because when you install a package it defaults to just “yeah give me whatever version you think is good” so I switched to using git-subtree and handling autoload/byte-compiling myself with these 7 lines of code: https://github.com/technomancy/dotfiles/blob/master/.emacs.d/phil/bootstrap.el

                                        Nowadays I think package.el supports locking to a specific version, but TBH I’d rather just have things in git instead of learning a new system. Note that straight mentioned elsewhere in the comments here doesn’t have this problem.

                                        1. 2

                                          thanks for sharing the script! I’m going to do a lot of tinkering but at some point would like to stick to stable version, I think the script would help!

                                        2. 2

                                          I have been using “dark mode” for approximately 20 years 🙄

                                          (invert-face 'default)
                                          
                                          (tool-bar-mode 0)
                                          

                                          Turn off the tool bar for more screen space.

                                          Lots of other little stuff, but I think it’s all pretty widely known.

                                          1. 1

                                            You will need this package https://github.com/julienXX/ivy-lobsters :)

                                            1. 1

                                              I had an extensive config, with lots of custom stuff in it, but eventually realized that 90% of it could be covered by spacemacs, holy mode (I’ve been using emacs for a long time, no interest in vim bindings!), and a few settings on top of that. So my .spacemacs has about 170 lines of miscellaneous stuff in the user config, 35 lines of package/layer configurations, and some various top-level config stuff. And since switching to that, a couple years ago, I’ve essentially stopped messing around with the config: it’s emacs, and it gets out of my way.

                                              1. 1

                                                I used to have a config. Then I gave up and just started configuring spacemacs slightly, which is much easier.

                                                1. 1

                                                  This is mine:

                                                  https://gitlab.com/duncan-bayne/emacs-setup

                                                  It’s grown organically over a decade; I really need to dig into it and clean it up. Works well for me though.

                                                  1. 1

                                                    Mines is about 400 lines long and pretty boring. Half of it is from custom-set-variables, and the rest is setting global key bindings, a few helper functions I’ve found helpful, and some manual customization that probably should have been done using custom-set-variables.

                                                    I personally don’t see much value in over-engineering my config files, so this is unlikely to change, but to each their own. It’s interesting to see the amount of work people put into them.

                                                    1. 1

                                                      From 1993 to about 2005 I had a messy, organically grown .emacs that had lived on various machines. Around that time, I refactored it into single-purpose files under ~/.emacs.d/init.d/, and my ~/.emacs.d/init.el did nothing but load them. I put it in source control around this time. Then around 2010 I refactored that into a literate org-mode config that was otherwise basically the same.

                                                      Around 2016, I got absolutely tired of doing my own emacs config, backed it all up, installed spacemacs (with emacs keybindings, not evil), and started doing pretty much all of my customization with `custom’ and package.el. I have some oddball packages installed as local spacemacs layers, but only a couple. These days, emacs Just Works for me without doing all the per-language and per-package setup I had to do in the elder days.

                                                      1. 1

                                                        Does anybody have a working configuration of Emacs (even with emacs 27) for Javascript+Flow for Linux and Windows?

                                                        I could not get it to work (I tried this every year as a ritual).

                                                        Lack of single project/workspace management capability that integrated with external tools and has uniform plugin interface, seems to be an overarching culprit. However this is just an opinion.

                                                        1. 1

                                                          Vanilla as possible. There are five computers I have physical access to that I regularly emacs at, and more that I access remotely, with different versions of emacs and different operating systems. And whenever I get a new client, there’s a high chance I’m going to use a computer they give me. So I’ve chosen to work with stock tools as far as possible.

                                                          I’m currently at a client-owned Mac and don’t even have a .emacs file. The only emacs-related configuration is I’ve added *~ to my global gitignore.

                                                          1. 1

                                                            I use an org-babel file, but it’s been a couple of years since I’ve thrown the whole mess overboard and restarted, so that might happen soon. sigh.

                                                            1. 2

                                                              I’m confused, is this like jupyter notebooks but everything within a org file ?

                                                              1. 1

                                                                That’s exactly what it is

                                                                1. 1

                                                                  Yep. You write everything in org format and then it gets untangled into elisp, which Emacs uses to startup. It’s very nice, if you comment everything. Which I don’t really do, so I lose the benefit of the literate style.

                                                              2. 1

                                                                I just throw everything in one init.el file. I’ve seen someone using org file to manage their Emacs config, but I’m not a fan of it.

                                                                My emacs looks like this at one point https://jfthome.files.wordpress.com/2019/11/custom-buffer-color.png

                                                                1. 1

                                                                  what font is that ? I usually use adobe source code pro, but this looks cool

                                                                  1. 1

                                                                    it’s Tamzen, a bitmap font

                                                                2. 1

                                                                  My config is a fork of sjmanning’s config.

                                                                  He’s organized things very well, it feels clean without being overdone and was easy to extend to cover my p{references,eculiarities} (e.g. VM, bbdb).

                                                                  I particularly like the use of straight.el to manage packages, it’s use-package compatible but makes it easy to use particular versions (or commits) of a package or to use your own fork.

                                                                  It’s easier to get your head around than some of the bigger distributions (e.g. Spacemacs).

                                                                  My previous config was forked off of rdallasgray’s graphene.

                                                                  1. 1

                                                                    another user also pointed out graphene, looks very interesting but still gui-ish. Thank you for sharing your config. I’m gonna try it out and see how it goes :)

                                                                    1. 1

                                                                      It’s important to me that my emacs config works reasonably sanely in both GUI’s (OS X, in particular) and in terminals (generally iTerm) on FreeBSD and etc….

                                                                      Your Mileage May Vary.

                                                                      If my config seems confusing, you might gain clarity by comparing it to sjmanning’s.

                                                                  2. 1

                                                                    I use spacemacs as my daily driver, I have some desire to move my config to nix and start from scratch. I’d especially like to integrate with xmonad and stop relying on emacs internal window management.

                                                                    Some things that make my life more bearable: using it in daemon mode so I can more easily break out of my emacs window and into the window manager. Tbh I’d just like to use an editor that is less featureful and is designed to rely heavily on the wm. Vim is kindof wha I want but emacs is better if I could limit it to what I need….

                                                                    I created another user to run a clean emacs with that users config (which is the best way I found for concurrent configs) sometimes I play a little with configuring it but not as much as I’d like.