tidy Emacs Config

Sachin

GHM-2016, Rennes

Emacs configuration

How do you manage your Emacs configuration?

How do you manage your Emacs configuration?

  • .emacs
    1: ;;; .emacs
    2: (add-hook 'after-init-hook
    3:           '(lambda ()
    4:              (load "~/.emacs.d/my-config.el")))
    

How do you manage your Emacs configuration?

  • ~/.emacs.d/my-config.el
    1: ;; Window tweaks
    2: 
    3: ;; Add package archives
    4: 
    5: ;; Configure packages
    6: 
    7: ;; Custom methods
    8: 
    9: ;; Key bindings
    

Few months back

 1: ;;; ~/.emacs.d/init.el
 2: 
 3: (package-initialize nil)
 4: 
 5: (load-file "~/.emacs.d/general_config.el")
 6: (load-file "~/.emacs.d/install-packages.el")
 7: (load-file "~/.emacs.d/defalias.el")
 8: (load-file "~/.emacs.d/kbd_macro.el")
 9: (load-file "~/.emacs.d/package_init.el")
10: 
11: (custom-set-variables
12:  ;; custom-set-variables was added by Custom.
13:  ;; If you edit it by hand, you could mess it up, so be careful.
14:  ;; Your init file should contain only one such instance.
15:  ;; If there is more than one, they won't work right.
16:  '(ac-ispell-fuzzy-limit 4)
17:  '(ac-ispell-requires 4)
18:  '(custom-enabled-themes (quote (tango-dark))))

Few months back

 1: ;;; general_config.el
 2: 
 3: (setq debug-on-error t)
 4: 
 5: ;; Personal info
 6: (setq user-full-name "Sachin"
 7:       user-mail-address "psachin@redhat.com")
 8: 
 9: ;; start emacs server
10: (require 'server)
11: (unless (server-running-p)
12:   (server-start))

Few months back

 1: ;;; install_packages.el
 2: 
 3: (require 'package)
 4: 
 5: (add-to-list 'package-archives
 6:              '("marmalade" . "http://marmalade-repo.org/packages/"))
 7: (add-to-list 'package-archives
 8:          '("melpa-stable" . "http://stable.melpa.org/packages/") t)
 9: 
10: (package-initialize)
11: 
12: (when (not package-archive-contents)
13:   (package-refresh-contents))
14: 
15: ;; Add your package here
16: (defvar package-list '(ac-ispell
17:                        autopair
18:                        company))

Few months back

 1: ;;; package_init.el
 2: 
 3: (yas-global-mode t)
 4: (setq yas-snippet-dirs "~/.emacs.d/snippets/")
 5: 
 6: ;; hidepw
 7: (add-to-list 'load-path "~/.emacs.d/extensions/hidepw/")
 8: (require 'hidepw)
 9: 
10: (add-to-list 'auto-mode-alist
11:              '("\\.gpg\\'" . (lambda () (hidepw-mode))))

Few months back

1: ;;; keyboard.el
2: 
3: ;; Manage window size
4: (global-set-key (kbd "<C-up>") 'enlarge-window)
5: (global-set-key (kbd "<C-down>") 'shrink-window)
6: (global-set-key (kbd "<C-left>") 'shrink-window-horizontally)
7: (global-set-key (kbd "<C-right>") 'enlarge-window-horizontall)

Problem?

  • Hard to manage
  • Lot of manual work
  • Not re-usable
  • Load time

My current configuration

 1: ;;; init.el
 2: 
 3: (require 'package)
 4: (add-to-list 'package-archives
 5:              '("gnu" . "http://elpa.gnu.org/packages/"))
 6: (add-to-list 'package-archives
 7:              '("marmalade" . "http://marmalade-repo.org/packages/"))
 8: (add-to-list 'package-archives
 9:              '("melpa-stable" . "http://stable.melpa.org/packages/"))
10: (package-initialize)
11: 
12: (unless (package-installed-p 'use-package)
13:   (package-refresh-contents)
14:   (package-install 'use-package))
15: 
16: ;; From use-package Readme
17: (eval-when-compile
18:   (require 'use-package))
19: (require 'diminish)                ;; if you use :diminish
20: (require 'bind-key)                ;; if you use any :bind variant
21: 
22: ;; Load ReadMe.org - My Emacs configuration
23: (org-babel-load-file (concat user-emacs-directory "ReadMe.org"))

ReadMe.org

 1: * Emacs configuration
 2: ** Usage
 3: ** Contribute
 4: ** Gnus
 5: ** Minimal config
 6: ** General configuration
 7: ** Latex
 8: ** Alias
 9: ** Packages
10: ** Keyboard config
11: ** Custom Function
12: ** Beta

Happy Emacs config :)

  • Neat and tidy configuration
  • Literal programing
  • Easy to share
  • Faster load time(~0.94 seconds)

Question

Thank you

https://github.com/psachin/.emacs.d

psachin@redhat.com

Made with Love & GNU Emacs