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.

84 lines
2.7 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. inhibit-startup-screen t
  11. ;; auto-save-list-file-prefix autosave-dir
  12. ;; auto-save-file-name-transforms `((".*" ,autosave-dir t))
  13. )
  14. ;; Turn off the menus, scrollbars, and toolbars
  15. (menu-bar-mode 0)
  16. (scroll-bar-mode 0)
  17. (tool-bar-mode 0)
  18. (horizontal-scroll-bar-mode 0)
  19. ;; Revert to file on disk if it changes
  20. (global-auto-revert-mode t)
  21. ;; Highlight the current line
  22. (when window-system (global-hl-line-mode t))
  23. ;; Global line numbering
  24. (global-linum-mode 0)
  25. ;; Show the column number after the line number (i.e. 50:57)
  26. (column-number-mode t)
  27. ;; C-c <left>|<right> to undo|redo window changes like adding buffers.
  28. (winner-mode t)
  29. ;; Show matching paren
  30. (show-paren-mode t)
  31. ;; Pretty Symbols
  32. (when window-system (global-prettify-symbols-mode t))
  33. ;; Meta-b better defaults testStringHereToTestBelow_Setting
  34. (global-subword-mode 1)
  35. ;; Indent w/spaces only
  36. (setq indent-tabs-mode nil
  37. tab-width 4)
  38. (setq-default indent-tabs-mode nil
  39. tab-width 4)
  40. ;; This will expand 4 8 12 16 ... 200
  41. (setq tab-stop-list (number-sequence 4 200 4))
  42. ;; Prevent stale elisp bytecode
  43. (setq load-prefer-newer t)
  44. ;; Add newline on save
  45. (setq require-final-newline t)
  46. ;; C-c to copy in Linux can be pasted in emacs
  47. (setq select-enable-clipboard t)
  48. ;; after mouse selection can be pasted in emacs
  49. (setq select-enable-primary t)
  50. ;; Paste at current point, not mouse location when "middle-clicking"
  51. (setq mouse-yank-at-point t)
  52. (add-hook 'prog-mode-hook (lambda() (add-hook 'before-save-hook #'delete-trailing-whitespace t t)))
  53. ;; Set auth source
  54. ;; (setq auth-sources '("~/.authinfo.gpg"))
  55. (setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")
  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-browser-function 'browse-url-generic
  60. browse-url-generic-program "/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"
  61. browse-url-generic-args '("--profile-directory=Default"))
  62. (defun display-startup-echo-area-message ()
  63. "Display startup echo area message."
  64. (message "Initialized in %s" (emacs-init-time)))
  65. (provide '04-custom-init)
  66. ;;; 04-custom-init.el ends here