#+title: =aminb='s Emacs Init file #+property: header-args :results silent :comments link :tangle ~/dotfiles/emacs/init.el * Intro TODO: description TODO: toc * Header ** First line #+begin_src emacs-lisp :comments none ;;; init.el --- Amin Bandali's Emacs config -*- lexical-binding: t ; eval: (view-mode 1)-*- #+end_src Enable =view-mode=, which both makes the file read-only (as a reminder that =init.el= is an auto-generated file, not supposed to be edited), and provides some convenient key bindings for browsing through the file. ** License #+begin_src emacs-lisp :comments none ;; Copyright (C) 2018 Amin Bandali ;; This program is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see . #+end_src ** Commentary #+begin_src emacs-lisp :comments none ;;; Commentary: ;; Emacs configuration of Amin Bandali, computer scientist and functional ;; programmer. ;; THIS FILE IS AUTO-GENERATED FROM `init.org'. #+end_src * Config #+begin_src emacs-lisp :comments none ;;; Code: #+end_src ** Org #+begin_src emacs-lisp (setq org-src-tab-acts-natively t org-src-preserve-indentation nil org-edit-src-content-indentation 0) #+end_src ** Startup time Measure and display startup time. Also, temporarily increase ~gc-cons-threshhold~ during startup to reduce reduce garbage collection frequency. Taken from [[https://github.com/dieggsy/dotfiles/tree/3d95bc08033920e077855caf545a975eba52d28d/emacs.d#startup-time][here]]. #+begin_src emacs-lisp (defconst aminb/emacs-start-time (current-time)) (defconst aminb/gc-cons-threshold gc-cons-threshold) (defconst aminb/gc-cons-percentage gc-cons-percentage) (defvar aminb/file-name-handler-alist file-name-handler-alist) (setq gc-cons-threshold 400000000 gc-cons-percentage 0.6 file-name-handler-alist nil ;; sidesteps a bug when profiling with esup esup-child-profile-require-level 0) #+end_src Reset the variables back to default after init. #+begin_src emacs-lisp (add-hook 'after-init-hook `(lambda () (setq gc-cons-threshold aminb/gc-cons-threshold gc-cons-percentage aminb/gc-cons-percentage file-name-handler-alist aminb/file-name-handler-alist) (let ((elapsed (float-time (time-subtract (current-time) aminb/emacs-start-time)))) (message "Loading %s...done (%.3fs) [after-init]" ,load-file-name elapsed)))) #+end_src * Footer #+begin_src emacs-lisp :comments none ;;; init.el ends here #+end_src