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.

86 lines
2.8 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-14")))
  8. (setq 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. ;; Turn off the menus, scrollbars, and toolbars
  13. (menu-bar-mode 0)
  14. (scroll-bar-mode 0)
  15. (tool-bar-mode 0)
  16. (horizontal-scroll-bar-mode 0)
  17. ;; Revert to file on disk if it changes
  18. (global-auto-revert-mode t)
  19. ;; Highlight the current line
  20. (when window-system (global-hl-line-mode t))
  21. ;; Global line numbering
  22. (global-linum-mode 0)
  23. ;; Show the column number after the line number (i.e. 50:57)
  24. (column-number-mode t)
  25. ;; C-c <left>|<right> to undo|redo window changes like adding buffers.
  26. (winner-mode t)
  27. ;; Show matching paren
  28. (show-paren-mode t)
  29. ;; Pretty Symbols
  30. (when window-system (global-prettify-symbols-mode t))
  31. ;; Meta-b better defaults testStringHereToTestBelow_Setting
  32. (global-subword-mode 1)
  33. ;; Indent w/spaces only
  34. (setq indent-tabs-mode nil)
  35. (setq-default indent-tabs-mode nil)
  36. ;; Prevent stale elisp bytecode
  37. (setq load-prefer-newer t)
  38. ;; Add newline on save
  39. (setq require-final-newline t)
  40. ;; C-c to copy in Linux can be pasted in emacs
  41. (setq select-enable-clipboard t)
  42. ;; after mouse selection can be pasted in emacs
  43. (setq select-enable-primary t)
  44. ;; Paste at current point, not mouse location when "middle-clicking"
  45. (setq mouse-yank-at-point t)
  46. (add-hook 'before-save-hook 'delete-trailing-whitespace)
  47. ;; Set auth source
  48. ;; (setq auth-sources '("~/.authinfo.gpg"))
  49. ;; Set window location/size
  50. (if (eq system-type 'darwin)
  51. (progn
  52. (set-frame-position (selected-frame) 950 906)
  53. (set-frame-height (selected-frame) 60)
  54. (set-frame-width (selected-frame) 220))
  55. (message "Don't configure location for other OSes"))
  56. (defalias 'yes-or-no-p 'y-or-n-p)
  57. (defvar browse-url-generic-program)
  58. (defvar engine/browser-function)
  59. ;; (setq ; browse-url-generic-program "/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome"
  60. ;; browse-url-browser-function 'browse-url-generic)
  61. (setq browse-url-browser-function 'browse-url-generic
  62. engine/browser-function 'browse-url-generic
  63. ;; Chrome because Firefox will complain that a copy is already open.
  64. browse-url-generic-program "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome")
  65. (defun display-startup-echo-area-message ()
  66. "Display startup echo area message."
  67. (message "Initialized in %s" (emacs-init-time)))
  68. (provide '04-custom-init)
  69. ;;; 04-custom-init.el ends here