1. 38
  1. 21

    Normally I’m not big on these “take someone else’s config and make it your own” but that’s because they typically don’t have a lot of transparency; when things go wrong it’s hard to find out why, or even to know what search terms to use to dig deeper. This project avoids that problem by clearly describing every single change it makes to the defaults.

    I have a similar project of my own (only 39 lines) which dates back to 2013: https://git.sr.ht/~technomancy/better-defaults

    Context: I’m the creator of the original emacs-starter-kit, which I abandoned when I realized the kinds of problems it caused to give people a pile of elisp and tell them to run with it: https://github.com/technomancy/emacs-starter-kit

    1. 11

      This post attracted a bunch of negative comments, and I’d like to offer a counterpoint here.

      Given how Emacs is very much a Build Your Own Editor with Lisp Lego kit with really fancy Lego blocks, there’s no way anyone’s config is going to be “right” for others, even if it’s only five lines. However, I also think that anyone who needs to start with a small config from someone else doesn’t actually care about any of the more controversial things here, like what buffer is shown by default or whether the menu bar is on or off.

      So whether the choices outlined in this 116-line .emacs are right or not is really not very relevant. If you disagree, go ahead, post your own .emacs, see how right everyone else thinks you are. You’ll find that half the things that are second-nature to you horrify half the Emacs nerddom out there.

      The good things about config examples like this one are:

      1. They are self-contained, approachable starting points for your own configuration

      2. They provide you with some ideas for basic, convenience configuration options that are not enabled by default but change everything, like how end-of-sentences are treated (which, unless you’re a huge computer history nerd, you wouldn’t even guess is configurable!) or rainbow-delimiters (which you may or may not want – I don’t use it personally – but are not things that you just check in a configuration window)

      Being able to show this in a simple, self-contained example is particularly important because lots of Emacs users have very advanced setups, with lasers and everything, and it’s hard to make sense out of everything at once. This is particularly hard to understand for those of us who have been at it for a while. If you learned Emacs in 2002 or so, that was before ido, before org-mode – before icicles and company, I think? – things that are pretty much standard in every fancy setup tutorial out there. We learned all these things gradually, but being dumped into a world where everyone casually says oh, yeah, that, well, I got M-y bound to icycle-execute-extended-command, it saves a lot of keystrokes, is a whole other story. It’s not that you don’t even know where to start, you don’t even know where you’re supposed to get.

      It’s probably a bad idea to get someone else’s config file and just pile stuff on top of it. It eventually backfires. But, while back in 1985, sticking someone in front of a terminal with a copy of the Emacs manual was probably enough to get them running, things aren’t quite as simple as they used to be, and giving them a glimpse of what they’ll be able to do once they get the lay of the land and maybe read the manual is enormously helpful.

      1. 3
        1. You read technomancy’s comments and replied to them in a very uncharitable way here. He’s been positive both about this config’s readme and contrasted it to his own experience of just dumping emacs lisp on people and watching as they struggle to comprehend what he actually did to make their Emacs experience better. While his comments do skew a bit towards elitism I think his heart is in the right place

        2. Besides him most of the “negative” comments have been about this config removing things that the commenters believe help people: namely the startup splash with it’s link to a tutorial and the menu bar. We want to discourage people from removing them in configs meant for new Emacs users because they’re very helpful to people who don’t know how to use Emacs or write Emacs lisp yet. Those of us who disagree aren’t out to say don’t use this config, we’re asking legitimate questions about it and bringing up issues with it. Demanding people post their configs as alternatives misses the point.

        3. Sticking people in front of Emacs with a manual is unnecessary given the manual is already there. Contrary to what you’ve said things have not gotten more complicated. They’ve gotten simpler. Popular package maintainers have been prudent in documenting their packages. Every external elisp function I’ve tried has come with good documentation. So I’m not sure what you’re trying to say here except it’s harder for people to learn Emacs in 2021 than it was in 1985 and if that’s the case you are very false.

        1. 3

          The Emacs documentation is top-notch, and it also makes it easy to document packages, so most popular packages have excellent documentation. However, Emacs, and a lot of popular packages, have grown more complex. They are by no means simpler. For people starting out today, there are way more options for anything than there were for us. Yes, it’s easy to learn, but there’s also more of it to learn than ever, and it’s more intimidating than it’s ever been.

          As for 1 and 2: you’ll find that, contrary to what the asshole brutal honesty club is preaching, being nasty to people tends to make them prickly. If you want your words to find a charitable interpretation, a charitable tone will get you a long way towards that ;-).

        2. 1

          I think a lot of people including technomancy and myself have been saying “great job, thank you!” and then more detailed feedback.

          If you disagree, go ahead, post your own .emacs, see how right everyone else thinks you are.

          Technomancy did do just that, and, I did a while back.

          The Emacs documentation is top-notch

          Yes and no. Yes, it’s awesome that we have describe-mode, describe-function, describe-variable and describe-key.

          However, I had been using Emacs for a few years before I found these (and they instantly changed my relationship sith Emacs; finding them turned it into the wonderful Lego ocean it is).

          Instead, the original tutorial at the time focused on teaching me C-n, C-p and friends (twenty or so navigation keys) and mark and region type stuff. When I later found out that “wha huh? Arrow keys, page up, page down, mouse selection, shift+arrow keys all work kinda like Notepad? Why did I spend all that time learning the C-n, C-p stuff?”

          Now, I still do use those Emacs-specific keys, it’s nice to be able to keep my hands in touch typing position, the frustration instead is that it didn’t tell me about the describe- family.

          And, one of the things, backup-by-copying, I only learned last year. After 22 years with Emacs. And it’s such a bonkers default. It breaks hardlinks.

          like how end-of-sentences are treated

          An addition I suggested on here! (Although, reading the git blame it seems like it was already in there, I just missed it, while backup-by-copying was added after we suggested it here.)

          that was before ido, before org-mode – before icicles and company, I think

          I use org but not ido, icicles, company, ivy or helm.

          The good things about config examples like this

          Which why I’ve been saying yay and trying to help out by posting the suggestions I wish someone had told me. I read technomancy’s comment as similar. More “yes, and” than “nasty”.

        3. 6

          Serious question for most of these starter configs: How does inhibiting the startup screen without replacing it help anyone?

          On the startup screen you are given hyperlinks to a guided tour and tutorial, which imo is probably the best thing you can provide new users. Setting them up with a blank screen is counterproductive.

          1. 8

            It’s slow and scary, I love the blank notepad-like familiar screen. Not arguing for inhibit to be the default but I was happy to find it, one of the first options I set.

            1. 1

              It’s slow and scary? Please elaborate because it takes the same amount of keystrokes to exit the startup screen as it does a blank one.

              1. 3

                I don’t think anyone suggests replacing the splash screen with nothing?

                Setting inhibit-splash-screen makes it drop you into a scratch buffer where you can enter elisp directly, which is useful on its own. In my own config I have it drop me into an eshell buffer, which IMO is more useful than scratch, but either one is more useful than the splash screen for people who already know how to open the documentation.

                1. 2

                  for people who already know how to open the documentation.

                  I think this is the important bit here and it’s people who don’t know how to open the documentation just yet that I find it most useful for.

                  After learning a bit I’m all for users replacing the splash, but I also worry about the user who is inclined to copy a config that’s branded as sane or better defaults before they get a good grasp of what they’re using. It’s something that happens a lot more in practice than I’m comfortable with in a midly popular emacs community that I’m a part of.

                  1. 1

                    In my own config I have it drop me into an eshell buffer

                    Pray tell! This is relevant to my interests. I went looking for your config to try and steal that bit, but couldn’t find it.

                    1. 3

                      I just put a call to (eshell) in my init.el file; nothing much to it.


                      1. 2

                        Part of the problem is you went looking for his config instead of an answer

                        Try this

                        (add-hook 'emacs-startup-hook 'eshell)

                        Not sure if it handles edge cases but I think you will get more value out of figuring out why than copying from someone else’s config wholesale.

                        1. 1

                          Yeah, I was lazy. I ended up skimming the docs for the initialisation section and came up with this, which appears to work:

                          (setq initial-buffer-choice 'eshell)

                          Edit: it doesn’t work, at least not fully. I do get a nice Eshell on startup, but for some reason Magit can’t find emacsclient:

                          There was a problem with the editor '/run/current-system/sw/bin/emacsclient --socket-name=/var/folders/mn/y08j0jvs2cv95bthlsgsm9sr0000gn/T/emacs501/server'

                          Edit2: that issue seems to be a problem with with-editor.el, but I have to do some more debugging to rule out an issue with other parts of my config.

                    2. 2

                      Oh, it does?! Ok, then maybe that’s cool. I haven’t had the start up screen uninhibited since the 90s. Maybe you are right. Back then it’d launch you into a really bad tutorial, all focused on C-n, C-b (arrow key basics) and not on stuff like describe-key, describe-mode, describe-function.

                  2. 6

                    Even worse is that most starter configs, including this one, disable the menu bar – which is the most helpful feature for new Emacs users!

                    How, as a new user, are you supposed to know that C-x C-f means “open file”? By far, the quickest, simplest and most intuitive way is to open the File menu and check the corresponding keyboard shortcut there.

                    1. 3

                      The menu bar is useful for about your first hour or two.

                      As soon as you learn how to describe then you need to let go of the menu bar; people assume all the commands will be visible there but it’s just too limited. Most commands aren’t in the menu bar; it’s the wrong place to look for things.

                      1. 6

                        The menu bar may be the wrong place to look for things but it’s far easier to navigate than the output of any describe command called on a buffer with non-trivial modes. Commands are organised in sub-menus of a few items rather than in a flat list organised alphabetically by prefix and binding, and oftentimes you really don’t need all commands, just the important ones. Self-documenting features like describes are great if you already know what you’re looking for, but sometimes you don’t. It’s also useful for commands that are accessed so infrequently that you don’t want to bind them to anything, or don’t want to remember the bindings. I’m not gonna bind “Manage Emacs packages” to anything, retrofitting a Space Cadet keyboard on my laptop is just not worth the effort.

                        At the risk of embarrassing myself in front of the crustacean nerd audience by looking like a puny normie, I’ll gladly admit that I’ve used the Emacs menu bar for like twenty years now and I have no intention to stop. I turn it off by default because I generally use darker themes, and sometimes (coughon Windowscough) the menu bar burns my retina, but I have `menu-bar-mode`` bound to F10 so I can toggle it on. Sue me.

                        (Or revoke my Church of Emacs membership card, I guess? :-))

                        Edit: also, the target audience of this 72-line (well…) config really seems to be people who have used Emacs for 1-2 minutes, so maybe it’s worh keeping the menu bar on for the remaining 118 minutes or so :-).

                        1. 2

                          I don’t actually use describe very much… what I think is the most useful thing for new-to-intermediate users is:

                          1. Treat M-x like you treat the Command Palette on a normie editor (those are basically inspired by M-x anyway).
                          2. Use a reasonable search and completion framework for the minibuffer, preferably with marginalia. I use selectrum + hotfuzz + prescient, but I’m happy to start seeing good solutions show up in core and/or GNU Elpa, like vertico.

                          I do think absolutely new users should leave the menu-bar and scroll-bars on until they have learned what the better alternatives to those are.

                        2. 2

                          Even worse is that most starter configs, including this one, disable the menu bar – which is the most helpful feature for new Emacs users!

                          How, as a new user, are you supposed to know that C-x C-f means “open file”? By far, the quickest, simplest and most intuitive way is to open the File menu and check the corresponding keyboard shortcut there.

                          But how am I supposed to look cool if I have a menu bar? It wouldn’t look like an xterm otherwise.

                          1. 2

                            Your Emacs looks like an xterm? Mind sharing your config? /s

                      2. 3

                        I don’t know if these are appropriate for a novice or not but I can’t live without them:

                        (define-key global-map "\C-xj" 'bury-buffer)
                        (define-key global-map "\M-s" '(lambda ()
                        				 (if (get-buffer "*shell*")
                        				       (switch-to-buffer "*shell*")
                        1. 1

                          I have something similar ♥

                          (global-set-key (kbd “C-S-q”) ’bury-buffer) ; although I need to change that one now that I, unlike control-shift commands, work over ssh (global-set-key [(control z)] ’shell) (eval-after-load ’shell ’(define-key shell-mode-map [(control z)] ’bury-buffer))

                          I have a bunch of similar stuff for the modes I use the most, like cmuscheme.

                          Also I have this for a ton of modes:

                          (push (cons "\\*shell\\*" display-buffer--same-window-action) display-buffer-alist)

                          I hate the window splitting popups so much 💔

                        2. 3

                          Thank you! But also

                          (setq backup-by-copying t)
                          (setq sentence-end-double-space nil)
                          (global-set-key [(control h)] 'delete-backward-char)
                          (keyboard-translate ?\C-h ?\C-?)
                          1. 2

                            I feel like I’m the only person who has sentence-end-double-space set to t — I like it because it allows me to easily navigate sentences, and it doesn’t matter because when I export the document to another format the spaces get properly minimized.

                            1. 7

                              Hi acdw!♥

                              I felt like setting it to nil (which I didn’t realize until after a few years) unlocked super powers of Emacs I had only dreamt of before, M-a, M-k, transposing sentences etc, even in text I didn’t originally author, and it does a really good job.

                              Also, with this set to nil, it works with one or two spaces; with it set to t it can’t find sentence boundaries if there’s only one space. I can’t believe that’s the default.

                              1. 2

                                Hi there :) Nice to see you on lobsters!

                                Oh my god, you’ve actually convinced me to turn sentence-end-double-space to nil … I honestly did not realize that it’s telling Emacs to recognize single-spaced sentences, which honestly makes so much sense.

                                I think the only place I want to set it is when filling paragraphs, so it fills the “proper” (to my eyes anyway) two-spaced sentences, which of course I can just add some advice to to fix. Thanks for the mind-changer, snan!

                                1. 1

                                  PS. I’ve made a small dumb package to correctly fill even with sentence-end-double-space set to nil:


                                  I hope it’s okay I quoted you.

                                  1. 2

                                    🧕 I wouldn’t exactly call it “correctly” since I favor the single spaced style. I don’t mind the quotes ofc.

                                    1. 1

                                      hahahahah I’ll make sure to mention you’re not in favor :P

                                    2. 2

                                      So if you can make it clear that I’m not an advocate for double-spacing, that’d be great ♥

                                  2. 4

                                    Can not sentences be recognized without double space? If some text starts with a capital letter and ends with punctuation followed by a space or the end of the line, then that should do the job, right?

                                    1. 8

                                      Dr. Spock might want to have a word with you. Mr. Smith might also chime in.

                                      1. 1

                                        In all seriousness, I’ve never heard about them. Is this something local to the US?

                                        1. 2

                                          I was giving an example of a sentence that would be mis-parsed by assuming all sentances end with a period followed by a single space.

                                          As for the names, Dr. Spock was a rather famous medical doctor in the U.S. and wrote a popular book about having babies (I think in the 60s?). There was also a character on a science fiction TV show (Star Trek) where there was a character named “Spock.” As for Mr. Smith, the last name “Smith” is one of the most popular (if not the most popular) last name in the English speaking world.

                                          1. 2

                                            Yes, it’s an US thing. They even use period as a decimal marker (!).

                                            1. 1

                                              That’s crazy talk right there!

                                        2. 4

                                          Yeah. Setting it to nil, it can recognize sentences either way. Leaving it in t means it only recognizes double spaces.

                                        3. 2

                                          I’d be a lot more likely to enable this if everyone else had it enabled, but when I’m working on documentation it’s more important for my style to match the project itself than for me to have it work the way I like personally.

                                          1. 1

                                            I think I was able to get away with it because I generally only write for myself, but you’re right that most people are single-spacers. grumble :P

                                          2. 2

                                            You’re not. Even vi does it. ;)

                                          3. 2

                                            Disabling the help shortcuts seems like a real bad idea to me?

                                            1. 1

                                              F1 ftw!

                                              Having a homerow key combo that’s delete-backwards-char in almost any other app split the window and pop up help stuff is pretty cumbersome. I do F1 m, F1 k, F1 f all the time. Pretty great.

                                              1. 2

                                                Hm; I guess if I didn’t have a keyboard that put backspace on the thumbs that’d be more appealing. I use C-M-h a lot more than backspace in Emacs tho.

                                                1. 3

                                                  You made my keyboard ♥


                                                  1. I hate using my thumbs (other than space) so I didn’t put any important keys there.
                                                  2. It’s also not just about adding access to backspace but about decreasing the “minefield factor” of having a help popup.
                                                  3. On the Atreus specifically, I have a layer switcher in the outer lower corners, which + h sends literal backspace so I don’t need change in my .emacs anymore. + works in other apps too.
                                                  1. 1

                                                    I have a layer switcher in the outer lower corners, which + h sends literal backspace so I don’t need change in my .emacs anymore. + works in other apps too.

                                                    I have a similar thing but in my WM instead; if I press C-i or C-m it will send a tab or enter character in any program, even outside Emacs. Indispensible!

                                                    1. 1

                                                      I have i, m, h, j, f, n, p, b, v etc but because it’s on a layer switch I can send actual C-i when I need to (for example invert selection in some drawing apps). ♥

                                          4. 1

                                            Additionally, I like to use the emacs –daemon instead of (server-start).