Assorted fixes

This commit is contained in:
Joseph Ferano 2022-09-12 15:31:28 +07:00
parent 4f520115c7
commit 9e0f85404f

View File

@ -9,7 +9,8 @@
*** Garbage Collection *** Garbage Collection
The default Garbage Collector is triggered at 800 KB, way too conservative, let's bump to 512 MB. The default Garbage Collector is triggered at 800 KB, way too conservative, let's bump to 512 MB.
Garbage collection is a big contributor to startup times. This fends it off, then is reset later by enabling `gcmh-mode'. Not resetting it will cause stuttering/freezes. Garbage collection is a big contributor to startup times. This fends it off, then is reset later by
enabling `gcmh-mode'. Not resetting it will cause stuttering/freezes.
#+begin_src emacs-lisp :tangle ./early-init.el #+begin_src emacs-lisp :tangle ./early-init.el
;; -*- lexical-binding: t -*- ;; -*- lexical-binding: t -*-
@ -43,7 +44,6 @@ Disabling these classic visual options during early-init seems to net a 0.04 ms
(menu-bar-mode -1) (menu-bar-mode -1)
(tooltip-mode -1) (tooltip-mode -1)
#+end_src #+end_src
*** Straight.el Prep *** Straight.el Prep
Disable package.el, since we will be using straight.el. According to the straight.el Disable package.el, since we will be using straight.el. According to the straight.el
@ -59,7 +59,6 @@ Either way, if you need to quickly install a package for testing, you can just r
#+BEGIN_SRC emacs-lisp :tangle ./early-init.el #+BEGIN_SRC emacs-lisp :tangle ./early-init.el
(setq package-enable-at-startup nil) (setq package-enable-at-startup nil)
#+END_SRC #+END_SRC
*** Enhancements *** Enhancements
Prioritize old byte-compiled source files over newer sources. It saves us a little IO time to skip all the mtime checks on each lookup. Prioritize old byte-compiled source files over newer sources. It saves us a little IO time to skip all the mtime checks on each lookup.
@ -67,13 +66,13 @@ Prioritize old byte-compiled source files over newer sources. It saves us a litt
(setq load-prefer-newer nil) (setq load-prefer-newer nil)
(setq safe-local-variable-values (setq safe-local-variable-values
'((eval add-hook 'after-save-hook '((org-src-preserve-indentation . t)
(eval add-hook 'after-save-hook
'(lambda nil '(lambda nil
(org-babel-tangle)) (org-babel-tangle))
nil t))) nil t)))
#+end_src #+end_src
*** UTF-8 Support *** UTF-8 Support
#+begin_src emacs-lisp :tangle ./early-init.el #+begin_src emacs-lisp :tangle ./early-init.el
(setq default-input-method nil) (setq default-input-method nil)
@ -95,6 +94,8 @@ For now, use [[https://github.com/radian-software/straight.el][straight.el]] unt
Then bootstrap Then bootstrap
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
;; -*- lexical-binding: t -*-
(defvar bootstrap-version) (defvar bootstrap-version)
(let ((bootstrap-file (let ((bootstrap-file
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
@ -195,11 +196,9 @@ Use Dashboard.el. First load `all-the-icons` for nicer rendering
#+end_src #+end_src
*** Themes *** Themes
sanityinc-tomorrow-light is really good
#+begin_src emacs-lisp #+begin_src emacs-lisp
;; (load "/home/joe/.dotfiles/.emacs.bankruptcy/straight/repos/themes/themes/doom-flatwhite-theme.el")
(straight-use-package 'doom-themes) (straight-use-package 'doom-themes)
(straight-use-package 'color-theme-sanityinc-tomorrow)
(setq custom-safe-themes t) (setq custom-safe-themes t)
#+end_src #+end_src
@ -253,6 +252,7 @@ Setup other stuff
(straight-use-package 'nano-modeline) (straight-use-package 'nano-modeline)
(nano-modeline-mode) (nano-modeline-mode)
(setq nano-modeline-prefix 'icon)
#+end_src #+end_src
** Text ** Text
@ -268,7 +268,7 @@ Setup other stuff
(set-default 'truncate-lines nil) (set-default 'truncate-lines nil)
(set-default 'truncate-partial-width-windows nil) (set-default 'truncate-partial-width-windows nil)
(add-hook 'before-save-hook 'whitespace-cleanup) ;; (add-hook 'before-save-hook 'whitespace-cleanup)
#+end_src #+end_src
** Buffers ** Buffers
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -319,10 +319,8 @@ The theme of `C-x 4` bindings is that they operate on other windows, so this fun
#+begin_src emacs-lisp #+begin_src emacs-lisp
(add-hook 'after-init-hook (lambda () (winner-mode t))) (add-hook 'after-init-hook (lambda () (winner-mode t)))
(straight-use-package 'rotate) (straight-use-package 'rotate)
(setq joe/popper-side-toggle 'right) (setq joe/popper-side-toggle 'right)
(defun joe/window-split-vertical () (interactive) (set 'joe/popper-side-toggle 'right) (rotate:main-horizontal)) (defun joe/window-split-vertical () (interactive) (set 'joe/popper-side-toggle 'right) (rotate:main-horizontal))
(defun joe/window-split-horizontal () (interactive) (set 'joe/popper-side-toggle 'below) (rotate:main-vertical)) (defun joe/window-split-horizontal () (interactive) (set 'joe/popper-side-toggle 'below) (rotate:main-vertical))
@ -330,9 +328,16 @@ The theme of `C-x 4` bindings is that they operate on other windows, so this fun
(define-key ctl-x-4-map (kbd "-") #'joe/window-split-horizontal) (define-key ctl-x-4-map (kbd "-") #'joe/window-split-horizontal)
(define-key ctl-x-4-map (kbd "t") #'rotate-window) (define-key ctl-x-4-map (kbd "t") #'rotate-window)
(straight-use-package 'ace-window)
(global-set-key (kbd "C-x o") #'ace-window) (global-set-key (kbd "C-x o") #'ace-window)
(global-set-key (kbd "C-x C-o") #'ace-swap-window) (global-set-key (kbd "C-x C-o") #'ace-swap-window)
#+end_src>
(global-set-key (kbd "C-c h") #'windmove-left)
(global-set-key (kbd "C-c l") #'windmove-right)
(global-set-key (kbd "C-c k") #'windmove-up)
(global-set-key (kbd "C-c j") #'windmove-down)
#+end_src
*** Popper *** Popper
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -401,12 +406,12 @@ The theme of `C-x 4` bindings is that they operate on other windows, so this fun
(defun joe/smooth-scroll-short-down () (defun joe/smooth-scroll-short-down ()
"Smooth scroll down" "Smooth scroll down"
(interactive) (interactive)
(joe/pixel-scroll-lerp 6 -1)) (joe/pixel-scroll-lerp 8 -1))
(defun joe/smooth-scroll-short-up () (defun joe/smooth-scroll-short-up ()
"Smooth scroll down" "Smooth scroll down"
(interactive) (interactive)
(joe/pixel-scroll-lerp 6 1)) (joe/pixel-scroll-lerp 8 1))
;; scroll-up-command ;; scroll-up-command
(global-set-key (kbd "C-v") #'joe/smooth-scroll-half-page-down) (global-set-key (kbd "C-v") #'joe/smooth-scroll-half-page-down)
@ -424,6 +429,12 @@ The theme of `C-x 4` bindings is that they operate on other windows, so this fun
(setq org-todo-keywords '((sequence "TODO" "IN-PROGRESS" "|" "DONE" "BACKLOG"))) (setq org-todo-keywords '((sequence "TODO" "IN-PROGRESS" "|" "DONE" "BACKLOG")))
(setq org-agenda-files '("~/todo.org")) (setq org-agenda-files '("~/todo.org"))
(org-babel-do-load-languages
'org-babel-load-languages
'((emacs-lisp . t)
(makefile . t)
(shell . t)))
(require 'org-tempo) (require 'org-tempo)
(add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp")) (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp"))
(setq org-edit-src-content-indentation 0)) (setq org-edit-src-content-indentation 0))
@ -731,7 +742,6 @@ Emacs is an great operating system, if only it had a good text editor...
(global-set-key (kbd "C-c C-;") 'joe/duplicate-line-comment) (global-set-key (kbd "C-c C-;") 'joe/duplicate-line-comment)
#+end_src #+end_src
*** Hydra *** Hydra
#+begin_src emacs-lisp #+begin_src emacs-lisp
(straight-use-package 'hydra) (straight-use-package 'hydra)
@ -747,12 +757,10 @@ Emacs is an great operating system, if only it had a good text editor...
("p" previous-line "line up") ("p" previous-line "line up")
("M-r" move-to-window-line-top-bottom "Reposition cursor")) ("M-r" move-to-window-line-top-bottom "Reposition cursor"))
#+end_src #+end_src
*** Multiple Cursors *** Multiple Cursors
#+begin_src emacs-lisp #+begin_src emacs-lisp
(straight-use-package 'multiple-cursors) (straight-use-package 'multiple-cursors)
#+end_src #+end_src
*** Meow *** Meow
#+begin_src emacs-lisp :tangle no #+begin_src emacs-lisp :tangle no
(straight-use-package 'meow) (straight-use-package 'meow)
@ -845,7 +853,6 @@ Emacs is an great operating system, if only it had a good text editor...
(meow-setup) (meow-setup)
(meow-global-mode t) (meow-global-mode t)
#+end_src #+end_src
*** Boon *** Boon
#+begin_src emacs-lisp :tangle no #+begin_src emacs-lisp :tangle no
(straight-use-package 'boon) (straight-use-package 'boon)
@ -899,48 +906,53 @@ Emacs is an great operating system, if only it had a good text editor...
(straight-use-package 'markdown-mode) (straight-use-package 'markdown-mode)
(straight-use-package 'lsp-mode) (straight-use-package 'lsp-mode)
(setq lsp-keymap-prefix "C-c l") (setq lsp-keymap-prefix "C-c c")
;; (require 'lsp) ;; (require 'lsp)
;; (straight-use-package 'eglot) ;; (straight-use-package 'eglot)
;; (setq completion-in-region-function (kind-icon-enhance-completion completion-in-region-function))
(setq completion-in-region-function #'consult-completion-in-region) ;; (global-set-key [remap dabbrev-expand] 'hippie-expand)
(global-set-key [remap dabbrev-expand] 'hippie-expand)
;; (straight-use-package 'cape) ;; (straight-use-package 'cape)
;; (add-to-list 'completion-at-point-functions #'cape-symbol) ;; (add-to-list 'completion-at-point-functions #'cape-symbol)
;; (add-to-list 'completion-at-point-functions #'cape-file) ;; (add-to-list 'completion-at-point-functions #'cape-file)
;; (add-to-list 'completion-at-point-functions #'cape-dabbrev) ;; (add-to-list 'completion-at-point-functions #'cape-dabbrev)
;; (straight-use-package 'kind-icon) (straight-use-package 'kind-icon)
;; (require 'kind-icon) ;; (require 'kind-icon)
(setq completion-in-region-function #'consult-completion-in-region)
(setq completion-in-region-function (kind-icon-enhance-completion completion-in-region-function))
(straight-use-package 'company)
;; (straight-use-package 'company)
;; (require 'company) ;; (require 'company)
;; (setq company-transformers '()) ;; (setq company-transformers '())
(add-to-list 'completion-at-point-functions #'elisp-completion-at-point)
(with-eval-after-load 'company ;; (add-to-list 'completion-at-point-functions #'elisp-completion-at-point)
(define-key company-active-map (kbd "C-n") nil) ;; (with-eval-after-load 'company
(define-key company-active-map (kbd "C-p") nil) ;; (define-key company-active-map (kbd "C-n") nil)
(define-key company-active-map (kbd "<return>") nil) ;; (define-key company-active-map (kbd "C-p") nil)
(define-key company-active-map (kbd "RET") nil) ;; (define-key company-active-map (kbd "<return>") nil)
(define-key company-active-map (kbd "C-f") #'company-complete-selection) ;; (define-key company-active-map (kbd "RET") nil)
(define-key company-active-map [tab] #'company-complete-common-or-cycle) ;; (define-key company-active-map (kbd "C-f") #'company-complete-selection)
(define-key company-active-map (kbd "<backtab>") (lambda () (interactive) (company-complete-common-or-cycle -1))) ;; (define-key company-active-map [tab] #'company-complete-common-or-cycle)
(setq company-idle-delay 0.15 ;; (define-key company-active-map (kbd "<backtab>") (lambda () (interactive) (company-complete-common-or-cycle -1)))
company-tooltip-idle-delay 10
company-require-match nil ;; (setq company-idle-delay 0.15
company-frontends '(company-preview-frontend company-echo-metadata-frontend) ;; company-tooltip-idle-delay 10
;; company-frontends '(company-text-icons-margin company-echo-metadata-frontend) ;; company-require-match nil
company-backends '((company-capf company-files))) ;; company-frontends '(company-pseudo-tooltip-unless-just-one-frontend-with-delay
(setq company-transformers '(company-sort-by-occurrence))) ;; company-preview-frontend company-echo-metadata-frontend)
(add-hook 'after-init-hook (lambda () (global-company-mode))) ;; ;; company-frontends '(company-text-icons-margin company-echo-metadata-frontend)
;; company-backends '((company-capf company-files)))
;; (setq company-transformers '(company-sort-by-occurrence)))
;; (add-hook 'after-init-hook (lambda () (global-company-mode)))
;; (delete 'elisp-completion-at-point completion-at-point-functions) ;; (delete 'elisp-completion-at-point completion-at-point-functions)
;; (delete 'cape-symbol completion-at-point-functions) ;; (delete 'cape-symbol completion-at-point-functions)
;; (straight-use-package 'corfu) ;; (straight-use-package 'corfu)
;; (global-corfu-mode) ;; (global-corfu-mode)
;; (setq kind-icon-default-face 'corfu-default)
;; (setq ;; (setq
;; corfu-cycle t ;; Enable cycling for `corfu-next/previous' ;; corfu-cycle t ;; Enable cycling for `corfu-next/previous'
;; corfu-auto t ;; Enable auto completion ;; corfu-auto t ;; Enable auto completion
@ -953,7 +965,8 @@ Emacs is an great operating system, if only it had a good text editor...
;; corfu-echo-documentation t ;; Disable documentation in the echo area ;; corfu-echo-documentation t ;; Disable documentation in the echo area
;; corfu-scroll-margin 5) ;; Use scroll margin ;; corfu-scroll-margin 5) ;; Use scroll margin
;; (setq corfu-preview-current t) ;; (setq corfu-preview-current t)
;; (straight-use-package ;; (add-to-list 'corfu-margin-formatters #'kind-icon-margin-formatter)
;; (setq-local corfu-auto t ;; (setq-local corfu-auto t
;; corfu-auto-delay 0.1 ;; corfu-auto-delay 0.1
;; corfu-auto-prefix 1 ;; corfu-auto-prefix 1
@ -984,7 +997,9 @@ it doesn't close it.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(defun joe/c-mode-hook () (defun joe/c-mode-hook ()
(local-set-key (kbd "C-x c r") (defun joe/make-run () (interactive) (compile "make run"))) (local-set-key (kbd "C-x c r") (defun joe/make-run () (interactive) (compile "make run")))
(local-set-key (kbd "C-x c c") (defun joe/make () (interactive) (compile "make")))) (local-set-key (kbd "C-x c c") (defun joe/make () (interactive) (compile "make")))
(straight-use-package 'disaster)
(electric-pair-local-mode t))
(add-hook 'c-mode-hook #'joe/c-mode-hook) (add-hook 'c-mode-hook #'joe/c-mode-hook)
(defun joe/close-compilation-if-no-warn-err (buffer string) (defun joe/close-compilation-if-no-warn-err (buffer string)
@ -995,12 +1010,16 @@ it doesn't close it.
(not (not
(with-current-buffer (current-buffer) (with-current-buffer (current-buffer)
(search-forward "warning" nil t)))) (search-forward "warning" nil t))))
(run-with-timer 1 nil (run-with-timer 1.5 nil
(lambda () (lambda ()
(and (eq (point) 1) (and (eq (point) 1)
(string-match "compilation" (buffer-name (current-buffer))) (string-match "compilation" (buffer-name (current-buffer)))
(popper-close-latest)))))) (popper-close-latest))))))
(add-hook 'compilation-finish-functions 'joe/close-compilation-if-no-warn-err) (add-hook 'compilation-finish-functions 'joe/close-compilation-if-no-warn-err)
(global-set-key (kbd "C-c e n") #'flymake-goto-next-error)
(global-set-key (kbd "C-c e p") #'flymake-goto-prev-error)
#+end_src #+end_src
** Magit ** Magit
@ -1031,7 +1050,7 @@ The best git porcelain/client I've ever used. Also kill stray magit buffers left
"A minor mode to enable some magit keys" "A minor mode to enable some magit keys"
:init-value t) :init-value t)
(joe/magit-keys t) (joe/magit-keys-mode t)
#+end_src #+end_src
** Restclient ** Restclient