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.

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 ...
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 ...
15
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/...
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 ...
54
votes
10answers
20k 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 ...
31
votes
6answers
5k 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 ...
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 ...
63
votes
4answers
9k 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 ...
5
votes
2answers
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 ...
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 ...
5
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 ...
4
votes
2answers
481 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 ...
4
votes
1answer
1k views

Flycheck could not find file under load-path

I have some elips *.el file in my ~/.emacs.d/gman/ folder, e.g. smart-inputp-methods.el. This folder is added to my load path at the beginning of .emacs file: (add-to-list 'load-path "~/.emacs.d/gman"...
2
votes
1answer
374 views

How to exit from .emacs init file?

I want to debug my init file, by exiting from loading the file in the middle so if something is wrong after that place it will not be loaded. How can I exit from .emacs file?
2
votes
2answers
2k views

How to disable global Linum mode for certain mode?

in my init.el file I have the following: (global-linum-mode 1) (add-hook 'term-mode-hook (lambda () (linum-mode))) However, when I enter ansi-term-mode linum mode is still on. I have also tried (...
7
votes
3answers
450 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
470 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?
5
votes
2answers
2k views

Enable hl-line-mode globally

Running M-x hl-line-mode enables highlighting for the current buffer. How can i set highlighting current line to be enabled in init.el?
4
votes
2answers
561 views

Detect whether a package (AUCTeX) is installed from .emacs

In my .emacs, I distinguish between two scenarios: AUCTeX is not available. Then I load my customizations for the basic TeX mode — let's call that (my-tex-mode-customizations). AUCTeX is available. ...
1
vote
0answers
143 views

How to debug a(n) .emacs that doesn't work correctly, but also doesn't throw any errors? [closed]

I currently have an Emacs/AucTeX setup where emacs --debug-init doesn't throw any errors, but things still don't work as expected. This being the case, I don't really know how to debug my .emacs file ...
100
votes
5answers
12k 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?
19
votes
5answers
27k 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 ...
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 ...
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 ...
18
votes
4answers
6k 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 ...
2
votes
1answer
2k views

Where to put user configurations/defaults for spacemacs?

I am a vim user trying to covert to emacs/spacemacs, but I'm having a horribly difficult time configuring things that seem like a breeze others. I want to limit the fill to 80 (mainly for .txt files ...
4
votes
3answers
1k views

Emacs 25.1 & Python 3.6.0 Integration [Newbie]

Preface: I've been dabbling with python programming for a mere few months now. Previously, I spent most of my programming time using C# with Visual Studio. In the Python world, I've been using ...
7
votes
1answer
7k 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-...
5
votes
1answer
193 views

Removing tool bar oddly slow

(tool-bar-mode 0) takes up 11% of my initialization time (about a third of a second). It's not that big of a deal; it's just strange. I've tried it on multiple computers. I've also tried disabling ...
4
votes
2answers
755 views

Portable Emacs: Remapping user-emacs-directory

The Problem I want to install Emacs on a USB Flash Drive in a portable fashion, that is, Emacs should be able to be run from the UFD, once plugged on a device, without predefined paths to its ...
3
votes
2answers
4k views

Starting a virtualenv for emacs to use

I am starting a Python virtualenv through init.el (or so I would like): (require 'virtualenvwrapper) (venv-workon "my-python-project") However, flycheck does not find flake8 or pylint, which are ...
7
votes
1answer
201 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 ...
6
votes
4answers
1k views

Debugging slowness in init file (not hostname related)

I am seeing some slowness in my init file loading: $ time emacs --debug-init -eval '(kill-emacs)' -Q real 0m0.672s user 0m0.338s sys 0m0.057s $ time emacs --debug-init --eval '(kill-emacs)...
6
votes
2answers
3k 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-...
5
votes
1answer
2k views

How to fix this startup package initialization problem?

All of a sudden Emacs returns an error at the startup, when I run $ emacs --debug-init from the terminal (linux) I get this debug error message: Debugger entered--Lisp error: (wrong-type-argument ...
4
votes
3answers
5k 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 ...
3
votes
1answer
968 views

How can I override initial-buffer-choice if I specify a filename at command line?

In my .emacs file I have the following line in custom-set-variables: '(initial-buffer-choice "~/Programming/C++/<some project I'm working on>") This works great. However, I use emacs to edit ...
2
votes
1answer
2k views

Emacs won't load theme installed from MELPA

I just installed the seti-theme from MELPA and no errors occurred. Than I ran M-x load-theme and after a few questions nothing would hapen and emacs would throw the following error: Warning (...
2
votes
1answer
131 views

How to make the init file compatible with X and console at the same time?

I have customized the .emacs file a little to suit my taste, and it works fine when run in its own window. But when I try to run it in my terminal using the command emacs -nw, it throws up the ...
2
votes
3answers
275 views

Hide emacs frame until loaded

In my init.el file, I have some code to hide the Emacs toolbar: ;;; Hide the toolbar (tool-bar-mode -1) But when I load Emacs, it first enables the toolbar, and then quickly hides it, after it reads ...
2
votes
1answer
116 views

tool-bar in emacsclient

I have the following for ridding of the toolbar on startup in graphical mode in my init configuration: (if window-system (tool-bar-mode -1) ) the issue: it works fine (albeit slow...see this ...
1
vote
1answer
352 views

org-babel-load-file doesn't load entire file

In ~/.emacs.d/init.el I'm calling my annotated configurations file settings.org like so: (require 'ob-tangle) (org-babel-load-file (expand-file-name "~/.emacs.d/settings.org")) This generates ...
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?
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 ...
6
votes
1answer
1k views

Since Emacs 25.1, package-list-packages modifies and writes my .emacs

I've just installed Emacs 25.1. My .emacs works well on Emacs 24.5. But now that I'm on Emacs 25.1, when I do M-x package-list-packages, Emacs modifies and write .emacs in the background with the ...
3
votes
2answers
1k views

Why does (require 'use-package) fail from my init file, but succeed interactively? [duplicate]

With the following init file, emacs chokes on the first line: bash-4.3$ pwd /Users/sean/.emacs.d bash-4.3$ cat init.el (require 'use-package) (use-package package) bash-4.3$ emacs --version | head ...
3
votes
1answer
188 views

How can I use an interactive function in a script?

I'm using virtualenvwrapper.el to load Python virtualenvs during emacs sessions. I would like emacs to start with a default one, so I don't have to load it manually every time. To load it manually, I ...
3
votes
2answers
126 views

Defining key binding at one place

is it possible to define key bindings at one place in an init file? something like: (define-key-bindings '(("C-x M-f" 'fly) ("C-x M-k" 'run) ...))
3
votes
1answer
147 views

`#+NAME:` is ignored unless running Emacs with `-q`

I am trying to export an .org buffer with the following contents: #+CAPTION: My subgraph. #+NAME: fig:subgraph [[/tmp/image-4383FmT.png]] The following latex output is produced: % Created 2018-01-...
3
votes
1answer
56 views

Tell packages not to change certain variables

It seems like some variables that I set at one place in my init file could potentially be modified by other packages that are loaded later. One place where this has come up for me is the variable ...