Questions tagged [init-file]

for questions about initialization files `.emacs` or `init.el. DO NOT USE this tag if you assume answers require tweaking initialization files because many solutions do not involve directly manipulating initialization files.

On startup, Emacs normally loads a Lisp program from an initialization file, or init file for short. It is how Emacs is customized. Emacs looks for the init file using the filenames ~/.emacs, ~/.emacs.el, or ~/.emacs.d/init.el (where ~/ is the home directory). Use the tag for questions pertaining to any of these initialization files.

Use for questions about:

  • ~/.emacs, ~/.emacs.el, or ~/.emacs.d/init.el
  • customs, protocols, and canonical practices for Emacs startup files
  • errors in

Do not use for questions:

  • that you assume may need code snippets in the
799 questions
123
votes
6 answers

Are there any advantages to using ~/.emacs.d/init.el instead of ~/.emacs?

I've normally used ~/.emacs for my config file, but I've noticed others using ~/.emacs.d/init.el. Are there advantages to the init.el location? Any disadvantages?
Larry Coleman
  • 1,465
  • 2
  • 11
  • 10
89
votes
4 answers

Advantages of setting variables with setq instead of custom.el?

I see a lot of people (extension authors and others) give configuration examples with setq: (setq foo 'bar) These parameters are often defined with defcustom, making them available for customization through custom.el. I typically use custom.el to…
J David Smith
  • 2,635
  • 1
  • 16
  • 27
75
votes
12 answers

How to start emacs with a custom user-emacs-directory

I'm working on a custom and small Emacs configuration that I want to share with some friends as a git repository for them to use as a baseline for their own future configurations. For this I need some way to test my configuration and the simplest…
Mattias Bengtsson
  • 1,271
  • 1
  • 11
  • 18
69
votes
8 answers

What should/shouldn't I do when keeping .emacs and .emacs.d in version control?

Like many people, I manage a lot of my dotfiles via a version control repository (Mercurial on Bitbucket, private, in my case). This is handy when setting up a new machine or propagating configurations among different machines. So naturally I added…
Paul Bissex
  • 833
  • 8
  • 9
63
votes
12 answers

Synchronize packages between different machines

I use emacs in different places and I want to have a similar setup and packages installed everywhere. I guess I can use a version control repository for the setup files. Since I use Prelude, that would be ~/.emacs.d/personal/. I don't know how to…
El Diego Efe
  • 1,601
  • 1
  • 19
  • 24
45
votes
3 answers

What can I do to speed up my start-up?

What are some basic things I could do to reduce the start-up time? Is there anything in particular I should pay attention to, for that matter? Note: Startup time can be mitigated by starting Emacs less often (once per session) and opening files in…
caisah
  • 4,056
  • 1
  • 23
  • 43
34
votes
5 answers

Emacs won't load theme on startup

I've installed the solarized theme package via MELPA. I can select one of the two solarized themes via `customize-theme and it activates it. When I save the theme settings it adds the following to my init.el file: (custom-set-variables ;;…
user2249626
  • 661
  • 1
  • 5
  • 6
34
votes
6 answers

Running spacemacs alongside regular emacs: how to keep a separate .emacs.d

I would like to try spacemacs. But I don't want to switch from my regular emacs configuration just yet, so I would like the configuration that's currently in my .emacs.d to be in one directory, and the equivalent configuration for spacemacs to be…
Croad Langshan
  • 3,192
  • 14
  • 42
29
votes
12 answers

Organize the content of ~/.emacs.d/init.el and ~/emacs.d?

When we add more and more lines into ~/.emacs.d/init.el for various purposes (for python-mode, for emacs-eclim, for ...), the file becomes lengthy and less readable. Is there a way to help organize its content? My current ~/.emacs.d looks like…
Tim
  • 4,987
  • 7
  • 31
  • 60
27
votes
2 answers

What's the fastest way to reload my .emacs file when I make changes so all my affected buffers will pick up those changes?

I'm aware of C-x C-e which is eval-last-sexp and M-x eval-buffer, but these aren't always sufficient to pick up all changes. Sometimes you need to actually close buffers that are in the modes who have had their configuration changed, and other times…
b4hand
  • 1,995
  • 1
  • 19
  • 31
25
votes
1 answer

How do I troubleshoot Emacs problems?

In a situation where Emacs is not behaving like I want, what can I do to troubleshoot the problem? What steps can I take to find and fix the problem myself? Or, failing that, how can I gather useful information that so that people here (or on the…
Tyler
  • 21,719
  • 1
  • 52
  • 92
24
votes
3 answers

How to gracefully handle errors in init file

I would like a way to catch errors when running my init file, and then handle them gracefully. A lot of my most important customizations and keybindings show up at the end of my init file to make sure that other settings don't get applied over the…
nispio
  • 8,175
  • 2
  • 35
  • 73
24
votes
3 answers

How can I get undo behavior in Evil similar to Vim's?

The default undo behavior in Evil is too coarse-grained because it considers anything taking place between entering insert mode and leaving it as one edit operation. When you enter a whole paragraph of text during one insert and then execute undo,…
tmalsburg
  • 2,540
  • 1
  • 14
  • 29
21
votes
6 answers

How do I set a different location for the dot emacs .emacs file on Windows 7?

I am using a Windows 7 computer and do not have administrator access. Therefore I can not place a dot emacs file in the root directory. Is there a way for me to specify a different location for the dot emacs file?
Startec
  • 1,354
  • 1
  • 13
  • 30
20
votes
4 answers

How to setup default windows at startup?

Every time I open up Emacs I tend to set up 3 windows by doing C-x 3 (split-window-right) and then C-x2 (split-window-below). After that I have to switch to each window to open the files I want to edit. How can I set this to be done…
El Diego Efe
  • 1,601
  • 1
  • 19
  • 24
1
2 3
53 54