~thecatster/.emacs.d

6549eefecc7b41acfd650eaedf82866067c61ab0 — Daniil Rose 2 years ago 8c56cb6
Strip out cmake and transparency
2 files changed, 298 insertions(+), 334 deletions(-)

M emacs.org
M init.el
M emacs.org => emacs.org +250 -267
@@ 82,16 82,16 @@ This is tangled to `~/.emacs.d/early-init.el` and is run, as the name
implies, earlier than the rest.

#+BEGIN_SRC emacs-lisp :tangle ~/.emacs.d/early-init.el
;;; early-init.el -*- lexical-binding: t; -*-
;; Do not edit this file! Generated by Emacs.org in .files
  ;;; early-init.el -*- lexical-binding: t; -*-
  ;; Do not edit this file! Generated by Emacs.org in .files

;; Got to disable package.el, we're using straight.el!
  ;; Got to disable package.el, we're using straight.el!

(setq package-enable-at-startup nil)
  (setq package-enable-at-startup nil)

;; Again, /inspired/ from Doom, ensure Engineered is running in this directory.
(setq user-emacs-directory (expand-file-name "~/.local/emacs/")
      url-history-file (expand-file-name "url/history" user-emacs-directory))
  ;; Again, /inspired/ from Doom, ensure Engineered is running in this directory.
  (setq user-emacs-directory (expand-file-name "~/.local/emacs/")
        url-history-file (expand-file-name "url/history" user-emacs-directory))
#+END_SRC

* Startup


@@ 100,135 100,135 @@ Once again remnants of the framework. This was my "foundation" or "core" file,
and I pulled out the parts I thought were best and still needed.

