My attempt to optimize my emacs load time <1 second
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

92 lines
3.1 KiB

5 years ago
5 years ago
5 years ago
5 years ago
  1. ;;; 04-custom-init --- Provide custom basic init for emacs
  2. ;;; Commentary:
  3. ;;; Code:
  4. (defvar backup-dir (expand-file-name "~/.emacs.d/backup/") "Set the default location of file backups.")
  5. ;; (defvar autosave-dir (expand-file-name "~/.emacs.d/autosave/") "Set the default location of autosaves.")
  6. (cond ((member "PragmataPro Liga" (font-family-list))
  7. (set-face-attribute 'default nil :font "PragmataPro Liga-16")))
  8. (setq-default initial-scratch-message nil
  9. backup-directory-alist (list (cons ".*" backup-dir))
  10. ;; auto-save-list-file-prefix autosave-dir
  11. ;; auto-save-file-name-transforms `((".*" ,autosave-dir t))
  12. )
  13. ;; Turn off the menus, scrollbars, and toolbars
  14. (menu-bar-mode 0)
  15. (scroll-bar-mode 0)
  16. (tool-bar-mode 0)
  17. (horizontal-scroll-bar-mode 0)
  18. ;; Revert to file on disk if it changes
  19. (global-auto-revert-mode t)
  20. ;; Highlight the current line
  21. (when window-system (global-hl-line-mode t))
  22. ;; Global line numbering
  23. (global-linum-mode 0)
  24. ;; Show the column number after the line number (i.e. 50:57)
  25. (column-number-mode t)
  26. ;; C-c <left>|<right> to undo|redo window changes like adding buffers.
  27. (winner-mode t)
  28. ;; Show matching paren
  29. (show-paren-mode t)
  30. ;; Pretty Symbols
  31. (when window-system (global-prettify-symbols-mode t))
  32. ;; Meta-b better defaults testStringHereToTestBelow_Setting
  33. (global-subword-mode 1)
  34. ;; Indent w/spaces only
  35. (setq indent-tabs-mode nil
  36. tab-width 4)
  37. (setq-default indent-tabs-mode nil
  38. tab-width 4)
  39. ;; This will expand 4 8 12 16 ... 200
  40. (setq tab-stop-list (number-sequence 4 200 4))
  41. ;; Prevent stale elisp bytecode
  42. (setq load-prefer-newer t)
  43. ;; Add newline on save
  44. (setq require-final-newline t)
  45. ;; C-c to copy in Linux can be pasted in emacs
  46. (setq select-enable-clipboard t)
  47. ;; after mouse selection can be pasted in emacs
  48. (setq select-enable-primary t)
  49. ;; Paste at current point, not mouse location when "middle-clicking"
  50. (setq mouse-yank-at-point t)
  51. (add-hook 'prog-mode-hook (lambda() (add-hook 'before-save-hook #'delete-trailing-whitespace t t)))
  52. ;; Set auth source
  53. ;; (setq auth-sources '("~/.authinfo.gpg"))
  54. ;; Set window location/size
  55. (if (eq system-type 'darwin)
  56. (progn
  57. (set-frame-position (selected-frame) 811 816)
  58. (set-frame-height (selected-frame) 55)
  59. (set-frame-width (selected-frame) 220))
  60. (message "Don't configure location for other OSes"))
  61. (defalias 'yes-or-no-p 'y-or-n-p)
  62. (defvar browse-url-generic-program)
  63. (defvar engine/browser-function)
  64. ;; (setq ; browse-url-generic-program "/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome"
  65. ;; browse-url-browser-function 'browse-url-generic)
  66. (setq browse-url-browser-function 'browse-url-generic
  67. engine/browser-function 'browse-url-generic
  68. ;; Chrome because Firefox will complain that a copy is already open.
  69. browse-url-generic-program "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome")
  70. (defun display-startup-echo-area-message ()
  71. "Display startup echo area message."
  72. (message "Initialized in %s" (emacs-init-time)))
  73. (provide '04-custom-init)
  74. ;;; 04-custom-init.el ends here