Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

104
votes
5answers
13k 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?
65
votes
4answers
10k 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 ...
61
votes
8answers
4k 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 ...
56
votes
12answers
6k 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 ...
56
votes
10answers
22k 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 ...
40
votes
3answers
3k 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 ...
31
votes
6answers
6k 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 ...
27
votes
12answers
6k 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 ...
27
votes
2answers
2k 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 ...
21
votes
1answer
1k 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 ...
20
votes
5answers
28k 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 ...
19
votes
3answers
978 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 ...
18
votes
4answers
7k 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 ...
17
votes
2answers
2k 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 ...
16
votes
4answers
3k 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 ...
16
votes
3answers
6k 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/...
15
votes
2answers
1k 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?
15
votes
6answers
7k 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 ...
14
votes
2answers
3k 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 ...
13
votes
5answers
2k 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- ...
13
votes
2answers
956 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 ...
12
votes
1answer
2k 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 ...
11
votes
2answers
899 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 ...
10
votes
4answers
1k 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?
10
votes
2answers
2k 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)...
10
votes
1answer
2k 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 ...
9
votes
2answers
1k 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 ...
9
votes
1answer
808 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 ...
9
votes
1answer
453 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 ...
9
votes
1answer
989 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-...
8
votes
2answers
3k views

Splitting windows on startup

How do I split my windows on startup like so: _____________ | A | B | |_____|_____| | C | |___________|
8
votes
1answer
190 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-...
8
votes
1answer
3k 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 ...
8
votes
1answer
429 views

Why is helm-recentf not fuzzy?

For some reason, fuzzy matching is not working in helm-recentf for me (though it is working everywhere else). I have the following settings in my .emacs file: (setq helm-recentf-fuzzy-match t ...
8
votes
1answer
515 views

How can I prevent yasnippet from breaking when I update my packages?

After packages have been updated, the location of the loaded elisp files will change to be in the folder of the new version of the package. Yasnippet attempts to lazily load snippets for the file it ...
7
votes
2answers
4k 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-...
7
votes
2answers
167 views

Why expression fails in init file, but works fine during session [duplicate]

I want to understand why an expression of the form (load-theme 'my-kewl-theme t) fails1 when run as the last expression in my init (~/.emacs) file, but works fine if I evaluate it as soon as soon as ...
7
votes
2answers
2k 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....
7
votes
2answers
2k 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-...
7
votes
1answer
247 views

What's an easy way to install packages?

I use MELPA already, this question is about the actual mechanics of installing a package. My current process is: M-x package-list-packages C-s name-of-package C-s enough times to be on the actual ...
7
votes
2answers
224 views

How can I have a second .dir-locals?

When collaborating on a project, certain editing variables are set to make sure everyone is producing a similar style of code. In Emacs, these are usually implemented as either file-local variables ...
7
votes
2answers
672 views

Relative paths in init file

When loading things like themes from custom directories, is it possible to specify a path relative to the init.el file, rather than an absolute path? I ask because I want to be able to use the same ...
7
votes
1answer
1k views

Emacs setup for LaTeX after (use-package) verse

How to make this configuration file work with use-package with regard to AucTeX, RefTeX and LaTeX. I usually write latex rahter than pure tex documents. Current Working Emacs Configuration (load "...
7
votes
3answers
462 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-...
7
votes
1answer
515 views

Is there a universal 'after-theme-load' hook?

I would like to set several face variables for use with any theme in my personal init-file. Is there a hook I could use to insure it is theme independent?
6
votes
4answers
2k 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 ...
6
votes
1answer
943 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 ...
6
votes
3answers
3k 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 ...
6
votes
1answer
523 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 ...
6
votes
1answer
2k views

Projectile installed but “Autoloading failed to define function projectile-mode”

I can M-x projectile-mode (I get this and other projectile commands in the completion list) but it fails with Autoloading failed to define function projectile-mode Projectile is an installed ...