Reduce init load time to 2.6 sec

This commit is contained in:
Marcus Kammer 2022-05-06 19:31:15 +02:00
parent 9175aebc19
commit fb4c82920f
Signed by: marcuskammer
GPG key ID: C374817BE285268F
17 changed files with 157 additions and 292 deletions

View file

@ -1,9 +0,0 @@
(use-package all-the-icons
:if (display-graphic-p)
:commands all-the-icons-install-fonts
:init
(unless (find-font (font-spec :name "all-the-icons"))
(all-the-icons-install-fonts t)))
(use-package all-the-icons-dired
:if (display-graphic-p)
:hook (dired-mode . all-the-icons-dired-mode))

View file

@ -9,16 +9,10 @@
;; (add-to-list 'exec-path "C:/msys64/usr/bin") ;; (add-to-list 'exec-path "C:/msys64/usr/bin")
;; (setenv "PATH" (concat "C:\\msys64\\mingw64\\bin;" (getenv "PATH"))) ;; (setenv "PATH" (concat "C:\\msys64\\mingw64\\bin;" (getenv "PATH")))
(setq sql-sqlite-program "c:/msys64/mingw64/bin/sqlite3.exe" (setq
ispell-program-name "c:/msys64/mingw64/bin/aspell.exe" ispell-program-name "c:/msys64/mingw64/bin/aspell.exe"
nov-unzip-program "c:/msys64/usr/bin/unzip.exe"
custom-file "~/.emacs.d/bundle/custom_win32.el" custom-file "~/.emacs.d/bundle/custom_win32.el"
org-babel-python-command "python" org-babel-python-command "python")
geiser-racket-binary "c:/Program Files/Racket/Racket.exe"
sbcl-exe (expand-file-name "C:\\Program Files\\Steel Bank Common Lisp\\sbcl.exe")
sbcl-core (expand-file-name "C:\\Program Files\\Steel Bank Common Lisp\\sbcl.core")
inferior-lisp-program "sbcl"
slime-lisp-implementations `((sbcl (,sbcl-exe "--core" ,sbcl-core))))
(use-package powershell) (use-package powershell)

View file

@ -102,5 +102,6 @@
(width . 92) (width . 92)
(height . 62) (height . 62)
(alpha . 100) (alpha . 100)
(fullscreen . maximized)
(horizontal-scroll-bars) (horizontal-scroll-bars)
(vertical-scroll-bars))) (vertical-scroll-bars)))

View file

@ -1,4 +0,0 @@
(use-package doom-themes
:init (load-theme 'doom-nord t))
(use-package doom-modeline
:init (doom-modeline-mode 1))

View file

@ -1,51 +1,43 @@
;; (use-package counsel (use-package all-the-icons
;; :bind (("C-M-j" . 'counsel-switch-buffer) :if (display-graphic-p)
;; :map minibuffer-local-map :commands all-the-icons-install-fonts
;; ("C-r" . 'counsel-minibuffer-history)) :init
;; :custom (unless (find-font (font-spec :name "all-the-icons"))
;; (counsel-linux-app-format-function #'counsel-linux-app-format-function-name-only) (all-the-icons-install-fonts t)))
;; :config (use-package all-the-icons-dired
;; (counsel-mode 1)) :if (display-graphic-p)
:hook (dired-mode . all-the-icons-dired-mode))
;; (use-package ivy (use-package doom-themes
;; :bind (("C-s" . swiper)) :if (display-graphic-p)
;; :init :init (load-theme 'doom-nord t))
;; (ivy-mode 1)) (use-package doom-modeline
:if (display-graphic-p)
;; (use-package unicode-fonts :init (doom-modeline-mode 1)
;; :config :custom (doom-modeline-height 33))
;; (unicode-fonts-setup)) (use-package helpful
:commands (helpful-callable helpful-variable helpful-command helpful-key)
(load "bundle--all-the-icons") :bind
(load "bundle--olivetti") ([remap describe-command] . helpful-command)
(load "bundle--shrface") ([remap describe-key] . helpful-key))
(load "bundle--doom")
(load "bundle--helpful")
(load "bundle--webjump")
(use-package ace-window)
(use-package rainbow-delimiters (use-package rainbow-delimiters
:hook (prog-mode . rainbow-delimiters-mode)) :hook (prog-mode . rainbow-delimiters-mode))
(use-package olivetti
:init (add-hook 'Info-mode-hook (lambda () (olivetti-mode) (setq olivetti-body-width 89)))
:custom (olivetti-body-width 84)
:bind ("<f6>" . olivetti-mode))
(use-package ace-window
:init (global-set-key (kbd "M-o") 'ace-window))
(use-package emojify (use-package emojify
:commands emojify-mode) :commands emojify-mode)
(use-package smartparens) (use-package smartparens)
(use-package vertico (use-package vertico
:init :init
(vertico-mode) (vertico-mode))
(use-package webjump
;; Different scroll margin :bind ("C-c j" . webjump)
;; (setq vertico-scroll-margin 0) :custom
(webjump-sites
;; Show more candidates (append '(("Wikipedia_de" . [simple-query
;; (setq vertico-count 20) "de.wikipedia.org"
"https://de.wikipedia.org/wiki/" ""]))
;; Grow and shrink the Vertico minibuffer webjump-sample-sites)))
;; (setq vertico-resize t)
;; Optionally enable cycling for `vertico-next' and `vertico-previous'.
;; (setq vertico-cycle t)
)

