No Description

init.el 4.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. ;; -*- lexical-binding: t; -*-
  2. ;;; init.el --- emacs initialisation file
  3. ;; Author: Inderjit Gill <email@indy.io>
  4. ;; This file is free software; you can redistribute it and/or modify
  5. ;; it under the terms of the GNU General Public License as published by
  6. ;; the Free Software Foundation; either version 3, or (at your option)
  7. ;; any later version.
  8. ;; This program is distributed in the hope that it will be useful,
  9. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. ;; GNU General Public License for more details.
  12. ;; For a full copy of the GNU General Public License
  13. ;; see <http://www.gnu.org/licenses/>.
  14. ;;; Commentary:
  15. ;;
  16. ;; This is my init file (and all of this preamble is here just to stop
  17. ;; FlyCheck from complaining).
  18. ;;; Code:
  19. (defvar isg--timing-hash (make-hash-table :test 'equal))
  20. ;; here's the most recent package-selected-packages list which should be copied into isg-custom.el:
  21. ;;
  22. ;; (package-selected-packages
  23. ;; (quote
  24. ;; (ag avy cargo cmake-mode color-theme color-theme-sanityinc-solarized company company-racer counsel csharp-mode deft delight edit-server esh-autosuggest exec-path-from-shell find-file-in-git-repo flycheck flycheck-rust glsl-mode go-mode gruvbox-theme hindent htmlize hydra interleave ivy ivy-rich js-comint js2-mode magit markdown-mode olivetti org org-brain org-bullets org-gcal racer racket-mode rainbow-mode rjsx-mode rust-mode shader-mode smartparens smartparens-rust spacemacs-theme swiper toml-mode undo-tree use-package volatile-highlights web-mode wgrep which-key winum ws-butler yaml-mode)))
  25. ;; this is set to a lower threshold at the end of loading the emacs config
  26. (setq gc-cons-threshold 402653184
  27. gc-cons-percentage 0.6)
  28. (defvar isg--file-name-handler-alist file-name-handler-alist)
  29. (setq file-name-handler-alist nil)
  30. (defun isg--time-section-start (key)
  31. (puthash key (float-time) isg--timing-hash))
  32. (defun isg--time-section-stop (key)
  33. (if (gethash key isg--timing-hash)
  34. (puthash key (- (float-time)
  35. (gethash key isg--timing-hash))
  36. isg--timing-hash)))
  37. (defmacro isg--timer (key &rest body)
  38. `(progn
  39. (isg--time-section-start ,key)
  40. ,@body
  41. (isg--time-section-stop ,key)))
  42. (defun isg--time-show-slower-than (min)
  43. (progn
  44. (message "________________________START TIMES________________________")
  45. (maphash (lambda (k _v) (if (> _v min) (message "%.3f: %s" _v k))) isg--timing-hash)
  46. (message "___________________________________________________________")
  47. nil))
  48. (isg--time-section-start "overall")
  49. ;; Added by Package.el. This must come before configurations of
  50. ;; installed packages. Don't delete this line. If you don't want it,
  51. ;; just comment it out by adding a semicolon to the start of the line.
  52. ;; You may delete these explanatory comments.
  53. (package-initialize)
  54. (isg--timer "package"
  55. (eval-when-compile
  56. (require 'use-package))
  57. (setq package-enable-at-startup nil)
  58. (setcdr (last package-archives)
  59. '(("melpa-stable" . "https://stable.melpa.org/packages/")
  60. ("melpa" . "https://melpa.org/packages/")
  61. ("org" . "https://orgmode.org/elpa/")))
  62. (setq package-check-signature nil)
  63. (unless (package-installed-p 'use-package)
  64. ;; check for new packages (package versions)
  65. (message "%s" "Emacs Prelude is now refreshing its package database...")
  66. (package-refresh-contents)
  67. (message "%s" " done.")
  68. (package-install 'use-package)))
  69. ;; after use-package-always-ensure is set, all subsequent use-package
  70. ;; statements will download packages if needed
  71. (setq use-package-always-ensure t)
  72. (setq use-package-verbose t)
  73. (require 'cl)
  74. ; third party code that isn't in melpa-stable yet
  75. (push "~/.emacs.d/external" load-path)
  76. (push "~/.emacs.d/external/org-drill" load-path)
  77. (if (file-exists-p (expand-file-name "~/.emacs.d/isg-init.el"))
  78. (isg--timer "load isg-init.el"
  79. (load "~/.emacs.d/isg-init.el"))
  80. (isg--timer "load isg-init.org"
  81. (org-babel-load-file (expand-file-name "~/.emacs.d/isg-init.org"))))
  82. (isg--timer "custom-file"
  83. (setq custom-file "~/.emacs.d/isg-custom.el")
  84. (load custom-file))
  85. (isg--time-section-stop "overall")
  86. ;; show slowest sections in the *Messages* buffer
  87. (isg--time-show-slower-than 0.00009) ; 0.09
  88. (add-hook 'emacs-startup-hook (lambda ()
  89. (setq gc-cons-threshold 16777216
  90. gc-cons-percentage 0.1
  91. file-name-handler-alist isg--file-name-handler-alist)))
  92. (provide 'init)