Commit 336a4dac0867

Vincent Demeester <vincent@sbr.pm>
2022-09-28 17:02:03
tools/emacs: explore starting from scratch
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent e027c1b
tools/emacs/lisp/org-focus.el
@@ -0,0 +1,49 @@
+;; From http://www.howardism.org/Technical/Emacs/focused-work.html
+;; Write something a bit similar, but better ?
+
+(defvar vde/focus-timer nil "A timer reference for the vde/focus functions")
+
+(defun vde/focus-countdown-timer (minutes fun)
+  (let ((the-future (* minutes 60)))
+    (run-at-time the-future nil fun)))
+
+(defun vde/focus-begin ()
+  "Start a concerted, focused effort, ala Pomodoro Technique.
+We first clock into the current org-mode header (or last one),
+start some music to indicate we are working, and set a timer.
+
+Call `ha-focus-break' when finished."
+  (interactive)
+  (vde/focus-countdown-timer 25 'vde/focus-break)
+  (vde/focus--command "playerctl play-pause")
+  (vde/focus--command "notify-send 'Let's focus.'")
+  (vde/focus--command "swaync-client -d")
+  (if (eq major-mode 'org-mode)
+      (org-clock-in)
+    (org-clock-in-last)))
+
+(defun vde/focus-break ()
+  "Stop the focused time by stopping the music.
+This also starts another break timer, that calls
+`ha-focus-break-over' when finished."
+  (interactive)
+  (vde/focus-countdown-timer 5 'vde/focus-break-over)
+  (vde/focus--command "swaync-client -d")
+  (vde/focus--command "notify-send 'Let's take a break.'")
+  (vde/focus--command "playerctl play-pause")
+  (org-clock-out)
+  (message "Time to take a break."))
+
+(defun vde/focus-break-over ()
+  "Message me to know that the break time is over. Notice that
+this doesn't start anything automatically, as I may have simply
+wandered off."
+  (vde/focus--command "notify-send 'Break is over.'"))
+
+(defun vde/focus--command (command)
+  "Runs COMMAND by passing to the `command' command asynchronously."
+  (async-start-process "focus-os" "zsh" 'vde/focus--command-callback "-c" command))
+
+(defun vde/focus--command-callback (proc)
+  "Asynchronously called when the `osascript' process finishes."
+  (message "Finished calling command."))
tools/emacs/lisp/vde-buffers.el
@@ -0,0 +1,11 @@
+;;; vde-buffers.el --- -*- lexical-binding: t; -*-
+;; Commentary:
+;;; Helper function related to buffers
+;; Code:
+
+;;;###autoload
+(defun vde/buffer-has-project-p (buffer action)
+  (with-current-buffer buffer (project-current nil)))
+
+(provide 'vde-buffers)
+;;; vde-buffers.el ends here
tools/emacs/lisp/vde-windows.el
@@ -0,0 +1,35 @@
+;;; vde-windows.el --- -*- lexical-binding: t; -*-
+;; Commentary:
+;;; Helper function related to window management
+;; Code:
+
+;;;###autoload
+(defun vde/split-window-below (arg)
+  "Split window below from the parent or from the roo with ARG."
+  (interactive "P")
+  (split-window (if arg (frame-root-window)
+		 (window-parent (selected-window)))
+	       nil 'below nil))
+
+;;;###autoload
+(defun vde/split-window-right (arg)
+  "Split window right from the parent or from the roo with ARG."
+  (interactive "P")
+  (split-window (if arg (frame-root-window)
+		 (window-parent (selected-window)))
+		nil 'right nil))
+
+;;;###autoload
+(defun vde/toggle-window-dedication ()
+  "Toggles window dedication in the selected window."
+  (interactive)
+  (set-window-dedicated-p (selected-window)
+			  (not (window-dedicated-p (selected-window)))))
+
+;;;###autoload
+(defun make-display-buffer-matcher-function (major-modes)
+  (lambda (buffer-name action)
+    (with-current-buffer buffer-name (apply #'derived-mode-p major-modes))))
+
+(provide 'vde-windows)
+;;; vde-windows.el ends here
tools/emacs/scratch/config/00-base.el
@@ -0,0 +1,44 @@
+;;; 00-base.el --- -*- lexical-binding: t; -*-
+;;; Commentary:
+;;; Emacs *absolute* base configuration
+;;; Code:
+
+(setq frame-title-form '("%b")) ;; do not add "GNU Emacs at …"
+(setq use-short-answers t)      ;; for emacs and above, replace defalias yes-or-no-p
+(setq read-answer-short t)      ;; accepts single-character answers, very similar to above
+
+(put 'overwrite-mode 'disabled t) ;; I don't really want to use overwrite-mod, ever
+(setq initial-buffer-choice t)    ;; always start with *scratch*
+
+(setq use-dialog-box nil)  ;; never use dialog box (no mouse >:D)
+(setq use-file-dialog nil) ;; never use file dialog (gtk)
+(setq echo-keystrokes 0.1) ;; display command keystrokes quickly
+
+(global-unset-key (kbd "C-z"))
+(global-unset-key (kbd "C-x C-z"))
+(global-unset-key (kbd "C-h h"))
+
+;; Custom file management
+(defconst vde/custom-file (locate-user-emacs-file "custom.el")
+  "File used to store settings from Customization UI.")
+
+(setq minibuffer-prompt-properties
+      '(read-only t cursor-intangible t face minibuffer-prompt))
+
+(add-hook 'minibuffer-setup-hook #'cursor-intangible-mode)
+
+(use-package cus-edit
+  :config
+  (setq
+   custom-file vde/custom-file
+   custom-buffer-done-kill nil          ; Kill when existing
+   custom-buffer-verbose-help nil       ; Remove redundant help text
+   custom-unlispify-tag-names nil       ; Show me the real variable name
+   custom-unlispify-menu-entries nil)
+  (unless (file-exists-p custom-file)
+    (write-region "" nil custom-file))
+
+  (load vde/custom-file 'no-error 'no-message))
+
+(provide '00-base)
+;;; 00-base.el ends here
tools/emacs/scratch/config/00-clean.el
@@ -0,0 +1,64 @@
+;;; 00-clean.el --- -*- lexical-binding: t; -*-
+;;; Commentary:
+;;; no-littering and recentf configurations
+;;; Note: this file is autogenerated from an org-mode file.
+;;; Code:
+(use-package recentf
+  :config
+  (setq recentf-max-saved-items 200
+        recentf-auto-cleanup 360
+        recentf-show-file-shortcuts-flag nil)
+  (recentf-mode 1)
+  (add-to-list 'recentf-exclude "^/\\(?:ssh\\|su\\|sudo\\)?:")
+  ;; Magic advice to rename entries in recentf when moving files in
+  ;; dired.
+  (defun rjs/recentf-rename-notify (oldname newname &rest args)
+    (if (file-directory-p newname)
+        (rjs/recentf-rename-directory oldname newname)
+      (rjs/recentf-rename-file oldname newname)))
+
+  (defun rjs/recentf-rename-file (oldname newname)
+    (setq recentf-list
+          (mapcar (lambda (name)
+                    (if (string-equal name oldname)
+                        newname
+                      oldname))
+                  recentf-list))
+    recentf-cleanup)
+
+  (defun rjs/recentf-rename-directory (oldname newname)
+    ;; oldname, newname and all entries of recentf-list should already
+    ;; be absolute and normalised so I think this can just test whether
+    ;; oldname is a prefix of the element.
+    (setq recentf-list
+          (mapcar (lambda (name)
+                    (if (string-prefix-p oldname name)
+                        (concat newname (substring name (length oldname)))
+                      name))
+                  recentf-list))
+    recentf-cleanup)
+
+  (advice-add 'dired-rename-file :after #'rjs/recentf-rename-notify))
+
+(use-package no-littering               ; Keep .emacs.d clean
+  :config
+  (require 'recentf)
+  (add-to-list 'recentf-exclude no-littering-var-directory)
+  (add-to-list 'recentf-exclude no-littering-etc-directory)
+
+  ;; Move this in its own thing
+  (setq
+   create-lockfiles nil
+   delete-old-versions t
+   kept-new-versions 6
+   kept-old-versions 2
+   version-control t)
+
+  (setq
+   backup-directory-alist
+   `((".*" . ,(no-littering-expand-var-file-name "backup/")))
+   auto-save-file-name-transforms
+   `((".*" ,(no-littering-expand-var-file-name "auto-save/") t))))
+
+(provide '00-clean)
+;;; 00-clean.el ends here
tools/emacs/scratch/config/config-appearance.el
@@ -0,0 +1,250 @@
+;;; config-appearance.el --- -*- lexical-binding: t -*-
+;;; Commentary:
+;;; Appearance configuration
+;;; Code:
+
+;; Extract this
+(use-package emacs
+  :defer 3
+  :bind ("C-c f r" . mu-reset-fonts)
+  :commands (mu-reset-fonts)
+  :hook (after-init . mu-reset-fonts)
+  :config
+  ;; For displaying emojies 😛🦁
+  (set-fontset-font t 'symbol "Apple Color Emoji")
+  (set-fontset-font t 'symbol "Noto Color Emoji" nil 'append)
+  (set-fontset-font t 'symbol "Segoe UI Emoji" nil 'append)
+  (set-fontset-font t 'symbol "Symbola" nil 'append)
+  (defun mu-reset-fonts ()
+    "Reset fonts to my preferences."
+    (interactive)
+    (when (member font-family-mono (font-family-list))
+      (set-face-attribute 'default nil
+                          :family font-family-mono
+                          :height font-height)
+      (set-face-attribute 'fixed-pitch nil
+                          :family font-family-mono))
+    (when (member font-family-sans (font-family-list))
+      (set-face-attribute 'variable-pitch nil
+                          :family font-family-sans
+                          :weight 'regular))
+    (set-fontset-font t 'symbol "Apple Color Emoji")
+    (set-fontset-font t 'symbol "Noto Color Emoji" nil 'append)
+    (set-fontset-font t 'symbol "Segoe UI Emoji" nil 'append)
+    (set-fontset-font t 'symbol "Symbola" nil 'append)))
+
+(use-package emacs
+  :config
+  (setq-default line-number-display-limit-width 10000
+                indicate-buffer-boundaries 'left
+                indicate-empty-lines +1)
+  (line-number-mode 1)
+  (column-number-mode 1)
+  ;; let's enable it for all programming major modes
+  (add-hook 'prog-mode-hook #'hl-line-mode)
+  ;; and for all modes derived from text-mode
+  (add-hook 'text-mode-hook #'hl-line-mode))
+
+(use-package hl-todo
+  :commands (hl-todo-mode)
+  :hook ((prog-mode . hl-todo-mode)))
+
+(use-package frame
+  :unless noninteractive
+  :commands vde/cursor-type-mode
+  :config
+  (setq-default cursor-type 'box)
+  (setq-default cursor-in-non-selected-windows '(bar . 2))
+  (setq-default blink-cursor-blinks 50)
+  (setq-default blink-cursor-interval nil) ; 0.75 would be my choice
+  (setq-default blink-cursor-delay 0.2)
+
+  (blink-cursor-mode -1)
+
+  (define-minor-mode vde/cursor-type-mode
+    "Toggle between static block and pulsing bar cursor."
+    :init-value nil
+    :global t
+    (if vde/cursor-type-mode
+        (progn
+          (setq-local blink-cursor-interval 0.75
+                      cursor-type '(bar . 2)
+                      cursor-in-non-selected-windows 'hollow)
+          (blink-cursor-mode 1))
+      (dolist (local '(blink-cursor-interval
+                       cursor-type
+                       cursor-in-non-selected-windows))
+        (kill-local-variable `,local))
+      (blink-cursor-mode -1))))
+
+(use-package emacs
+  :config
+  (setq-default custom-safe-themes t)
+  (setq-default custom--inhibit-theme-enable nil)
+
+  (defun vde/before-load-theme (&rest args)
+    "Clear existing theme settings instead of layering them.
+Ignores `ARGS'."
+    (mapc #'disable-theme custom-enabled-themes))
+
+  (advice-add 'load-theme :before #'vde/before-load-theme))
+
+(use-package emacs
+  :config
+  (setq window-divider-default-right-width 1)
+  (setq window-divider-default-bottom-width 1)
+  (setq window-divider-default-places 'right-only)
+  :hook (after-init . window-divider-mode))
+
+(use-package tab-bar
+  :unless noninteractive
+  :config
+  (setq-default tab-bar-close-button-show nil)
+  (setq-default tab-bar-close-last-tab-choice 'tab-bar-mode-disable)
+  (setq-default tab-bar-close-tab-select 'recent)
+  (setq-default tab-bar-new-tab-choice t)
+  (setq-default tab-bar-new-tab-to 'right)
+  (setq-default tab-bar-position nil)
+  (setq-default tab-bar-show t)
+  (setq-default tab-bar-tab-hints nil)
+  (setq-default tab-bar-tab-name-function 'vde/tab-bar-tab-name)
+
+  (defun vde/tab-bar-tab-name ()
+    "Generate tab name from the buffer of the selected window *or* project."
+    (cond
+     ((project-current) (let ((project-path (vde-project--project-current)))
+                          (cond ((string-prefix-p "~/src" project-path)
+                                 (directory-file-name (file-relative-name project-path "~/src")))
+                                ((string-prefix-p "~/desktop" project-path)
+                                 (directory-file-name (file-relative-name project-path "~/desktop")))
+                                ((string-prefix-p "/etc" project-path)
+                                 (directory-file-name (file-relative-name project-path "/etc")))
+                                (t
+                                 (file-relative-name project-path)))))
+     (t (tab-bar-tab-name-current-with-count))))
+
+  (defun vde/complete-tab-bar-tab-dwim ()
+    "Do-What-I-Mean function for getting to a `tab-bar-mode' tab.
+If no other tab exists, create one and switch to it.  If there is
+one other tab (so two in total) switch to it without further
+questions.  Else use completion to select the tab to switch to."
+    (interactive)
+    (let ((tabs (mapcar (lambda (tab)
+                          (alist-get 'name tab))
+                        (tab-bar--tabs-recent))))
+      (cond ((eq tabs nil)
+             (tab-new))
+            ((eq (length tabs) 1)
+             (tab-next))
+            (t
+             (tab-bar-switch-to-tab
+              (completing-read "Select tab: " tabs nil t))))))
+
+  :bind (("C-x t t" . vde/complete-tab-bar-tab-dwim)
+         ("C-x t s" . tab-switcher)))
+
+(use-package moody
+  :unless noninteractive
+  :config
+  (setq-default x-underline-at-descent-line t
+                ;; Show buffer position percentage starting from top
+                mode-line-percent-position '(-3 "%o"))
+
+  (setq-default mode-line-format
+                '("%e"
+                  mode-line-front-space
+                  mode-line-client
+                  mode-line-modified
+                  mode-line-remote
+                  mode-line-frame-identification
+                  mode-line-buffer-identification " " mode-line-position
+                  (vc-mode vc-mode)
+                  (multiple-cursors-mode mc/mode-line)
+                  " " mode-line-modes
+                  mode-line-end-spaces))
+
+  (setq-default global-mode-string (remove 'display-time-string global-mode-string)
+                mode-line-end-spaces
+                (list (propertize " " 'display '(space :align-to (- right 19)))
+                      'display-time-string))
+  (advice-add #'vc-git-mode-line-string :filter-return #'my-replace-git-status)
+  (defun my-replace-git-status (tstr)
+    (let* ((tstr (replace-regexp-in-string "Git" "" tstr))
+           (first-char (substring tstr 0 1))
+           (rest-chars (substring tstr 1)))
+      (cond
+       ((string= ":" first-char) ;;; Modified
+        (replace-regexp-in-string "^:" "~ " tstr))
+       ((string= "-" first-char) ;; No change
+        (replace-regexp-in-string "^-" "- " tstr))
+       (t tstr))))
+  (moody-replace-mode-line-buffer-identification)
+  (moody-replace-vc-mode))
+
+(use-package minions
+  :unless noninteractive
+  :config
+  (setq-default minions-mode-line-lighter "λ="
+                minions-mode-line-delimiters '("" . "")
+                minions-direct '(flycheck-mode))
+  (minions-mode +1))
+
+(use-package time
+  :unless noninteractive
+  :config
+  (setq-default display-time-24hr-format t
+                display-time-day-and-date t
+                display-time-world-list '(("Europe/Paris" "Paris")
+                                          ("Europe/London" "London")
+                                          ("America/New_York" "Boston")
+                                          ("America/Los_Angeles" "San Francisco")
+                                          ("Asia/Calcutta" "Bangalore")
+                                          ("Australia/Brisbane" "Brisbane"))
+                display-time-string-forms
+                '((format "%s %s %s, %s:%s"
+                          dayname
+                          monthname day
+                          24-hours minutes)))
+  (display-time))
+
+(use-package lin
+  :unless noninteractive
+  :config
+  (setq lin-face 'lin-blue)
+  (setq lin-mode-hooks
+	'(bongo-mode-hook
+          dired-mode-hook
+          elfeed-search-mode-hook
+          git-rebase-mode-hook
+          ibuffer-mode-hook
+          ilist-mode-hook
+          ledger-report-mode-hook
+          log-view-mode-hook
+          magit-log-mode-hook
+          mu4e-headers-mode
+          notmuch-search-mode-hook
+          notmuch-tree-mode-hook
+          occur-mode-hook
+          org-agenda-mode-hook
+          tabulated-list-mode-hook))
+  (lin-global-mode))
+
+(use-package tooltip
+  :unless noninteractive
+  :config
+  (setq tooltip-delay 0.5)
+  (setq tooltip-short-delay 0.5)
+  (setq x-gtk-use-system-tooltips nil)
+  (setq tooltip-frame-parameters
+        '((name . "tooltip")
+          (internal-border-width . 6)
+          (border-width . 0)
+          (no-special-glyphs . t)))
+  :hook (after-init-hook . tooltip-mode))
+
+(use-package alert
+  :config
+  (setq alert-default-style 'libnotify))
+
+(provide 'config-appearance)
+;;; config-appearance.el ends here
tools/emacs/scratch/config/config-misc.el
@@ -0,0 +1,17 @@
+;;; config-misc.el --- -*- lexical-binding: t; -*-
+;;; Commentary:
+;;; Miscellaneous modes configuration
+;;; Code:
+
+(use-package helpful
+  :unless noninteractive
+  :bind (("C-h f" . helpful-callable)
+         ("C-h F" . helpful-function)
+         ("C-h M" . helpful-macro)
+         ("C-c h S" . helpful-at-point)
+         ("C-h k" . helpful-key)
+         ("C-h v" . helpful-variable)
+         ("C-h C" . helpful-command)))
+
+(provide 'config-misc)
+;;; config-misc.el ends here
tools/emacs/scratch/config/config-windows.el
@@ -0,0 +1,82 @@
+;;; config-windows.el ---  -*- lexical-binding: t; -*-
+;; Commentary:
+;;; Windows configuration
+;; Code:
+
+;; By default, emacs distinguishes between automatic and manual window switching.
+;; It can make it weird, so… let's make sure it has the same behavior for both
+;; See: https://www.masteringemacs.org/article/demystifying-emacs-window-manager
+(setq switch-to-buffer-obey-display-actions t)
+(setq switch-to-buffer-in-dedicated-window 'pop)
+
+(use-package winner
+  :unless noninteractive
+  :defer 5
+  :config
+  (winner-mode 1))
+
+(use-package windmove
+  :unless noninteractive
+  :commands (windmove-left windmove-right windmove-down windmove-up)
+  :bind (("C-M-<up>" . windmove-up)
+         ("C-M-<right>" . windmove-right)
+         ("C-M-<down>" . windmove-down)
+         ("C-M-<left>" . windmove-left)))
+
+(use-package emacs
+  :unless noninteractive
+  :bind (("M-o" . other-window))
+  :config
+  ;; left, top, right, bottom
+  (setq window-sides-slots '(1 1 1 2))
+  ;; Configure `display-buffer' behaviour for some special buffers
+  ;; To get a list of action, `C-u C-h a ^display-buffer-[^-]'.
+  (setq-default display-buffer-alist
+		'(
+		  ;; helpful buffers are displayed on top
+                  ("\\*\\(helpful\\).*"
+                   (display-buffer-in-side-window)
+                   (window-height . 0.25)
+                   (side . top)
+                   (slot . 0)
+		   (display-buffer-reuse-window display-buffer-pop-up-window)
+		   (inhibit-same-window . t))
+		  ;; compilation buffer rules
+		  ;; compilation can be "per project", like `*home-compilation*'.
+		  ("\\*.*Compilation.*\\*"
+		   display-buffer-reuse-window)
+		  ;; `*info*' should be display on a side window, with a 80 width
+		  ;; and no-delete-other-windows (`C-x 1' will not hide this one)
+		  ("\\*info\\*"
+		   (display-buffer-in-side-window)
+		   (side . right)
+		   (slot . 0)
+		   (window-width . 80)
+		   (window-parameters
+		    (no-delete-other-windows . t)))
+		  ;; vterm rules : reuse a window with vtrm or vterm-copy-mode
+		  ("\\*vterm.*\\*"display-buffer-reuse-mode-window
+		   ;; change to `t' to not reuse same window
+		   (inhibit-same-window . nil)
+		   (mode vterm-mode vterm-copy-mode))
+		  ;; eshell/shells ruls
+		  ("\\*.*e?shell.*"
+		   display-buffer-in-direction
+		   (direction . bottom)
+		   (window . root)
+		   (window-height . 0.3))
+		  ;; Collecting "relatively random" buffers in the same window
+		  (,(rx (| "*xref*"
+			   "*grep*"
+			   "*Occur*"))
+		   display-buffer-reuse-window
+		   (inhibit-same-window . nil))
+		  ;; FIXME: this is an example, tailor this for go dev (and rust, …)
+		  ("^test[-_]"
+		   display-buffer-in-direction
+		   (direction . right))
+		  ))
+  )
+
+(provide 'config-windows)
+;;; config-windows ends here
tools/emacs/scratch/eshell/lastdir
@@ -0,0 +1,2 @@
+~/src/home/tools/emacs
+/ssh:aomi.home:/home/vincent/src
tools/emacs/scratch/init.el
@@ -0,0 +1,173 @@
+(setq user-emacs-directory "~/.config/emacs/scratch")
+
+;; Do not initialize installed packages
+(setq package-enable-at-startup nil)
+
+;; Do not resize the frame at this early stage
+(setq frame-inhibit-implied-resize t)
+
+;; Disable GUI elements
+(menu-bar-mode -1)
+(tool-bar-mode -1)
+(scroll-bar-mode -1)
+(horizontal-scroll-bar-mode -1)
+
+(setq gc-cons-threshold 402653184
+      gc-cons-percentage 0.6)
+
+(add-to-list 'load-path (expand-file-name (concat user-emacs-directory "/../lisp/")))
+(add-to-list 'load-path (expand-file-name (concat user-emacs-directory "/lisp/")))
+
+(require 'init-func)
+(require 'modus-themes)
+(defun vde/modus-vivendi ()
+  "Enable modus-vivendi with some customizations."
+  (interactive)
+  (setq modus-themes-mode-line '(moody))
+  (modus-themes-load-vivendi))
+(defun vde/modus-operandi ()
+  "Enable modus-operandi with some customizations."
+  (interactive)
+  (setq modus-themes-mode-line '(moody))
+  (modus-themes-load-operandi))
+(vde/modus-operandi)
+
+(defconst font-height 130
+  "Default font-height to use.")
+(defconst font-family-mono "Ubuntu Mono"
+  "Default monospace font-family to use.")
+(defconst font-family-sans "Ubuntu Sans"
+  "Default sans font-family to use.")
+;; Middle/Near East: שלום, السّلام عليكم
+(when (member "Noto Sans Arabic" (font-family-list))
+  (set-fontset-font t 'arabic "Noto Sans Arabic"))
+(when (member "Noto Sans Hebrew" (font-family-list))
+  (set-fontset-font t 'arabic "Noto Sans Hebrew"))
+;; Africa: ሠላም
+(when (member "Noto Sans Ethiopic" (font-family-list))
+  (set-fontset-font t 'ethiopic "Noto Sans Ethiopic"))
+
+;; If font-family-mono or font-family-sans are not available, use the default Emacs face
+(when (member font-family-mono (font-family-list))
+  (set-face-attribute 'default nil
+                      :family font-family-mono
+                      :height font-height)
+  (set-face-attribute 'fixed-pitch nil
+                      :family font-family-mono))
+(when (member font-family-sans (font-family-list))
+  (set-face-attribute 'variable-pitch nil
+                      :family font-family-sans
+                      :weight 'regular))
+
+(set-fontset-font t 'symbol "Apple Color Emoji")
+(set-fontset-font t 'symbol "Noto Color Emoji" nil 'append)
+(set-fontset-font t 'symbol "Segoe UI Emoji" nil 'append)
+(set-fontset-font t 'symbol "Symbola" nil 'append)
+
+;; Ignore X resources; its settings would be redundant with the other settings
+;; in this file and can conflict with later config (particularly where the
+;; cursor color is concerned).
+(advice-add #'x-apply-session-resources :override #'ignore)
+
+;; - Reseting garbage collection and file-name-handler values.
+(add-hook 'after-init-hook
+          `(lambda ()
+             (setq gc-cons-threshold 67108864 ; 64mb
+                   gc-cons-percentage 0.1
+                   file-name-handler-alist file-name-handler-alist-original)
+             (garbage-collect)) t)
+
+(defconst emacs-start-time (current-time))
+
+(let ((minver 26))
+  (unless (>= emacs-major-version minver)
+    (error "Your Emacs is too old -- this configuration requires v%s or higher" minver)))
+
+;; load early-init.el before Emacs 27.0
+;; (unless (>= emacs-major-version 27)
+;;   (message "Early init: Emacs Version < 27.0")
+;;   (load (expand-file-name "early-init.el" user-emacs-directory)))
+
+(setq inhibit-default-init t)           ; Disable the site default settings
+
+(setq inhibit-startup-message t
+      inhibit-startup-screen t
+      inhibit-startup-buffer-menu t)
+
+;; Needs to be in early-init
+(setq native-comp-async-report-warnings-errors 'silent) ; emacs28 with native compilation
+
+(setq confirm-kill-emacs #'y-or-n-p)
+(setq initial-major-mode 'fundamental-mode
+      initial-scratch-message nil)
+
+(prefer-coding-system 'utf-8)
+(set-default-coding-systems 'utf-8)
+(set-language-environment 'utf-8)
+(set-selection-coding-system 'utf-8)
+(set-terminal-coding-system 'utf-8)
+
+(require 'package)
+
+;; (setq package-archives nil) ;; To rely only on packages from nix
+(setq package-archives
+      '(("melpa" . "http://melpa.org/packages/")
+        ("org" . "https://orgmode.org/elpa/")
+        ("gnu" . "https://elpa.gnu.org/packages/")))
+
+(setq package-archive-priorities
+      '(("melpa" .  3)
+        ("org" . 2)
+        ("gnu" . 1)))
+
+(require 'tls)
+
+;; From https://github.com/hlissner/doom-emacs/blob/5dacbb7cb1c6ac246a9ccd15e6c4290def67757c/core/core-packages.el#L102
+(setq gnutls-verify-error (not (getenv "INSECURE")) ; you shouldn't use this
+      tls-checktrust gnutls-verify-error
+      tls-program (list "gnutls-cli --x509cafile %t -p %p %h"
+                        ;; compatibility fallbacks
+                        "gnutls-cli -p %p %h"
+                        "openssl s_client -connect %h:%p -no_ssl2 -no_ssl3 -ign_eof"))
+
+;; Initialise the packages, avoiding a re-initialisation.
+(unless (bound-and-true-p package--initialized)
+  (setq package-enable-at-startup nil)
+  (package-initialize))
+
+(setq load-prefer-newer t)              ; Always load newer compiled files
+(setq ad-redefinition-action 'accept)   ; Silence advice redefinition warnings
+
+;; Configure `use-package' prior to loading it.
+(eval-and-compile
+  (setq use-package-always-ensure nil)
+  (setq use-package-always-defer nil)
+  (setq use-package-always-demand nil)
+  (setq use-package-expand-minimally nil)
+  (setq use-package-enable-imenu-support t))
+
+(unless (package-installed-p 'use-package)
+  (package-refresh-contents)
+  (package-install 'use-package))
+
+(eval-when-compile
+  (require 'use-package))
+
+(setenv "SSH_AUTH_SOCK" "/run/user/1000/gnupg/S.gpg-agent.ssh")
+
+(vde/el-load-dir (concat user-emacs-directory "/config/"))
+(if (file-exists-p (downcase (concat user-emacs-directory "/hosts/" (vde/short-hostname) ".el")))
+    (load-file (downcase (concat user-emacs-directory "/hosts/" (vde/short-hostname) ".el"))))
+
+(let ((elapsed (float-time (time-subtract (current-time)
+                                          emacs-start-time))))
+  (message "Loading %s...done (%.3fs)" load-file-name elapsed))
+
+(add-hook 'after-init-hook
+          `(lambda ()
+             (let ((elapsed
+                    (float-time
+                     (time-subtract (current-time) emacs-start-time))))
+               (message "Loading %s...done (%.3fs) [after-init]"
+                        ,load-file-name elapsed))) t)
+
tools/emacs/scratch/projects
@@ -0,0 +1,3 @@
+;;; -*- lisp-data -*-
+(("~/src/tektoncd/pipeline/")
+ ("~/src/home/"))