View file

@ -1,5 +0,0 @@
(use-package helpful
:commands (helpful-callable helpful-variable helpful-command helpful-key)
:bind
([remap describe-command] . helpful-command)
([remap describe-key] . helpful-key))

View file

@ -1,4 +1,5 @@
(use-package erc (use-package erc
:defer t
:hook (erc-mode . emojify-mode) :hook (erc-mode . emojify-mode)
:custom :custom
(erc-track-shorten-start 8) (erc-track-shorten-start 8)

View file

@ -1,20 +0,0 @@
(use-package magit)
(global-set-key (kbd "C-x g") 'magit-status)
(global-set-key (kbd "C-x M-g") 'magit-dispatch)
(defun jnf/magit-browse-pull-request ()
"In `magit-log-mode', open the associated pull request at point."
(interactive)
(let* ((remote-url
(car
(git-link--exec "remote" "get-url"
(format "%s" (magit-get-current-remote)))))
(beg (line-beginning-position))
(end (line-end-position))
(region (buffer-substring-no-properties beg end)))
(save-match-data
(and (string-match "(\\#\\([0-9]+\\))$" region)
(browse-url-default-macosx-browser
(concat
(s-replace ".git" "" remote-url)
"/pull/"
(match-string 1 region)))))))

View file

@ -1,4 +1,5 @@
(use-package eww (use-package eww
:defer t
:init :init
(add-hook 'eww-after-render-hook #'shrface-mode) (add-hook 'eww-after-render-hook #'shrface-mode)
:config :config
@ -69,6 +70,7 @@
(use-package gnus (use-package gnus
:ensure nil :ensure nil
:defer t
:hook (gnus-summary-prepare . gnus-summary-sort-by-most-recent-date) :hook (gnus-summary-prepare . gnus-summary-sort-by-most-recent-date)
:custom :custom
(user-full-name "Marcus Kammer") (user-full-name "Marcus Kammer")

View file

@ -1,4 +0,0 @@
(use-package olivetti
:init (add-hook 'Info-mode-hook (lambda () (olivetti-mode) (setq olivetti-body-width 89)))
:custom (olivetti-body-width 84)
:bind ("<f6>" . olivetti-mode))

View file

@ -1,10 +1,3 @@
(use-package ob-go)
(use-package ob-http)
(use-package ob-rust)
(use-package ob-typescript)
(use-package ox-reveal)
(use-package org (use-package org
:ensure nil :ensure nil
:hook (org-mode . turn-on-auto-fill) :hook (org-mode . turn-on-auto-fill)
@ -95,18 +88,6 @@
(org-src-fontify-natively t) (org-src-fontify-natively t)
(org-src-tab-acts-natively t) (org-src-tab-acts-natively t)
(org-src-window-setup 'other-window) (org-src-window-setup 'other-window)
(org-src-lang-modes
'(("bash" . sh)
("elisp" . emacs-lisp)
("beamer" . latex)
("calc" . fundamental)
("dot" . fundamental)
("screen" . shell-script)
("shell" . sh)
("C" . c)
("sqlite" . sql)
("scheme" . racket)
("plantuml" . plantuml)))
(org-time-stamp-rounding-minutes '(30 30)) (org-time-stamp-rounding-minutes '(30 30))
(org-todo-keywords (org-todo-keywords
'((sequence "TODO" "DOING(!)" "DONE(!)") '((sequence "TODO" "DOING(!)" "DONE(!)")
@ -126,38 +107,9 @@
(sqlite . t) (sqlite . t)
(shell . t) (shell . t)
(plantuml . t) (plantuml . t)
(typescript . t) (scheme . t)))
(scheme . t) ;; work with org-agenda dispatcher [c] "Today Clocked Tasks" to view today's clocked tasks.
(http . t)))) (defun org-agenda-log-mode-colorize-block ()
;; (use-package org-roam
;; :init
;; (setq org-roam-v2-ack t)
;; (setq org-roam-db-location "~/org-roam.db")
;; (require 'org-roam-dailies)
;; :bind (("C-c r l" . org-roam-buffer-toggle)
;; ("C-c r f" . org-roam-node-find)
;; ("C-c r g" . org-roam-graph)
;; ("C-c r i" . org-roam-node-insert)
;; ("C-c r c" . org-roam-capture)
;; ("C-c r j" . org-roam-dailies-map)
;; :map org-roam-dailies-map
;; ("t" . org-roam-dailies-capture-today)
;; ("y" . org-roam-dailies-capture-yesterday)
;; ("T" . org-roam-dailies-capture-tomorrow)
;; :map org-mode-map
;; ("C-M-i" . completion-at-point)))
(use-package org-tree-slide
:bind ("<f5>" . org-tree-slide-mode)
:custom
(org-image-actual-width nil))
(use-package org-web-tools
:custom (org-web-tools-pandoc-sleep-time 0.4))
;; work with org-agenda dispatcher [c] "Today Clocked Tasks" to view today's clocked tasks.
(defun org-agenda-log-mode-colorize-block ()
"Set different line spacing based on clock time duration." "Set different line spacing based on clock time duration."
(save-excursion (save-excursion
(let* ((colors (cl-case (alist-get 'background-mode (frame-parameters)) (let* ((colors (cl-case (alist-get 'background-mode (frame-parameters))
@ -178,31 +130,50 @@
(setq colors (cdr colors)) (setq colors (cdr colors))
(overlay-put ov 'line-height line-height) (overlay-put ov 'line-height line-height)
(overlay-put ov 'line-spacing (1- line-height)))))))) (overlay-put ov 'line-spacing (1- line-height))))))))
(add-hook 'org-agenda-finalize-hook #'org-agenda-log-mode-colorize-block))
(add-hook 'org-agenda-finalize-hook #'org-agenda-log-mode-colorize-block) (use-package org-roam
:defer t
:after org
:init
(setq org-roam-v2-ack t)
(setq org-roam-db-location "~/org-roam.db")
(require 'org-roam-dailies)
:bind (("C-c r l" . org-roam-buffer-toggle)
("C-c r f" . org-roam-node-find)
("C-c r g" . org-roam-graph)
("C-c r i" . org-roam-node-insert)
("C-c r c" . org-roam-capture)
("C-c r j" . org-roam-dailies-map)
:map org-roam-dailies-map
("t" . org-roam-dailies-capture-today)
("y" . org-roam-dailies-capture-yesterday)
("T" . org-roam-dailies-capture-tomorrow)
:map org-mode-map
("C-M-i" . completion-at-point)))
(defun me/org-copy-subtree-contents () (use-package org-tree-slide
"Get the content text of the subtree at point and add it to the `kill-ring'. :bind ("<f5>" . org-tree-slide-mode)
Excludes the heading and any child subtrees." :custom
(interactive) (org-image-actual-width nil))
(if (org-before-first-heading-p)
(message "Not in or on an org heading")
(save-excursion
;; If inside heading contents, move the point back to the heading
;; otherwise `org-agenda-get-some-entry-text' won't work.
(unless (org-on-heading-p) (org-previous-visible-heading 1))
(let ((contents (substring-no-properties
(org-agenda-get-some-entry-text
(point-marker)
most-positive-fixnum))))
(message "Copied: %s" contents)
(kill-new contents)))))
(defun me/write-readme-md-on-save () (use-package org-web-tools
;; when README.org, also write README.md on save :defer t
(when (string-match "README" (buffer-file-name)) :custom (org-web-tools-pandoc-sleep-time 0.4))
(make-local-variable 'after-save-hook)
(add-hook 'after-save-hook (use-package ob-go
(lambda () (let ((outfile (org-export-output-file-name ".md"))) :defer t
(org-export-to-file 'md outfile)))))) :after org)
(use-package ox-reveal
:defer t
:after org)
;; (defun me/write-readme-md-on-save ()
;; ;; when README.org, also write README.md on save
;; (when (string-match "README" (buffer-file-name))
;; (make-local-variable 'after-save-hook)
;; (add-hook 'after-save-hook
;; (lambda () (let ((outfile (org-export-output-file-name ".md")))
;; (org-export-to-file 'md outfile))))))
;; (add-hook 'org-mode-hook 'me/write-readme-md-on-save) ;; (add-hook 'org-mode-hook 'me/write-readme-md-on-save)

View file

@ -16,17 +16,7 @@
(require 'use-package) (require 'use-package)
(setq use-package-always-ensure t) (setq use-package-always-ensure t)
;; ADDTIONAL MODES (load "bundle--gui")
(use-package flyspell
:config
;;(add-hook 'text-mode-hook #'flyspell-mode)
;;(add-hook 'prog-mode-hook #'flyspell-prog-mode)
(setq ispell-dictionary "en_US"))
;; :hook (text-mode . flyspell-mode))
;; (use-package company
;; :init
;; (global-company-mode))
(use-package nov (use-package nov
:hook (nov-mode . olivetti-mode) :hook (nov-mode . olivetti-mode)
@ -38,31 +28,12 @@
(setq nov-shr-rendering-functions '((img . nov-render-img) (title . nov-render-title))) (setq nov-shr-rendering-functions '((img . nov-render-img) (title . nov-render-title)))
(setq nov-shr-rendering-functions (append nov-shr-rendering-functions shr-external-rendering-functions)) (setq nov-shr-rendering-functions (append nov-shr-rendering-functions shr-external-rendering-functions))
(setq nov-text-width nil (setq nov-text-width nil
nov-variable-pitch nil)) nov-variable-pitch nil)
(when (eq system-type 'windows-nt)
(setq nov-unzip-program "c:/msys64/usr/bin/unzip.exe")))
;; (use-package projectile
;; :init
;; (projectile-mode +1)
;; :config
;; (setq projectile-completion-system (quote ivy)))
;; (define-key projectile-mode-map (kbd "s-p") 'projectile-command-map)
;; (define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map)
;; (use-package elpy
;; :config (setq elpy-modules
;; '(elpy-module-autodoc
;; elpy-module-company
;; elpy-module-eldoc
;; elpy-module-pyvenv
;; elpy-module-yasnippet)
;; elpy-test-pytest-runner-command '("pytest")))
;; (use-package pyvenv
;; :init (pyvenv-mode 1))
;; LANGUAGE MODES
(use-package eglot (use-package eglot
:defer t
:config :config
(add-to-list 'eglot-server-programs '((c++-mode c-mode) "ccls"))) (add-to-list 'eglot-server-programs '((c++-mode c-mode) "ccls")))
@ -88,9 +59,7 @@
(string-match "/usr/src/linux" (buffer-file-name))) (string-match "/usr/src/linux" (buffer-file-name)))
"linux" "linux"
"gnu"))) "gnu")))
(add-hook 'c-mode-common-hook 'me/c-mode-style-hook) (add-hook 'c-mode-common-hook 'me/c-mode-style-hook)
(defun me/c-mode-compile-command-hook () (defun me/c-mode-compile-command-hook ()
;; if no makefile use gcc for compile command ;; if no makefile use gcc for compile command
(unless (or (file-exists-p "makefile") (unless (or (file-exists-p "makefile")
@ -98,49 +67,36 @@
(set (make-local-variable 'compile-command) (set (make-local-variable 'compile-command)
(concat "gcc " "-Wall " "-g " buffer-file-name " -o " (concat "gcc " "-Wall " "-g " buffer-file-name " -o "
(file-name-sans-extension buffer-file-name))))) (file-name-sans-extension buffer-file-name)))))
(add-hook 'c-mode-common-hook 'me/c-mode-compile-command-hook) (add-hook 'c-mode-common-hook 'me/c-mode-compile-command-hook)
(defun me/c-mode-compile-on-save () (defun me/c-mode-compile-on-save ()
;; compile on save hook ;; compile on save hook
(make-local-variable 'after-save-hook) (make-local-variable 'after-save-hook)
(add-hook 'after-save-hook (lambda () (compile compile-command)))) (add-hook 'after-save-hook (lambda () (compile compile-command))))
(add-hook 'c-mode-common-hook 'me/c-mode-compile-on-save)) (add-hook 'c-mode-common-hook 'me/c-mode-compile-on-save))
(use-package js-mode (use-package js-mode
:ensure nil :ensure nil
:hook (js-mode . eglot-ensure) :hook (js-mode . eglot-ensure)
:mode ("\\.webmanifest\\'" . js-mode)) :mode "\\.webmanifest\\'")
(use-package go-mode (use-package go-mode
:mode ("\\.go\\'" . go-mode)
:config :config
(add-hook 'before-save-hook #'gofmt-before-save) (add-hook 'before-save-hook #'gofmt-before-save)
(add-hook 'go-mode-hook 'eglot-ensure) (add-hook 'go-mode-hook 'eglot-ensure)
(defun me/go-mode-compile-command-hook () (defun me/go-mode-compile-command-hook ()
;; if no makefile use go build for compile command ;; if no makefile use go build for compile command
(unless (or (file-exists-p "makefile") (unless (or (file-exists-p "makefile")
(file-exists-p "Makefile")) (file-exists-p "Makefile"))
(set (make-local-variable 'compile-command) (set (make-local-variable 'compile-command)
(concat "go " "vet " buffer-file-name)))) (concat "go " "vet " buffer-file-name))))
(add-hook 'go-mode-hook 'me/go-mode-compile-command-hook) (add-hook 'go-mode-hook 'me/go-mode-compile-command-hook)
(defun me/go-mode-compile-on-save () (defun me/go-mode-compile-on-save ()
;; compile on save hook ;; compile on save hook
(make-local-variable 'after-save-hook) (make-local-variable 'after-save-hook)
(add-hook 'after-save-hook (lambda () (compile compile-command)))) (add-hook 'after-save-hook (lambda () (compile compile-command))))
(add-hook 'go-mode-hook 'me/go-mode-compile-on-save)) (add-hook 'go-mode-hook 'me/go-mode-compile-on-save))
(use-package rust-mode
:hook (rust . eglot-ensure))
(use-package typescript-mode
:config
(add-hook 'typescript-mode-hook 'eglot-ensure))
(use-package web-mode (use-package web-mode
;; :hook html-mode ;; :hook html-mode
:mode (("\\.html?\\'" . web-mode) :mode (("\\.html?\\'" . web-mode)
@ -154,13 +110,12 @@
(web-mode-enable-current-element-highlight t) (web-mode-enable-current-element-highlight t)
(web-mode-enable-current-column-highlight t)) (web-mode-enable-current-column-highlight t))
(use-package yaml) (use-package racket-mode
:init (require 'smartparens-config)
(use-package yaml-mode) :mode ("\\.rkt\\'" . racket-mode)
:config
(use-package racket-mode) (when (eq system-type 'windows-nt)
(setq geiser-racket-binary "c:/Program Files/Racket/Racket.exe")))
(use-package markdown-mode)
(use-package python (use-package python
:mode (("\\.py\\'" . python-mode) :mode (("\\.py\\'" . python-mode)
@ -174,14 +129,8 @@
:config :config
(add-hook 'python-mode-hook 'eglot-ensure)) (add-hook 'python-mode-hook 'eglot-ensure))
(use-package csv-mode
:mode ("\\.[Cc][Ss][Vv]\\'" . csv-mode))
(use-package plantuml-mode
:mode "\\.puml?\\'")
;; TOOLS MODE
(use-package slime (use-package slime
:defer t
:custom :custom
(slime-autodoc-use-multiline-p 1) (slime-autodoc-use-multiline-p 1)
:config :config
@ -191,31 +140,18 @@
slime-asdf slime-asdf
slime-indentation slime-indentation
slime-editing-commands slime-editing-commands
slime-sbcl-exts))) slime-sbcl-exts))
(when (eq system-type 'windows-nt)
(setq sbcl-exe (expand-file-name "C:\\Program Files\\Steel Bank Common Lisp\\sbcl.exe")
sbcl-core (expand-file-name "C:\\Program Files\\Steel Bank Common Lisp\\sbcl.core")
inferior-lisp-program "sbcl"
slime-lisp-implementations `((sbcl (,sbcl-exe "--core" ,sbcl-core))))))
(use-package webpaste) (use-package simple-httpd
:defer t)
;; (use-package slime-company
;; :after (slime company)
;; :custom (slime-company-after-completion 'slime-company-just-one-space))
;; (use-package pyvenv)
(use-package simple-httpd)
(use-package elpher)
(load "bundle--gui")
(load "bundle--org")
(load "bundle--magit")
(load "bundle--irc")
(load "bundle--news")
(load "bundle--scheme")
;; (use-package clojure-mode)
;; (use-package cider)
(use-package go-translate (use-package go-translate
:defer t
:config :config
(setq gts-translate-list '(("en" "de"))) (setq gts-translate-list '(("en" "de")))
(setq gts-default-translator (setq gts-default-translator
@ -223,3 +159,27 @@
:picker (gts-prompt-picker) :picker (gts-prompt-picker)
:engines (list (gts-google-engine) (gts-google-rpc-engine)) :engines (list (gts-google-engine) (gts-google-rpc-engine))
:render (gts-buffer-render)))) :render (gts-buffer-render))))
(use-package sql
:ensure nil
:defer t
:config
(when (eq system-type 'windows-nt)
(setq sql-sqlite-program "c:/msys64/mingw64/bin/sqlite3.exe")))
(use-package magit
:bind ("C-x g" . magit-status)
:config
(global-set-key (kbd "C-x M-g") 'magit-dispatch))
(use-package geiser
:defer t
:config
(setq geiser-active-implementations '(racket)))
(use-package geiser-racket
:defer t
:after geiser)
(load "bundle--irc")
(load "bundle--news")

View file

@ -1,4 +0,0 @@
(use-package geiser
:config
(setq geiser-active-implementations '(racket)))
(use-package geiser-racket)

View file

@ -1,6 +1,4 @@
(use-package shrface (use-package shrface
:init
(global-set-key (kbd "M-o") 'ace-window)
:config :config
(shrface-basic) (shrface-basic)
(shrface-trial) (shrface-trial)

View file

@ -1,8 +0,0 @@
(use-package webjump
:bind ("C-c j" . webjump)
:custom
(webjump-sites
(append '(("Wikipedia_de" . [simple-query
"de.wikipedia.org"
"https://de.wikipedia.org/wiki/" ""]))
webjump-sample-sites)))

View file

@ -20,7 +20,6 @@
(fullscreen . fullscreen))) (fullscreen . fullscreen)))
'(delete-selection-mode nil) '(delete-selection-mode nil)
'(diary-file "~/Documents/diary/diary") '(diary-file "~/Documents/diary/diary")
'(doom-modeline-height 33)
'(gnus-init-file "~/.emacs.d/.gnus.el") '(gnus-init-file "~/.emacs.d/.gnus.el")
'(hl-paren-colors '("#B9F" "#B8D" "#B7B" "#B69" "#B57" "#B45" "#B33" "#B11")) '(hl-paren-colors '("#B9F" "#B8D" "#B7B" "#B69" "#B57" "#B45" "#B33" "#B11"))
'(hl-todo-keyword-faces '(hl-todo-keyword-faces

View file

@ -1,9 +1,10 @@
(add-to-list 'load-path (expand-file-name "~/.emacs.d/bundle/")) (add-to-list 'load-path (expand-file-name "~/.emacs.d/bundle/"))
(load "bundle--defaults") (load "bundle--defaults")
(load "bundle--server")
(load "bundle--package")
(load "bundle--customfile")
(load "bundle--encoding") (load "bundle--encoding")
(load "bundle--holidays") (load "bundle--holidays")
(load "bundle--server")
(load "bundle--package")
(load "bundle--org")
(load "bundle--customfile")
(load "bundle--latex") (load "bundle--latex")
(load "bundle--mk") (load "bundle--mk")