#+BEGIN_SRC emacs-lisp
(defconst IS-WINDOWS (memq system-type '(cygwin windows-nt ms-dos)))
(defconst IS-MAC     (eq system-type 'darwin))
(defconst IS-LINUX   (eq system-type 'gnu/linux))

(defconst engineered-version "2.4.0"
  "Current version of Engineered Emacs.")

;; Prevent unwanted runtime builds in gccemacs (native-comp); packages are
;; compiled ahead-of-time when they are installed and site files are compiled
;; when gccemacs is installed.
(setq comp-deferred-compilation nil)
(setq comp-async-report-warnings-errors nil)

;; Getting strange messages with Guix that do not affect performance
(setq warning-minimum-level :error)

;;; Shut up, startup
;; Legacy system advice, who cares
(setq ad-redefinition-action 'accept)

;; "For information about GNU Emacs..." I'll read the docs or go to the website, moving on
(unless (daemonp)
  (advice-add #'display-startup-echo-area-message :override #'ignore))

;; Shut up, *Message*
(setq inhibit-startup-message t
      large-file-warning-threshold nil
      vc-follow-symlinks t
      ad-redefinition-action 'accept
      inhibit-startup-echo-area-message user-login-name
      inhibit-default-init t
      byte-compile-warnings '(not cl-functions))

;;; Optimizations!
;; Don't rely on case insensitivity.
(setq auto-mode-case-fold nil)

;; Disabling bidirectional text rendering gives a performance boost.
(setq-default bidi-display-reordering 'left-to-right
	            bidi-paragraph-direction nil)
(setq bidi-inhibit-bpa t)

;; Don't render in non-focused, why would you?
(setq-default cursor-in-non-selected-windows nil)
(setq highlight-nonselected-windows nil)

;; *Zoom* scrolling
(setq fast-but-imprecise-scrolling t)

;; Can't figure out what for, but this is needed.
(require 'ido)

;; Why are you pinging domain names?
(setq ffap-machine-p-known 'reject)

;; Don't waste time on resizing the frame with font size.
(setq frame-inhibit-implied-resize t)

;; Here's where we handle the GC
(setq gcmh-idle-delay 5
      gc-cons-threshold (* 2000 1024 1024) ;; 2000mb
      gcmh-high-cons-threshold (* 4000 1024 1024))  ;; 4000mb

;; This increases from the default of 4k, helps LSP
(setq read-process-output-max (* 16 1024 1024)) ;; 16mb

;; Slow the UI updates
(setq idle-update-delay 1.0)

;; Increase memory usage, but increase performance. No thank you, font compacting!
(setq inhibit-compacting-font-caches t)

;; I said, **Zoom** scrolling!
(setq redisplay-skip-fontification-on-input t)

;; Of course Windows does it's own thing D:
(when IS-WINDOWS
  (setq w32-get-true-file-attributes nil
	      w32-pipe-read-delay 0
	      w32-pipe-buffer-size (* 64 1024)))

;; Remove unnecessary CLI options
(unless IS-MAC   (setq command-line-ns-option-alist nil))
(unless IS-LINUX (setq command-line-x-option-alist nil))

;; A hack from Doom again, this helps with terminal Emacs startup
(unless (daemonp)
  (advice-add #'tty-run-terminal-initialization :override #'ignore))

;; I know this is from Doom again, but again, Henrik knows what he's doing!
;;; Security

;; Emacs is essentially one huge security vulnerability, what with all the
;; dependencies it pulls in from all corners of the globe. Let's try to be at
;; least a little more discerning.
(setq gnutls-verify-error (not (getenv-internal "INSECURE"))
      gnutls-algorithm-priority
      (when (boundp 'libgnutls-version)
	      (concat "SECURE128:+SECURE192:-VERS-ALL"
		            (if (and (not IS-WINDOWS)
			                   (not (version< emacs-version "26.3"))
			                   (>= libgnutls-version 30605))
		                ":+VERS-TLS1.3")
		            ":+VERS-TLS1.2"))
      ;; `gnutls-min-prime-bits' is set based on recommendations from
      ;; https://www.keylength.com/en/4/
      gnutls-min-prime-bits 3072
      tls-checktrust gnutls-verify-error
      tls-program '("gnutls-cli -p %p %h"))

;; Emacs stores `authinfo' in $HOME and in plain-text. WHY!?
(setq auth-sources (list (concat user-emacs-directory "authinfo.gpg")
                         "~/.authinfo"
			                   "~/.authinfo.gpg"))

;; Of course Windows does it's own thing.
(when (and IS-WINDOWS (null (getenv-internal "HOME")))
  (setenv "HOME" (getenv "USERPROFILE"))
  (setq abbreviated-home-dir nil))

;; UTF-8!
(when (fboundp 'set-charset-priority)
  (set-charset-priority 'unicode))
(set-default-coding-systems 'utf-8)
(prefer-coding-system 'utf-8)
(setq locale-coding-system 'utf-8)
;; Of course Windows does it's own thing.
(unless IS-WINDOWS
  (setq selection-coding-system 'utf-8))
  (defconst IS-WINDOWS (memq system-type '(cygwin windows-nt ms-dos)))
  (defconst IS-MAC     (eq system-type 'darwin))
  (defconst IS-LINUX   (eq system-type 'gnu/linux))

  (defconst engineered-version "2.4.0"
    "Current version of Engineered Emacs.")

  ;; Prevent unwanted runtime builds in gccemacs (native-comp); packages are
  ;; compiled ahead-of-time when they are installed and site files are compiled
  ;; when gccemacs is installed.
  (setq comp-deferred-compilation nil)
  (setq comp-async-report-warnings-errors nil)

  ;; Getting strange messages with Guix that do not affect performance
  (setq warning-minimum-level :error)

  ;;; Shut up, startup
  ;; Legacy system advice, who cares
  (setq ad-redefinition-action 'accept)

  ;; "For information about GNU Emacs..." I'll read the docs or go to the website, moving on
  (unless (daemonp)
    (advice-add #'display-startup-echo-area-message :override #'ignore))

  ;; Shut up, *Message*
  (setq inhibit-startup-message t
        large-file-warning-threshold nil
        vc-follow-symlinks t
        ad-redefinition-action 'accept
        inhibit-startup-echo-area-message user-login-name
        inhibit-default-init t
        byte-compile-warnings '(not cl-functions))

  ;;; Optimizations!
  ;; Don't rely on case insensitivity.
  (setq auto-mode-case-fold nil)

  ;; Disabling bidirectional text rendering gives a performance boost.
  (setq-default bidi-display-reordering 'left-to-right
                bidi-paragraph-direction nil)
  (setq bidi-inhibit-bpa t)

  ;; Don't render in non-focused, why would you?
  (setq-default cursor-in-non-selected-windows nil)
  (setq highlight-nonselected-windows nil)

  ;; *Zoom* scrolling
  (setq fast-but-imprecise-scrolling t)

  ;; Can't figure out what for, but this is needed.
  (require 'ido)

  ;; Why are you pinging domain names?
  (setq ffap-machine-p-known 'reject)

  ;; Don't waste time on resizing the frame with font size.
  (setq frame-inhibit-implied-resize t)

  ;; Here's where we handle the GC
  (setq gcmh-idle-delay 5
        gc-cons-threshold (* 2000 1024 1024) ;; 2000mb
        gcmh-high-cons-threshold (* 4000 1024 1024))  ;; 4000mb

  ;; This increases from the default of 4k, helps LSP
  (setq read-process-output-max (* 16 1024 1024)) ;; 16mb

  ;; Slow the UI updates
  (setq idle-update-delay 1.0)

  ;; Increase memory usage, but increase performance. No thank you, font compacting!
  (setq inhibit-compacting-font-caches t)

  ;; I said, **Zoom** scrolling!
  (setq redisplay-skip-fontification-on-input t)

  ;; Of course Windows does it's own thing D:
  (when IS-WINDOWS
    (setq w32-get-true-file-attributes nil
          w32-pipe-read-delay 0
          w32-pipe-buffer-size (* 64 1024)))

  ;; Remove unnecessary CLI options
  (unless IS-MAC   (setq command-line-ns-option-alist nil))
  (unless IS-LINUX (setq command-line-x-option-alist nil))

  ;; A hack from Doom again, this helps with terminal Emacs startup
  (unless (daemonp)
    (advice-add #'tty-run-terminal-initialization :override #'ignore))

  ;; I know this is from Doom again, but again, Henrik knows what he's doing!
  ;;; Security

  ;; Emacs is essentially one huge security vulnerability, what with all the
  ;; dependencies it pulls in from all corners of the globe. Let's try to be at
  ;; least a little more discerning.
  (setq gnutls-verify-error (not (getenv-internal "INSECURE"))
        gnutls-algorithm-priority
        (when (boundp 'libgnutls-version)
          (concat "SECURE128:+SECURE192:-VERS-ALL"
                  (if (and (not IS-WINDOWS)
                           (not (version< emacs-version "26.3"))
                           (>= libgnutls-version 30605))
                      ":+VERS-TLS1.3")
                  ":+VERS-TLS1.2"))
        ;; `gnutls-min-prime-bits' is set based on recommendations from
        ;; https://www.keylength.com/en/4/
        gnutls-min-prime-bits 3072
        tls-checktrust gnutls-verify-error
        tls-program '("gnutls-cli -p %p %h"))

  ;; Emacs stores `authinfo' in $HOME and in plain-text. WHY!?
  (setq auth-sources (list (concat user-emacs-directory "authinfo.gpg")
                           "~/.authinfo"
                           "~/.authinfo.gpg"))

  ;; Of course Windows does it's own thing.
  (when (and IS-WINDOWS (null (getenv-internal "HOME")))
    (setenv "HOME" (getenv "USERPROFILE"))
    (setq abbreviated-home-dir nil))

  ;; UTF-8!
  (when (fboundp 'set-charset-priority)
    (set-charset-priority 'unicode))
  (set-default-coding-systems 'utf-8)
  (prefer-coding-system 'utf-8)
  (setq locale-coding-system 'utf-8)
  ;; Of course Windows does it's own thing.
  (unless IS-WINDOWS
    (setq selection-coding-system 'utf-8))
#+END_SRC

** Package Management


@@ 236,30 236,30 @@ For my configuration, I decided to use straight.el instead of package.el. I've
heard much good about straight, so time to put that to the test.

#+BEGIN_SRC emacs-lisp
;; MELPA!
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(add-to-list 'package-archives '("org" . "https://orgmode.org/elpa/") t)
(add-to-list 'package-archives '("gnu" . "https://elpa.gnu.org/packages/") t)
(package-initialize)

(setq load-prefer-newer t)

(defvar bootstrap-version)
(defvar native-comp-deferred-compilation-deny-list ())
(let ((bootstrap-file
       (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
      (bootstrap-version 5))
  (unless (file-exists-p bootstrap-file)
    (with-current-buffer
        (url-retrieve-synchronously
         "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
         'silent 'inhibit-cookies)
      (goto-char (point-max))
      (eval-print-last-sexp)))
  (load bootstrap-file nil 'nomessage))
(straight-use-package 'use-package)
(setq straight-use-package-by-default t)
  ;; MELPA!
  (require 'package)
  (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
  (add-to-list 'package-archives '("org" . "https://orgmode.org/elpa/") t)
  (add-to-list 'package-archives '("gnu" . "https://elpa.gnu.org/packages/") t)
  (package-initialize)

  (setq load-prefer-newer t)

  (defvar bootstrap-version)
  (defvar native-comp-deferred-compilation-deny-list ())
  (let ((bootstrap-file
         (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
        (bootstrap-version 5))
    (unless (file-exists-p bootstrap-file)
      (with-current-buffer
          (url-retrieve-synchronously
           "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
           'silent 'inhibit-cookies)
        (goto-char (point-max))
        (eval-print-last-sexp)))
    (load bootstrap-file nil 'nomessage))
  (straight-use-package 'use-package)
  (setq straight-use-package-by-default t)
#+END_SRC

** Better Defaults and UI


@@ 269,134 269,134 @@ and other bits of the UI, and includes some limits I consider useful.
Hide annoying minor modes that will always be on anyway.

#+BEGIN_SRC emacs-lisp
(use-package diminish)
  (use-package diminish)
#+END_SRC

Let's get rid of the ugly UI elements that take up screen space.

#+BEGIN_SRC emacs-lisp
(scroll-bar-mode -1)
(tool-bar-mode   -1)
(tooltip-mode    -1)
(menu-bar-mode   -1)
  (scroll-bar-mode -1)
  (tool-bar-mode   -1)
  (tooltip-mode    -1)
  (menu-bar-mode   -1)
#+END_SRC

When working with long lines, this should help with loading times and
lag.

#+BEGIN_SRC emacs-lisp
(use-package so-long
  :config
  (global-so-long-mode 1))
  (use-package so-long
    :config
    (global-so-long-mode 1))
#+END_SRC

The most common protocol I use TRAMP for is ssh, so might as well make
that default. Also allow me to reopen a file as root automatically.
Add programs to path on macOS.

#+BEGIN_SRC emacs-lisp
(setq tramp-default-method "ssh")

(use-package auto-sudoedit
  :diminish auto-sudoedit-mode
  :config
  (auto-sudoedit-mode 1))
  (when IS-MAC
    (use-package exec-path-from-shell
      :init
      (exec-path-from-shell-initialize)))
#+END_SRC

Transparency is nice.
The most common protocol I use TRAMP for is ssh, so might as well make
that default. Also allow me to reopen a file as root automatically.

#+BEGIN_SRC emacs-lisp
(set-frame-parameter (selected-frame) 'alpha '(97 . 97))
(add-to-list 'default-frame-alist '(alpha . (97 . 97)))
(set-frame-parameter (selected-frame) 'fullscreen 'maximized)
(add-to-list 'default-frame-alist '(fullscreen . maximized))
  (setq tramp-default-method "ssh")

  (use-package auto-sudoedit
    :diminish auto-sudoedit-mode
    :config
    (auto-sudoedit-mode 1))
#+END_SRC

Another supposed performance boost, I do not need VC checking every
time I open a file, and I usually use Magit anyway.

#+BEGIN_SRC emacs-lisp
(remove-hook 'find-file-hooks 'vc-find-file-hook)
(setq vc-follow-symlinks t)
  (remove-hook 'find-file-hooks 'vc-find-file-hook)
  (setq vc-follow-symlinks t)
#+END_SRC

I prefer to have a little message in scratch and keep it in fundamental mode.

#+BEGIN_SRC emacs-lisp
(setq initial-scratch-message "Welcome to Engineered Emacs: EXWM Edition!")
(setq initial-major-mode 'fundamental-mode)
  (setq initial-scratch-message "Welcome to Engineered Emacs: EXWM Edition!")
  (setq initial-major-mode 'fundamental-mode)
#+END_SRC

I absolutely hate the bell, please shut up.

#+BEGIN_SRC emacs-lisp
(setq ring-bell-function 'ignore)
  (setq ring-bell-function 'ignore)
#+END_SRC

Tabs are for monsters, this is not up for debate.

#+BEGIN_SRC emacs-lisp
(setq-default indent-tabs-mode nil)
(setq-default tab-width 2)
  (setq-default indent-tabs-mode nil)
  (setq-default tab-width 2)
#+END_SRC

Some other nice changes: files to trash, stretch cursor on glyph, and
undo limit increase.

#+BEGIN_SRC emacs-lisp
(setq-default
 window-combination-resize t
 delete-by-moving-to-trash t
 x-stretch-cursor t)
  (setq-default
   window-combination-resize t
   delete-by-moving-to-trash t
   x-stretch-cursor t)

(setq undo-limit 80000000
      auto-save-default nil
      truncate-string-ellipsis "…"
      scroll-margin 20)
  (setq undo-limit 80000000
        auto-save-default nil
        truncate-string-ellipsis "…"
        scroll-margin 20)
#+END_SRC

Iterating through CamelCase words is quite nice, especially in JVM
langs.

#+BEGIN_SRC emacs-lisp
(with-eval-after-load 'subword
  (diminish 'subword-mode))
(global-subword-mode 1)
  (with-eval-after-load 'subword
    (diminish 'subword-mode))
  (global-subword-mode 1)
#+END_SRC

Allow me to pop multiple times when jumping back to a mark.

#+BEGIN_SRC emacs-lisp
(setq set-mark-command-repeat-pop t)
  (setq set-mark-command-repeat-pop t)
#+END_SRC

Always update files on change globally.

#+BEGIN_SRC emacs-lisp
(setq global-auto-revert-non-file-buffers t)
(global-auto-revert-mode 1)
  (setq global-auto-revert-non-file-buffers t)
  (global-auto-revert-mode 1)
#+END_SRC

I used to always use relative line numbers, and I cannot tell if it is
a placebo or not, but absolute feels faster.

#+BEGIN_SRC emacs-lisp
  (dolist (mode '(text-mode-hook
                  prog-mode-hook
                  conf-mode-hook))
    (add-hook mode (lambda () (display-line-numbers-mode 1))))
    (dolist (mode '(text-mode-hook
                    prog-mode-hook
                    conf-mode-hook))
      (add-hook mode (lambda () (display-line-numbers-mode 1))))

  (dolist (mode '(org-mode-hook))
    (add-hook mode (lambda ()
                     (display-line-numbers-mode 0)
                     (setq-local global-hl-line-mode nil))))
(dolist (mode '(vterm-mode-hook))
  (add-hook mode (lambda ()
                   (display-line-numbers-mode 0)
                   (setq-local global-hl-line-mode nil))))
  (dolist (mode '(magit-mode-hook))
    (dolist (mode '(org-mode-hook))
      (add-hook mode (lambda ()
                       (display-line-numbers-mode 0)
                       (setq-local global-hl-line-mode nil))))
  (dolist (mode '(vterm-mode-hook))
    (add-hook mode (lambda ()
                     (display-line-numbers-mode 0)
                     (setq-local global-hl-line-mode nil))))
    (dolist (mode '(magit-mode-hook))
      (add-hook mode (lambda ()
                       (display-line-numbers-mode 0)
                       (setq-local global-hl-line-mode nil))))
#+END_SRC

Update that load path.


@@ 439,7 439,7 @@ this font name! And if we're talking about fonts, you gotta have
emojis.

#+BEGIN_SRC emacs-lisp
(add-to-list 'default-frame-alist '(font . "JetBrainsMono Nerd Font 12"))
(add-to-list 'default-frame-alist '(font . "JetBrains Mono 12"))
(use-package emojify
  :hook (erc-mode . emojify-mode)
  :commands emojify-mode)


@@ 798,6 798,8 @@ Allows for annotations of commands, files, and more.
  (corfu-auto t)             ;; Enable auto completion
  (corfu-quit-at-boundary t) ;; Automatically quit at word boundary
  (corfu-quit-no-match t)    ;; Automatically quit if there is no match
  (corfu-auto-delay 0)
  (corfu-auto-prefix 2)
  :bind (:map corfu-map
          ("TAB" . corfu-next)
          ([tab] . corfu-next)


@@ 1036,34 1038,37 @@ The ultimate incarnation of Doc View, that allows you to read (and
modify) PDFs in Emacs.

#+BEGIN_SRC emacs-lisp
;; wrapper for save-buffer ignoring arguments
(defun bjm/save-buffer-no-args ()
  "Save buffer ignoring arguments"
  (save-buffer))
(setq catster/use-pdf-view nil)

(use-package pdf-tools
  :config
  ;; initialise
  (pdf-tools-install :no-query)
  (setq-default pdf-view-display-size 'fit-page)
  ;; automatically annotate highlights
  (setq pdf-annot-activate-created-annotations t)
  ;; use isearch instead of swiper
  (define-key pdf-view-mode-map (kbd "C-s") 'isearch-forward)
  ;; turn off cua so copy works
  (add-hook 'pdf-view-mode-hook (lambda () (cua-mode 0)))
  ;; more fine-grained zooming
  (setq pdf-view-resize-factor 1.1)
  ;; keyboard shortcuts
  (define-key pdf-view-mode-map (kbd "h") 'pdf-annot-add-highlight-markup-annotation)
  (define-key pdf-view-mode-map (kbd "t") 'pdf-annot-add-text-annotation)
  (define-key pdf-view-mode-map (kbd "D") 'pdf-annot-delete)
  ;; wait until map is available
  (with-eval-after-load "pdf-annot"
    (define-key pdf-annot-edit-contents-minor-mode-map (kbd "<return>") 'pdf-annot-edit-contents-commit)
    (define-key pdf-annot-edit-contents-minor-mode-map (kbd "<S-return>") 'newline)
    ;; save after adding comment
    (advice-add 'pdf-annot-edit-contents-commit :after 'bjm/save-buffer-no-args)))
(when catster/use-pdf-view
  ;; wrapper for save-buffer ignoring arguments
  (defun bjm/save-buffer-no-args ()
    "Save buffer ignoring arguments"
    (save-buffer))

  (use-package pdf-tools
    :config
    ;; initialise
    (pdf-tools-install :no-query)
    (setq-default pdf-view-display-size 'fit-page)
    ;; automatically annotate highlights
    (setq pdf-annot-activate-created-annotations t)
    ;; use isearch instead of swiper
    (define-key pdf-view-mode-map (kbd "C-s") 'isearch-forward)
    ;; turn off cua so copy works
    (add-hook 'pdf-view-mode-hook (lambda () (cua-mode 0)))
    ;; more fine-grained zooming
    (setq pdf-view-resize-factor 1.1)
    ;; keyboard shortcuts
    (define-key pdf-view-mode-map (kbd "h") 'pdf-annot-add-highlight-markup-annotation)
    (define-key pdf-view-mode-map (kbd "t") 'pdf-annot-add-text-annotation)
    (define-key pdf-view-mode-map (kbd "D") 'pdf-annot-delete)
    ;; wait until map is available
    (with-eval-after-load "pdf-annot"
      (define-key pdf-annot-edit-contents-minor-mode-map (kbd "<return>") 'pdf-annot-edit-contents-commit)
      (define-key pdf-annot-edit-contents-minor-mode-map (kbd "<S-return>") 'newline)
      ;; save after adding comment
      (advice-add 'pdf-annot-edit-contents-commit :after 'bjm/save-buffer-no-args))))
#+END_SRC
* Programs and Extensions
** Docker


@@ 1300,7 1305,7 @@ Emacs slow downs when sending mail (which in combination with pgtk and
native-comp should be phenomenal!)

#+BEGIN_SRC emacs-lisp
(setq catster/use-mail t)
(setq catster/use-mail nil)

(when catster/use-mail
  (add-to-list 'load-path "~/.emacs.d/mu4e/")


@@ 1393,9 1398,7 @@ phenomenal, allowing for a proper debugging experience within Emacs
  (use-package lsp-mode
    :defer t
    :hook (((rustic-mode
	     python-mode
	     c-mode
	     c++-mode
       python-mode
	     rjsx-mode
	     web-mode
	     typescript-mode


@@ 1611,26 1614,6 @@ Just make sure to have clang installed!
  :after (cmake-mode)
  :hook (cmake-mode . cmake-font-lock-activate))

(use-package cmake-ide
  :after projectile
  :hook (c++-mode . my/cmake-ide-find-project)
  :preface
  (defun my/cmake-ide-find-project ()
    "Finds the directory of the project for cmake-ide."
    (with-eval-after-load 'projectile
      (setq cmake-ide-project-dir (projectile-project-root))
      (setq cmake-ide-build-dir (concat cmake-ide-project-dir "build")))
    (setq cmake-ide-compile-command
          (concat "cd " cmake-ide-build-dir " && cmake .. && make"))
    (cmake-ide-load-db))

  (defun my/switch-to-compilation-window ()
    "Switches to the *compilation* buffer after compilation."
    (other-window 1))
  :bind ([remap comment-region] . cmake-ide-compile)
  :init (cmake-ide-setup)
  :config (advice-add 'cmake-ide-compile :after #'my/switch-to-compilation-window))

(use-package google-c-style
  :hook ((c-mode c++-mode) . google-set-c-style)
  (c-mode-common . google-make-newline-indent))

M init.el => init.el +48 -67
@@ 37,7 37,7 @@

;; Disabling bidirectional text rendering gives a performance boost.
(setq-default bidi-display-reordering 'left-to-right
	            bidi-paragraph-direction nil)
              bidi-paragraph-direction nil)
(setq bidi-inhibit-bpa t)

;; Don't render in non-focused, why would you?


@@ 76,8 76,8 @@
;; Of course Windows does it's own thing D:
(when IS-WINDOWS
  (setq w32-get-true-file-attributes nil
	      w32-pipe-read-delay 0
	      w32-pipe-buffer-size (* 64 1024)))
        w32-pipe-read-delay 0
        w32-pipe-buffer-size (* 64 1024)))

;; Remove unnecessary CLI options
(unless IS-MAC   (setq command-line-ns-option-alist nil))


@@ 96,12 96,12 @@
(setq gnutls-verify-error (not (getenv-internal "INSECURE"))
      gnutls-algorithm-priority
      (when (boundp 'libgnutls-version)
	      (concat "SECURE128:+SECURE192:-VERS-ALL"
		            (if (and (not IS-WINDOWS)
			                   (not (version< emacs-version "26.3"))
			                   (>= libgnutls-version 30605))
		                ":+VERS-TLS1.3")
		            ":+VERS-TLS1.2"))
        (concat "SECURE128:+SECURE192:-VERS-ALL"
                (if (and (not IS-WINDOWS)
                         (not (version< emacs-version "26.3"))
                         (>= libgnutls-version 30605))
                    ":+VERS-TLS1.3")
                ":+VERS-TLS1.2"))
      ;; `gnutls-min-prime-bits' is set based on recommendations from
      ;; https://www.keylength.com/en/4/
      gnutls-min-prime-bits 3072


@@ 111,7 111,7 @@
;; Emacs stores `authinfo' in $HOME and in plain-text. WHY!?
(setq auth-sources (list (concat user-emacs-directory "authinfo.gpg")
                         "~/.authinfo"
			                   "~/.authinfo.gpg"))
                         "~/.authinfo.gpg"))

;; Of course Windows does it's own thing.
(when (and IS-WINDOWS (null (getenv-internal "HOME")))


@@ 164,6 164,11 @@
  :config
  (global-so-long-mode 1))

(when IS-MAC
  (use-package exec-path-from-shell
    :init
    (exec-path-from-shell-initialize)))

(setq tramp-default-method "ssh")

(use-package auto-sudoedit


@@ 171,11 176,6 @@
  :config
  (auto-sudoedit-mode 1))

(set-frame-parameter (selected-frame) 'alpha '(97 . 97))
(add-to-list 'default-frame-alist '(alpha . (97 . 97)))
(set-frame-parameter (selected-frame) 'fullscreen 'maximized)
(add-to-list 'default-frame-alist '(fullscreen . maximized))

(remove-hook 'find-file-hooks 'vc-find-file-hook)
(setq vc-follow-symlinks t)



@@ 239,7 239,7 @@

(add-hook 'before-save-hook 'delete-trailing-whitespace)

(add-to-list 'default-frame-alist '(font . "JetBrainsMono Nerd Font 12"))
(add-to-list 'default-frame-alist '(font . "JetBrains Mono 12"))
(use-package emojify
  :hook (erc-mode . emojify-mode)
  :commands emojify-mode)


@@ 684,34 684,37 @@
(winner-mode)
(add-hook 'ediff-after-quit-hook-internal 'winner-undo)

;; wrapper for save-buffer ignoring arguments
(defun bjm/save-buffer-no-args ()
  "Save buffer ignoring arguments"
  (save-buffer))
(setq catster/use-pdf-view nil)

(use-package pdf-tools
  :config
  ;; initialise
  (pdf-tools-install :no-query)
  (setq-default pdf-view-display-size 'fit-page)
  ;; automatically annotate highlights
  (setq pdf-annot-activate-created-annotations t)
  ;; use isearch instead of swiper
  (define-key pdf-view-mode-map (kbd "C-s") 'isearch-forward)
  ;; turn off cua so copy works
  (add-hook 'pdf-view-mode-hook (lambda () (cua-mode 0)))
  ;; more fine-grained zooming
  (setq pdf-view-resize-factor 1.1)
  ;; keyboard shortcuts
  (define-key pdf-view-mode-map (kbd "h") 'pdf-annot-add-highlight-markup-annotation)
  (define-key pdf-view-mode-map (kbd "t") 'pdf-annot-add-text-annotation)
  (define-key pdf-view-mode-map (kbd "D") 'pdf-annot-delete)
  ;; wait until map is available
  (with-eval-after-load "pdf-annot"
    (define-key pdf-annot-edit-contents-minor-mode-map (kbd "<return>") 'pdf-annot-edit-contents-commit)
    (define-key pdf-annot-edit-contents-minor-mode-map (kbd "<S-return>") 'newline)
    ;; save after adding comment
    (advice-add 'pdf-annot-edit-contents-commit :after 'bjm/save-buffer-no-args)))
(when catster/use-pdf-view
  ;; wrapper for save-buffer ignoring arguments
  (defun bjm/save-buffer-no-args ()
    "Save buffer ignoring arguments"
    (save-buffer))

  (use-package pdf-tools
    :config
    ;; initialise
    (pdf-tools-install :no-query)
    (setq-default pdf-view-display-size 'fit-page)
    ;; automatically annotate highlights
    (setq pdf-annot-activate-created-annotations t)
    ;; use isearch instead of swiper
    (define-key pdf-view-mode-map (kbd "C-s") 'isearch-forward)
    ;; turn off cua so copy works
    (add-hook 'pdf-view-mode-hook (lambda () (cua-mode 0)))
    ;; more fine-grained zooming
    (setq pdf-view-resize-factor 1.1)
    ;; keyboard shortcuts
    (define-key pdf-view-mode-map (kbd "h") 'pdf-annot-add-highlight-markup-annotation)
    (define-key pdf-view-mode-map (kbd "t") 'pdf-annot-add-text-annotation)
    (define-key pdf-view-mode-map (kbd "D") 'pdf-annot-delete)
    ;; wait until map is available
    (with-eval-after-load "pdf-annot"
      (define-key pdf-annot-edit-contents-minor-mode-map (kbd "<return>") 'pdf-annot-edit-contents-commit)
      (define-key pdf-annot-edit-contents-minor-mode-map (kbd "<S-return>") 'newline)
      ;; save after adding comment
      (advice-add 'pdf-annot-edit-contents-commit :after 'bjm/save-buffer-no-args))))

(use-package dockerfile-mode
  :mode "Dockerfile\\'")


@@ 878,7 881,7 @@

(use-package simple-httpd)

(setq catster/use-mail t)
(setq catster/use-mail nil)

(when catster/use-mail
  (add-to-list 'load-path "~/.emacs.d/mu4e/")


@@ 924,9 927,7 @@
(use-package lsp-mode
  :defer t
  :hook (((rustic-mode
	   python-mode
	   c-mode
	   c++-mode
     python-mode
	   rjsx-mode
	   web-mode
	   typescript-mode


@@ 1084,26 1085,6 @@
  :after (cmake-mode)
  :hook (cmake-mode . cmake-font-lock-activate))

(use-package cmake-ide
  :after projectile
  :hook (c++-mode . my/cmake-ide-find-project)
  :preface
  (defun my/cmake-ide-find-project ()
    "Finds the directory of the project for cmake-ide."
    (with-eval-after-load 'projectile
      (setq cmake-ide-project-dir (projectile-project-root))
      (setq cmake-ide-build-dir (concat cmake-ide-project-dir "build")))
    (setq cmake-ide-compile-command
          (concat "cd " cmake-ide-build-dir " && cmake .. && make"))
    (cmake-ide-load-db))

  (defun my/switch-to-compilation-window ()
    "Switches to the *compilation* buffer after compilation."
    (other-window 1))
  :bind ([remap comment-region] . cmake-ide-compile)
  :init (cmake-ide-setup)
  :config (advice-add 'cmake-ide-compile :after #'my/switch-to-compilation-window))

(use-package google-c-style
  :hook ((c-mode c++-mode) . google-set-c-style)
  (c-mode-common . google-make-newline-indent))