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.

Filter by
Sorted by
Tagged with
122 votes
6 answers
23k views

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?
85 votes
4 answers
18k views

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 ...
74 votes
12 answers
39k views

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 ...
69 votes
8 answers
6k views

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 ...
63 votes
12 answers
8k views

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 ...
  • 1,581
45 votes
3 answers
5k views

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 ...
  • 4,016
34 votes
5 answers
47k views

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 ...
34 votes
6 answers
8k views

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 ...
29 votes
12 answers
9k views

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 ...
  • 4,907
27 votes
2 answers
4k views

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 ...
  • 1,985
24 votes
1 answer
4k views

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 ...
  • 21.2k
24 votes
3 answers
6k views

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 ...
  • 2,520
23 votes
3 answers
2k views

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 ...
  • 8,093
21 votes
6 answers
17k views

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 ...
  • 1,314
20 votes
4 answers
9k views

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 ...
  • 1,581
18 votes
3 answers
8k views

Why do I have to add each package to load-path? (or Problem with require 'package in my init file)

Each time I install a package from the Package Menu, if I try to require it in my init file I get an error unless I manually add it to the load-path: (add-to-list 'load-path "/home/nick/.emacs.d/elpa/...
  • 4,353
18 votes
2 answers
9k views

When should I use with-eval-after-load in my configuration files?

I went over my configuration files and wanted to do some cleanup. My understanding of with-eval-after-load was that its body would be evaluated right after the related package is loaded. While ...
17 votes
4 answers
6k views

How to get the same Emacs environment on a different computer?

I'm a beginner in Emacs (using it for about 2 weeks now and loving it). As I update and expand my ~/.emacs.d/init.el file, the things that I write in there depend on certain packages that I installed ...
17 votes
3 answers
11k views

Failed to download 'gnu' archive

I tried to install emacs and in an attempt to install MELPA, tried: (this is my init.el file) (package-initialize) (add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")) (add-to-...
  • 171
16 votes
2 answers
3k views

Function to open my init file for editing or return its path

Is there a function I can call that opens my init file for editing or returns its path?
  • 1,280
16 votes
2 answers
4k views

Export an org-mode file as a PDF via command line?

What command-line arguments do I use to get Emacs to export an org-mode file to a Beamer PDF? (I want to create a Makefile that produces a PDF when the user runs make.) I tried following this answer ...
15 votes
3 answers
13k views

How to place all auto-save files in a directory

I would like to put all of my auto-save files into a directory, say something like ~/.emacs-saves Based on what's written in the wiki, I came up with this: (setq backup-by-copying t ; don't ...
14 votes
6 answers
3k views

How do I "group" hooks?

There are certain things like the display of trailing whitespace, display of buffer boundaries, rainbow-colored delimiters and many more I'd like to enable in most modes or rather, all programming- ...
  • 21.5k
14 votes
2 answers
9k views

How to automate installation of packages with .emacs file?

My ~/.emacs (which you can find on GitHub) file loads several different Emacs packages and I would like them to be automatically installed as soon as Emacs starts up, if they are not already installed....
14 votes
1 answer
3k views

after-init-hook vs eval-after-load/with-eval-after-load

I've found the rather useful How Packages work in Emacs 24, however, I'd like a definitive answer from an experienced user or a core developer as to which of these is actually preferred in the typical ...
13 votes
2 answers
8k views

`use-package` with :config to set variables

I'm trying to use use-package to set up my org-mode initialization. I have the following in my ~/.emacs file: (use-package org-mode :mode "\\.org$" :ensure org :config (progn (setq org-...
13 votes
2 answers
1k views

Where should I include a lazy initialization?

I want to add a specific key binding to latex-mode: (define-key latex-mode-map (kbd "<f6>") 'my-latex-defun) At the same time I want to set it only when the specific mode is loaded. So I ...
13 votes
2 answers
12k views

error: Package `use-package-' is unavailable

I am starting to build up a .emacs file to be used as a development environment within Docker containers. I get this error when starting emacs-nox in a Docker container. Warning (initialization): An ...
12 votes
4 answers
3k views

How to change default minibuffer message?

After the init file has done loading I get this message in the minibuffer: For information about GNU Emacs and the GNU system, type C-h C-a. What is it being triggered by and how do I change it?
  • 4,016
12 votes
2 answers
2k views

project specific init file

I have some customizations for emacs that I'd like to use for a single project, but not affect emacs globally. Is there any way I can have emacs load a specific init file when launched from a certain ...
  • 1,581
12 votes
2 answers
1k views

Elisp: How to exclude sensitive information from an init file? (ie login credentials)

I want to define a log in function in my init script, but I don't want to hardcode my login credentials. I think a good workaround is to have my init script read in my login credentials from a local ...
  • 2,360
12 votes
2 answers
4k views

Emacs always ask to trust colour theme at startup

My Emacs always prompts me if it should trust selected colour theme or not. I always answer y and y to trust and remember my choice. I'm loading colour theme manually: (load-theme 'my-favourite-theme)...
11 votes
1 answer
1k views

Cocoa Emacs 24.5 Font Issues (Inconsolata-dz)

I am trying to set [Inconsolata-dz][1] as my default font to Emacs. Regular Inconsolata works fine, but the dz version is not working properly. Most functions I use keep throwing this error (followed ...
  • 275
11 votes
1 answer
10k views

How to reload .emacs.d/ configuration without restart

When I change any custom configuration file in the .emacs.d/elisp/ directory, I have to quit Emacs and then start it again in order to get my changes applied. Is there any better way?
  • 213
11 votes
1 answer
4k views

How to navigate a JavaScript project?

I'm currently working on a JavaScript project using Backbone.js and I wonder how can I navigate between files, based on method and object definitions. For example, I keep references to some of my ...
  • 4,016
10 votes
3 answers
11k views

How can I find my Emacs init file?

I have read the guide found here: How Emacs Finds Your Init File I cannot find any .emacs directory in my home directory. I have show hidden files selected. I also cannot find the init.el file in ...
10 votes
6 answers
15k views

How do I get my initial frame to be the desired size?

I have the following in my .emacs file: (when window-system (set-frame-position (selected-frame) 0 0) (set-frame-size (selected-frame) 91 63)) The value of 63 is supposed to make my ...
  • 1,985
10 votes
1 answer
16k views

How do I make auto-complete enabled by default

I'm running GNU Emacs 24.4.1 on a clean install of Debian 8.1. I've installed auto-complete using the package manager. It is installed and if I type M-x auto-complete-mode I get a working auto-...
10 votes
3 answers
3k views

Use several Emacs configurations/versions simultaneously

I want to use several emacs configurations/versions simultaneously so that no configuration disturbs each other, each with their own configuration directory and elpa repository. I heard about the ...
user avatar
9 votes
3 answers
3k views

When use setq or set '

I tried to find an answer to this seemingly simple question, but the swamp (internet) is a big place. In the emacs init file in one case I use: (show-paren-mode t) In another case I use: (set '...
  • 201
9 votes
1 answer
2k views

Use multiple `:mode` arguments with use-package

I'm trying out use-package - the docs say the argument to the :mode keyword "can be a cons cell, a list, or just a string." However, I'm not sure how to make a cons cell or list work. Here's an ...
9 votes
4 answers
8k views

How to debug startup problem, if `--debug-init' has no effect

When I launch Emacs24 (in an Ubuntu machine) I get an error message in the init procedure. Warning (initialization): An error occurred while loading `/home/nivaca/.emacs': But when I launch it with ...
  • 1,461
9 votes
2 answers
5k views

Splitting windows on startup

How do I split my windows on startup like so: _____________ | A | B | |_____|_____| | C | |___________|
9 votes
1 answer
243 views

Automatically identify obsolete variables in init-file

When a new version of Emacs is released it is usually the case that some variables/commands/functions become obsolete. They are usually marked as such in the corresponding documentation: turn-on-...
  • 14.4k
9 votes
1 answer
2k views

Is it possible to load Dired+ automatically with use-package?

I'm trying to add dired+ to my init.el with use-package but I can't seem to find the name of dired+ on any of the package repositories ( marmalade, melpa or elpa ). I'd been able to add dired+ after ...
  • 568
9 votes
1 answer
620 views

Overriding fill-paragraph in LaTeX mode

I would like to change the behavior of fill-paragraph in certain modes (e.g. LaTeX-mode provided by AucTeX). I could just rebind the key M-q, but I am also using evil-mode whose implementation of ...
  • 534
9 votes
3 answers
1k views

how to get Emacs to locate the error in my init file without relaunching?

When there's an error in one of my init files, I get a vague message like this when I launch Emacs: Warning (initialization): An error occurred while loading /Users/im/.emacs.d/init.elc: (wrong-type-...
9 votes
1 answer
3k views

Coding System utf-8 on Mac - Which one and why as default?

I want to change my default encoding system from non defined to UTF-8 (I think that would be useful). Now I have seen many different UTF-8 coding systems: mule-utf-8 mule-utf-8-dos mule-utf-8-...
  • 897
8 votes
4 answers
7k views

Speed up Emacs start-up time

I have seen this thread but my problem is an order of magnitude larger. Also, a newbie, I did not understand much of what was being discussed there. So, this new question. I am running Emacs 25.2.2 ...
  • 1,832
8 votes
2 answers
3k views

Should I have removed `(shell . t)` to clear an ob-shell initialization error?

First post. I'd like to confirmation whether I sucessfully troubleshooted an install of Emacs, and, if I didn't, direction on where and how to proceed. My setup: Emacs 24.5 Macbook Pro Core Duo (mid-...

1
2 3 4 5
16