Browse Source

First tries to improve startup time. currently 1.05 from 1.44

master
Marc 3 years ago
parent
commit
376438b94e
1 changed files with 48 additions and 8 deletions
  1. 56
      init.org

56
init.org

@ -63,6 +63,23 @@ This function updates init.el whenever changes in init.org are made. The update
(add-hook 'after-save-hook 'me/tangle-init) (add-hook 'after-save-hook 'me/tangle-init)
#+END_SRC #+END_SRC
A small function to measure start up time.
Compare that to
emacs -q --eval='(message "%s" (emacs-init-time))'
(roughly 0.27s)
https://blog.d46.us/advanced-emacs-startup/
#+begin_src emacs-lisp
(add-hook 'emacs-startup-hook
(lambda ()
(message "Emacs ready in %s with %d garbage collections."
(format "%.2f seconds"
(float-time
(time-subtract after-init-time before-init-time)))
gcs-done)))
(setq gc-cons-threshold (* 50 1000 1000))
#+end_src
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(require 'package) (require 'package)
@ -71,8 +88,8 @@ This function updates init.el whenever changes in init.org are made. The update
(add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/") t) (add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/") t)
(add-to-list 'package-archives '("org" . "https://orgmode.org/elpa/") t) (add-to-list 'package-archives '("org" . "https://orgmode.org/elpa/") t)
(when (< emacs-major-version 27)
(package-initialize))
;(when (< emacs-major-version 27)
; (package-initialize))
#+END_SRC #+END_SRC
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
@ -80,12 +97,12 @@ This function updates init.el whenever changes in init.org are made. The update
(package-refresh-contents) (package-refresh-contents)
(package-install 'use-package)) (package-install 'use-package))
(setq use-package-verbose nil)
(eval-when-compile (eval-when-compile
(require 'use-package)) (require 'use-package))
(require 'bind-key) (require 'bind-key)
(setq use-package-verbose nil)
(use-package diminish (use-package diminish
:ensure t) :ensure t)
#+END_SRC #+END_SRC
@ -96,7 +113,6 @@ Maybe turn it on again at some point before the next major emacs upgrade
#+begin_src emacs-lisp #+begin_src emacs-lisp
(setq byte-compile-warnings '(cl-functions)) (setq byte-compile-warnings '(cl-functions))
#+end_src #+end_src
* Default settings * Default settings
:PROPERTIES: :PROPERTIES:
:ID: 3512d679-d111-4ccd-8372-6fc2acbc0374 :ID: 3512d679-d111-4ccd-8372-6fc2acbc0374
@ -346,6 +362,7 @@ Windows Theme:
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package imenu-list (use-package imenu-list
:ensure t :ensure t
:defer t
:config :config
(setq imenu-list-focus-after-activation t (setq imenu-list-focus-after-activation t
imenu-list-auto-resize t imenu-list-auto-resize t
@ -363,6 +380,7 @@ Windows Theme:
(use-package which-key (use-package which-key
:ensure t :ensure t
:diminish which-key-mode :diminish which-key-mode
:defer t
:config :config
(which-key-mode) (which-key-mode)
(which-key-setup-side-window-right-bottom) (which-key-setup-side-window-right-bottom)
@ -409,6 +427,7 @@ Windows Theme:
:ensure t :ensure t
:diminish :diminish
(ivy-mode . "") (ivy-mode . "")
:defer t
:init :init
(ivy-mode 1) (ivy-mode 1)
:bind :bind
@ -423,11 +442,13 @@ Windows Theme:
; make counsel-M-x more descriptive ; make counsel-M-x more descriptive
(use-package ivy-rich (use-package ivy-rich
:ensure t :ensure t
:defer t
:init :init
(ivy-rich-mode 1)) (ivy-rich-mode 1))
(use-package counsel (use-package counsel
:ensure t :ensure t
:defer t
:bind :bind
(("M-x" . counsel-M-x) (("M-x" . counsel-M-x)
("C-x C-f" . counsel-find-file) ("C-x C-f" . counsel-find-file)
@ -463,6 +484,7 @@ Windows Theme:
(use-package company (use-package company
:defer 1 :defer 1
:diminish :diminish
:defer t
:bind :bind
(("C-<tab>" . company-complete) (("C-<tab>" . company-complete)
:map company-active-map :map company-active-map
@ -483,6 +505,7 @@ Windows Theme:
(use-package company-statistics (use-package company-statistics
:ensure t :ensure t
:after company :after company
:defer t
:init :init
(setq company-statistics-file (concat MY--PATH_USER_LOCAL "company-statistics-cache.el"));~/.emacs.d/user-dir/company-statistics-cache.el") (setq company-statistics-file (concat MY--PATH_USER_LOCAL "company-statistics-cache.el"));~/.emacs.d/user-dir/company-statistics-cache.el")
:config :config
@ -491,12 +514,14 @@ Windows Theme:
(use-package company-dabbrev (use-package company-dabbrev
:ensure nil :ensure nil
:after company :after company
:defer t
:config :config
(setq-default company-dabbrev-downcase nil)) (setq-default company-dabbrev-downcase nil))
(use-package company-box (use-package company-box
:ensure t :ensure t
:diminish :diminish
:defer t
:init :init
(add-hook 'company-mode-hook 'company-box-mode)) (add-hook 'company-mode-hook 'company-box-mode))
#+END_SRC #+END_SRC
@ -532,6 +557,7 @@ Windows Theme:
:ensure org-plus-contrib :ensure org-plus-contrib
:mode (("\.org$" . org-mode)) :mode (("\.org$" . org-mode))
:diminish org-indent-mode :diminish org-indent-mode
:defer t
:init :init
(add-hook 'org-mode-hook 'company/org-mode-hook) (add-hook 'org-mode-hook 'company/org-mode-hook)
(add-hook 'org-src-mode-hook 'smartparens-mode) (add-hook 'org-src-mode-hook 'smartparens-mode)
@ -707,7 +733,8 @@ Vorerst deaktiviert, Nutzen evtl. nicht vorhanden
** misc ** misc
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package eldoc (use-package eldoc
:diminish eldoc-mode)
:diminish eldoc-mode
:defer t)
#+end_src #+end_src
** Magit / Git ** Magit / Git
:PROPERTIES: :PROPERTIES:
@ -775,6 +802,7 @@ TODO Unterverzeichnisse wurden noch nicht getestet
(use-package lsp-ui (use-package lsp-ui
:after lsp-mode :after lsp-mode
:ensure t :ensure t
:defer t
:diminish :diminish
:commands lsp-ui-mode :commands lsp-ui-mode
:config :config
@ -813,6 +841,7 @@ For useful snippet either install yasnippet-snippets or get them from here
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package yasnippet (use-package yasnippet
:ensure t :ensure t
:defer t
:diminish yas-minor-mode :diminish yas-minor-mode
:config :config
(setq yas-snippet-dirs (list (concat MY--PATH_USER_GLOBAL "snippets"))) (setq yas-snippet-dirs (list (concat MY--PATH_USER_GLOBAL "snippets")))
@ -847,6 +876,7 @@ With hippie expand I am able to use yasnippet and emmet at the same time with th
((css-mode . flycheck-mode) ((css-mode . flycheck-mode)
(emacs-lisp-mode . flycheck-mode) (emacs-lisp-mode . flycheck-mode)
(python-mode . flycheck-mode)) (python-mode . flycheck-mode))
:defer 1.0
:init :init
(setq flycheck-emacs-lisp-load-path 'inherit) (setq flycheck-emacs-lisp-load-path 'inherit)
:config :config
@ -865,7 +895,7 @@ Manage projects and jump quickly between its files
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package projectile (use-package projectile
:ensure t :ensure t
:defer t
:defer 1.0
:diminish :diminish
:hook (projectile-after-switch-project . (lambda () (set-workon_home))) ;; for pyvenv to auto activate environment :hook (projectile-after-switch-project . (lambda () (set-workon_home))) ;; for pyvenv to auto activate environment
:bind-keymap :bind-keymap
@ -979,12 +1009,14 @@ Default completion is C-j
(use-package yaml-mode (use-package yaml-mode
:if *sys/linux* :if *sys/linux*
:ensure t :ensure t
:defer t
:mode ("\\.yml$" . yaml-mode)) :mode ("\\.yml$" . yaml-mode))
#+end_src #+end_src
** R ** R
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package ess (use-package ess
:ensure t :ensure t
:defer t
:init :init
(if *work_remote* (if *work_remote*
(setq exec-path (append exec-path '("P:/Tools/R/bin/x64")) (setq exec-path (append exec-path '("P:/Tools/R/bin/x64"))
@ -1007,18 +1039,20 @@ apt install build-essential python3-dev
(use-package lsp-python-ms (use-package lsp-python-ms
:if *sys/linux* :if *sys/linux*
:ensure t :ensure t
:defer 0.3
:defer t
:custom (lsp-python-ms-auto-install-server t)) :custom (lsp-python-ms-auto-install-server t))
(use-package python (use-package python
:if *sys/linux* :if *sys/linux*
:delight "π " :delight "π "
:defer t
:bind (("M-[" . python-nav-backward-block) :bind (("M-[" . python-nav-backward-block)
("M-]" . python-nav-forward-block))) ("M-]" . python-nav-forward-block)))
(use-package pyvenv (use-package pyvenv
:if *sys/linux* :if *sys/linux*
:ensure t :ensure t
:defer t
:after python :after python
:hook ((python-mode . pyvenv-mode) :hook ((python-mode . pyvenv-mode)
(python-mode . (lambda () (python-mode . (lambda ()
@ -1131,3 +1165,9 @@ Start fava with fava my_file.beancount
It is accessable on this URL: [[http://127.0.0.1:5000][Fava]] It is accessable on this URL: [[http://127.0.0.1:5000][Fava]]
Beancount-mode can start fava and open the URL right away. Beancount-mode can start fava and open the URL right away.
* Stuff after everything else
Set garbage collector to a smaller value to let it kick in faster.
Maybe a problem on Windows?
#+begin_src emacs-lisp
(setq gc-cons-threshold (* 2 1000 1000))
#+end_src
Loading…
Cancel
Save