Skip to content

vab2048/.emacs.d

Repository files navigation

My .emacs.d configuration

This repo contains my (semi) organised .emacs.d configuration. When initialising, Emacs looks for:

  1. ~/.emacs (which I do not use)
  2. ~/.emacs.el (which I do not use)
  3. ~/.emacs.d/init.el (which is contained in this repo)

I’ve tried to be organised by using org mode to document everything. There is still some cruft left over from before I used a ~.emacs.d directory and was using a .emacs file but essentially the control flow is as follows:

  1. ~/.emacs.d/init.el is loaded
  2. ~/.emacs.d/init.el contains the following emacs lisp:
    (setq custom-file (expand-file-name "custom.el" user-emacs-directory))
    (load custom-file)
        
    • custom.el contains the emacs-lisp that is output when you use emacs’ own UI to customise variables. This code just loads that file.
  3. ~/.emacs.d/init.el also contains the following emacs lisp:
    ;; load the Emacs Lisp source code blocks in the given Org-mode <file>.
    (org-babel-load-file (concat user-emacs-directory "config.org"))
        
    • This essentially loads config.org, extracts all source blocks which are labeled as having the language emacs-lisp, puts them into a file, config.el, and runs the code in that file.

That’s basically it.

Common Problems/Errors

File error: Cannot open load file, No such file or directory, use-package

This usually relates to the first time you use this config or if you are using it from scratch. Basically in init.el there are a number of lines which need to be uncommented if it is the first time you are using this config:

;; (Start) Uncomment this if it is the first time using the config
   (unless (package-installed-p 'use-package) ;; use-package used to isolate 
    (package-refresh-contents)               ;; and configure packages in
    (package-install 'use-package))          ;; a friendly and tidy manner. 
  
   (unless (package-installed-p 'bind-key) 
    (package-refresh-contents)            
    (package-install 'use-package))       
  
   (unless (package-installed-p 'diminish) ;; For reducing the minor modes which
    (package-refresh-contents)            ;; appear in the mode line.
    (package-install 'use-package)) 
;; (End)  Uncomment this if it is the first time using the config

Make sure they are uncommented and reopen emacs.

error: Required feature ‘pyvenv’ was not provided

To solve this issue run the following commands from within emacs:

M-x package-reinstall RET pyvenv M-x package-reinstall RET elpy

This will install the packages required for Python.

Incompatible .elc files

Using compiled .elc files which were compiled for a previous/different version of emacs may result in issues. This is because “packages are all bytecode compiled upon installation, so it’s not so far fetched that they are bound to a particular version of Emacs after that.” So we need to make sure the byte compiled files (i.e. .elc) are removed from the .emacs.d folder the first time you initialise the config on a new machine.

Steps:

  1. Copy the .emacs.d folder from the old home directory to the new.
  2. Remove the byte compiled files from the .emacs.d directory (example script below)
# To remove the .elc files from the .emacs.d directory
cd ~/.emacs.d
find ./ -name "*.elc" -delete

On Windows you can search the .emacs.d folder for “*.elc”, sort by file type and delete all entries for elc file.

File is missing: Cannot open load file, No such file or directory, diminish

M-x package-install
diminish

About

My .emacs.d configuration

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published