commit - 9c43bba67ceb79cb34f77ed711a4669cf969e0d4
commit + 01d0687853d8d8f5b6330e1f4868ab44f4949c9e
blob - 484e6fb55de85eb718970acacd03a10aee071f70
blob + eb3e791886ef36bb9c4246cf14e0633805fbb86a
--- README.md
+++ README.md
```sh
git clone https://git.sr.ht/~mtmn/emacs ~/.config/emacs
-emacs --tty
+emacs
```
Run and profit.
blob - 190800e7c5adb5f2661c0794bdcb39f6d6cf1f0b
blob + 64f55fd228a5a0582d8c89894c334ad7cce4f0e9
--- config.org
+++ config.org
#+begin_src emacs-lisp :tangle early-init.el
;;; early-init.el --- Early startup tweaks -*- lexical-binding: t; -*-
+ ;; Crank GC and disable the file-name handler for the duration of startup;
+ ;; both are restored to sane runtime values on `emacs-startup-hook' below.
(setq bedrock--initial-gc-threshold gc-cons-threshold
- gc-cons-threshold 10000000
+ bedrock--initial-file-name-handler-alist file-name-handler-alist
+ gc-cons-threshold most-positive-fixnum
+ gc-cons-percentage 0.6
+ file-name-handler-alist nil
byte-compile-warnings '(not obsolete)
warning-suppress-log-types '((comp) (bytecomp))
native-comp-async-report-warnings-errors 'silent
+ native-comp-async-jobs-number (max 1 (1- (num-processors)))
+ native-comp-jit-compilation t
inhibit-startup-echo-area-message (user-login-name)
frame-resize-pixelwise t
package-enable-at-startup nil
straight-use-package-by-default nil
straight-vc-git-default-clone-depth 1
default-frame-alist '((fullscreen . maximized)
- (font . "PragmataPro Mono-14")
+ (font . "Go Mono-14")
(internal-border-width . 0)
(undecorated . t)))
+ (defun bedrock--restore-startup-defaults ()
+ "Restore GC threshold, GC percentage, and `file-name-handler-alist'."
+ (setq gc-cons-threshold (* 128 1024 1024)
+ gc-cons-percentage 0.1
+ file-name-handler-alist bedrock--initial-file-name-handler-alist))
+
+ (add-hook 'emacs-startup-hook #'bedrock--restore-startup-defaults)
+
(when (featurep 'pgtk)
(setq default-frame-alist
(append '((inhibit-double-buffering . nil)
(tool-bar-mode -1)
(menu-bar-mode -1)
(scroll-bar-mode -1)
- (set-frame-parameter nil 'font "PragmataPro Mono-14"))
+ (set-frame-parameter nil 'font "Go Mono-14"))
(unless (display-graphic-p)
(xterm-mouse-mode 1))
(cua-mode 1)
- (add-hook 'prog-mode-hook #'display-line-numbers-mode)
(setopt display-line-numbers-width 3)
-
+ (add-hook 'prog-mode-hook #'display-line-numbers-mode)
(add-hook 'text-mode-hook #'visual-line-mode)
-
(dolist (hook '(text-mode-hook prog-mode-hook))
(add-hook hook #'hl-line-mode))
(setopt tab-bar-show 1)
+
+ ;; Start the Emacs server if it is not already running so `emacsclient' can
+ ;; attach to this session. Remove the server socket when this Emacs exits.
+ (require 'server)
+ (unless (server-running-p)
+ (server-start))
+ (add-hook 'kill-emacs-hook #'server-force-delete)
#+end_src
* Backup and autosave
(use-package which-key
:straight t
+ :defer 1
:config (which-key-mode))
(add-to-list 'tab-bar-format 'tab-bar-format-align-right 'append)
(org-mode . diff-hl-mode))
:config
(global-diff-hl-show-hunk-mouse-mode))
+
+ (use-package circadian
+ :straight (circadian :type git :host github :repo "guidoschmidt/circadian.el")
+ :demand t
+ :config
+ (setopt calendar-latitude 48.1386)
+ (setopt calendar-longitude 17.1053)
+ (setopt circadian-themes '((:sunrise . ef-orange)
+ (:sunset . modus-vivendi)))
+ (circadian-setup))
#+end_src
* Completion
(use-package embark
:straight t
- :demand t
:after consult
- :bind (("C-c a" . embark-act))
- :init
- (defun bedrock-avy-action-embark (pt)
- "Run `embark-act' at PT, then restore the window avy jumped from."
- (unwind-protect
- (save-excursion
- (goto-char pt)
- (embark-act))
- (select-window
- (cdr (ring-ref avy-ring 0))))
- t)
- (setf (alist-get ?. avy-dispatch-alist) #'bedrock-avy-action-embark))
+ :bind (("C-c a" . embark-act)))
(use-package embark-consult
:straight t
(with-eval-after-load 'corfu
(setopt corfu-popupinfo-delay '(0.25 . 0.1)
- corfu-popupinfo-hide nil)
+ corfu-popupinfo-hide nil
+ corfu-popupinfo-max-width 80
+ corfu-popupinfo-max-height 20)
(corfu-popupinfo-mode))
(use-package corfu-terminal
#+begin_src emacs-lisp
(use-package avy
:straight t
- :demand t
:bind (("C-c j" . avy-goto-line)
- ("s-j" . avy-goto-char-timer)))
+ ("s-j" . avy-goto-char-timer))
+ :config
+ (defun bedrock-avy-action-embark (pt)
+ "Run `embark-act' at PT, then restore the window avy jumped from."
+ (unwind-protect
+ (save-excursion
+ (goto-char pt)
+ (embark-act))
+ (select-window
+ (cdr (ring-ref avy-ring 0))))
+ t)
+ (setf (alist-get ?. avy-dispatch-alist) #'bedrock-avy-action-embark))
#+end_src
* Evil
(use-package eat
:straight t
+ :after eshell
:custom
(eat-term-name "xterm")
:config
* Development core
#+begin_src emacs-lisp
- (setq major-mode-remap-alist
- '((yaml-mode . yaml-ts-mode)
- (bash-mode . bash-ts-mode)
- (json-mode . json-ts-mode)
- (css-mode . css-ts-mode)
- (python-mode . python-ts-mode)))
+ (use-package treesit-auto
+ :straight t
+ :demand t
+ :custom
+ (treesit-auto-install t)
+ :config
+ (treesit-auto-add-to-auto-mode-alist 'all)
+ (global-treesit-auto-mode))
(add-hook 'prog-mode-hook #'electric-pair-mode)
#+begin_src emacs-lisp
(use-package yaml-mode
- :straight t)
+ :straight t
+ :mode "\\.ya?ml\\'")
(use-package json-mode
- :straight t)
+ :straight t
+ :mode "\\.json\\'")
(use-package nix-mode
:straight t
:mode "\\.nix\\'")
(use-package go-mode
- :straight t)
+ :straight t
+ :mode "\\.go\\'")
(use-package zig-mode
- :straight t)
+ :straight t
+ :mode "\\.zig\\'")
(use-package rust-mode
- :straight t)
+ :straight t
+ :mode "\\.rs\\'")
(use-package elixir-mode
- :straight t)
+ :straight t
+ :mode ("\\.exs?\\'" "mix\\.lock\\'"))
#+end_src
* LSP
(keymap-set global-map "C-c f" file-prefix-map)
(keymap-set file-prefix-map "f" #'project-find-file)
(keymap-set file-prefix-map "r" #'consult-recent-file)
+ (keymap-set file-prefix-map "h" #'consult-recent-file)
(keymap-set file-prefix-map "g" #'consult-ripgrep)
(defvar-keymap git-prefix-map
(keymap-set corfu-map "C-SPC" #'corfu-complete)
(keymap-set corfu-map "C-e" #'corfu-quit)
(keymap-set corfu-map "RET" #'corfu-complete))
+
+ (with-eval-after-load 'evil
+ (evil-set-leader '(normal visual) (kbd "SPC"))
+ (evil-define-key '(normal visual) 'global (kbd "<leader>fh") #'consult-recent-file))
#+end_src
* Personal extras
* Finalize
#+begin_src emacs-lisp
- (setq gc-cons-threshold (or bedrock--initial-gc-threshold 800000))
+ ;; GC and the file-name handler are restored on `emacs-startup-hook'
+ ;; (see early-init). Larger process reads make eglot/LSP feel snappier.
+ (setopt read-process-output-max (* 4 1024 1024)
+ process-adaptive-read-buffering nil)
#+end_src
blob - 53afeb1336026bba6cbbe77414c9460a81a9bd99
blob + 736348b6f623f178e6de6dbcd8331734e36fa044
--- early-init.el
+++ early-init.el
;;; early-init.el --- Early startup tweaks -*- lexical-binding: t; -*-
+;; Crank GC and disable the file-name handler for the duration of startup;
+;; both are restored to sane runtime values on `emacs-startup-hook' below.
(setq bedrock--initial-gc-threshold gc-cons-threshold
- gc-cons-threshold 10000000
+ bedrock--initial-file-name-handler-alist file-name-handler-alist
+ gc-cons-threshold most-positive-fixnum
+ gc-cons-percentage 0.6
+ file-name-handler-alist nil
byte-compile-warnings '(not obsolete)
warning-suppress-log-types '((comp) (bytecomp))
native-comp-async-report-warnings-errors 'silent
+ native-comp-async-jobs-number (max 1 (1- (num-processors)))
+ native-comp-jit-compilation t
inhibit-startup-echo-area-message (user-login-name)
frame-resize-pixelwise t
package-enable-at-startup nil
straight-use-package-by-default nil
straight-vc-git-default-clone-depth 1
default-frame-alist '((fullscreen . maximized)
- (font . "PragmataPro Mono-14")
+ (font . "Go Mono-14")
(internal-border-width . 0)
(undecorated . t)))
+(defun bedrock--restore-startup-defaults ()
+ "Restore GC threshold, GC percentage, and `file-name-handler-alist'."
+ (setq gc-cons-threshold (* 128 1024 1024)
+ gc-cons-percentage 0.1
+ file-name-handler-alist bedrock--initial-file-name-handler-alist))
+
+(add-hook 'emacs-startup-hook #'bedrock--restore-startup-defaults)
+
(when (featurep 'pgtk)
(setq default-frame-alist
(append '((inhibit-double-buffering . nil)
blob - 80468f6f97a8bd2bbbdcdb5a514367f3025b6772
blob + fc0d6353b586367a4b8757c52c851e55e6dbd7dc
--- init.el
+++ init.el
(tool-bar-mode -1)
(menu-bar-mode -1)
(scroll-bar-mode -1)
- (set-frame-parameter nil 'font "PragmataPro Mono-14"))
+ (set-frame-parameter nil 'font "Go Mono-14"))
(unless (display-graphic-p)
(xterm-mouse-mode 1))
(cua-mode 1)
-(add-hook 'prog-mode-hook #'display-line-numbers-mode)
(setopt display-line-numbers-width 3)
-
+(add-hook 'prog-mode-hook #'display-line-numbers-mode)
(add-hook 'text-mode-hook #'visual-line-mode)
-
(dolist (hook '(text-mode-hook prog-mode-hook))
(add-hook hook #'hl-line-mode))
(setopt tab-bar-show 1)
+;; Start the Emacs server if it is not already running so `emacsclient' can
+;; attach to this session. Remove the server socket when this Emacs exits.
+(require 'server)
+(unless (server-running-p)
+ (server-start))
+(add-hook 'kill-emacs-hook #'server-force-delete)
+
(defun bedrock--backup-file-name (fpath)
"Return a backup path for FPATH, creating parent dirs if needed."
(let* ((backup-root-dir (concat user-emacs-directory "emacs-backup/"))
(use-package which-key
:straight t
+ :defer 1
:config (which-key-mode))
(add-to-list 'tab-bar-format 'tab-bar-format-align-right 'append)
:config
(global-diff-hl-show-hunk-mouse-mode))
+(use-package circadian
+ :straight (circadian :type git :host github :repo "guidoschmidt/circadian.el")
+ :demand t
+ :config
+ (setopt calendar-latitude 48.1386)
+ (setopt calendar-longitude 17.1053)
+ (setopt circadian-themes '((:sunrise . ef-orange)
+ (:sunset . modus-vivendi)))
+ (circadian-setup))
+
(setopt completion-cycle-threshold 3)
(setopt tab-always-indent 'complete)
(use-package embark
:straight t
- :demand t
:after consult
- :bind (("C-c a" . embark-act))
- :init
- (defun bedrock-avy-action-embark (pt)
- "Run `embark-act' at PT, then restore the window avy jumped from."
- (unwind-protect
- (save-excursion
- (goto-char pt)
- (embark-act))
- (select-window
- (cdr (ring-ref avy-ring 0))))
- t)
- (setf (alist-get ?. avy-dispatch-alist) #'bedrock-avy-action-embark))
+ :bind (("C-c a" . embark-act)))
(use-package embark-consult
:straight t
(with-eval-after-load 'corfu
(setopt corfu-popupinfo-delay '(0.25 . 0.1)
- corfu-popupinfo-hide nil)
+ corfu-popupinfo-hide nil
+ corfu-popupinfo-max-width 80
+ corfu-popupinfo-max-height 20)
(corfu-popupinfo-mode))
(use-package corfu-terminal
(use-package avy
:straight t
- :demand t
:bind (("C-c j" . avy-goto-line)
- ("s-j" . avy-goto-char-timer)))
+ ("s-j" . avy-goto-char-timer))
+ :config
+ (defun bedrock-avy-action-embark (pt)
+ "Run `embark-act' at PT, then restore the window avy jumped from."
+ (unwind-protect
+ (save-excursion
+ (goto-char pt)
+ (embark-act))
+ (select-window
+ (cdr (ring-ref avy-ring 0))))
+ t)
+ (setf (alist-get ?. avy-dispatch-alist) #'bedrock-avy-action-embark))
(use-package evil
:straight t
(use-package eat
:straight t
+ :after eshell
:custom
(eat-term-name "xterm")
:config
(eat-eshell-mode)
(eat-eshell-visual-command-mode))
-(setq major-mode-remap-alist
- '((yaml-mode . yaml-ts-mode)
- (bash-mode . bash-ts-mode)
- (json-mode . json-ts-mode)
- (css-mode . css-ts-mode)
- (python-mode . python-ts-mode)))
+(use-package treesit-auto
+ :straight t
+ :demand t
+ :custom
+ (treesit-auto-install t)
+ :config
+ (treesit-auto-add-to-auto-mode-alist 'all)
+ (global-treesit-auto-mode))
(add-hook 'prog-mode-hook #'electric-pair-mode)
:bind (("C-x g" . magit-status)))
(use-package yaml-mode
- :straight t)
+ :straight t
+ :mode "\\.ya?ml\\'")
(use-package json-mode
- :straight t)
+ :straight t
+ :mode "\\.json\\'")
(use-package nix-mode
:straight t
:mode "\\.nix\\'")
(use-package go-mode
- :straight t)
+ :straight t
+ :mode "\\.go\\'")
(use-package zig-mode
- :straight t)
+ :straight t
+ :mode "\\.zig\\'")
(use-package rust-mode
- :straight t)
+ :straight t
+ :mode "\\.rs\\'")
(use-package elixir-mode
- :straight t)
+ :straight t
+ :mode ("\\.exs?\\'" "mix\\.lock\\'"))
(use-package eglot
:straight (:type built-in)
("C-c l i" . org-insert-link-global)
("C-c a" . org-agenda)
("C-c c" . org-capture)
- :map org-mode-map
+ :map org-mode-map
("TAB" . org-cycle))
:config
(require 'oc-csl)
(keymap-set global-map "C-c f" file-prefix-map)
(keymap-set file-prefix-map "f" #'project-find-file)
(keymap-set file-prefix-map "r" #'consult-recent-file)
+(keymap-set file-prefix-map "h" #'consult-recent-file)
(keymap-set file-prefix-map "g" #'consult-ripgrep)
(defvar-keymap git-prefix-map
(keymap-set corfu-map "C-e" #'corfu-quit)
(keymap-set corfu-map "RET" #'corfu-complete))
+(with-eval-after-load 'evil
+ (evil-set-leader '(normal visual) (kbd "SPC"))
+ (evil-define-key '(normal visual) 'global (kbd "<leader>fh") #'consult-recent-file))
+
(setopt select-enable-clipboard t
select-enable-primary t
save-interprogram-text-before-kill t)
("C-c t k" . tmr-remove)
("C-c t s" . tmr-stop)))
-(setq gc-cons-threshold (or bedrock--initial-gc-threshold 800000))
+;; GC and the file-name handler are restored on `emacs-startup-hook'
+;; (see early-init). Larger process reads make eglot/LSP feel snappier.
+(setopt read-process-output-max (* 4 1024 1024)
+ process-adaptive-read-buffering nil)