From 275d07b9614c718470ee566680b734446883379e Mon Sep 17 00:00:00 2001 From: Laurens Miers Date: Wed, 8 Jan 2025 21:48:29 +0100 Subject: [PATCH 1/6] feat(buffer-completion): replace company-mode with corfu --- config.org | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config.org b/config.org index 4b14626..ed797e3 100644 --- a/config.org +++ b/config.org @@ -471,7 +471,7 @@ C-c C-c to apply." *** Corfu -#+BEGIN_SRC +#+BEGIN_SRC emacs-lisp (use-package corfu ;; Optional customizations :custom @@ -499,7 +499,7 @@ C-c C-c to apply." *** Company-mode -#+BEGIN_SRC emacs-lisp +#+BEGIN_SRC (use-package company :config (define-key prog-mode-map From 7252361ab14013391b75be10861a0bee5e95efb3 Mon Sep 17 00:00:00 2001 From: Laurens Miers Date: Wed, 8 Jan 2025 21:48:34 +0100 Subject: [PATCH 2/6] feat(consult): enable --- config.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.org b/config.org index ed797e3..96cec6c 100644 --- a/config.org +++ b/config.org @@ -460,7 +460,7 @@ C-c C-c to apply." *** Consult -#+BEGIN_SRC +#+BEGIN_SRC emacs-lisp (setq completion-in-region-function (lambda (&rest args) (apply (if vertico-mode From c8fa26b07b7d9d0f0a659556fd829d35e50cdc5e Mon Sep 17 00:00:00 2001 From: Laurens Miers Date: Wed, 8 Jan 2025 21:48:49 +0100 Subject: [PATCH 3/6] feat(corfu): make execute complete --- config.org | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config.org b/config.org index 96cec6c..fa61c57 100644 --- a/config.org +++ b/config.org @@ -474,6 +474,9 @@ C-c C-c to apply." #+BEGIN_SRC emacs-lisp (use-package corfu ;; Optional customizations + :bind (:map corfu-map ("" . corfu-complete)) + :config + (setq tab-always-indent 'complete) :custom (corfu-cycle t) ;; Enable cycling for `corfu-next/previous' (corfu-auto t) ;; Enable auto completion From 3853d9d247239f4b47c9eecf7e851f1067dace0a Mon Sep 17 00:00:00 2001 From: Laurens Miers Date: Wed, 8 Jan 2025 21:49:21 +0100 Subject: [PATCH 4/6] fix: close minibuffer if open when pressing C-g --- config.org | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/config.org b/config.org index fa61c57..4e8e23a 100644 --- a/config.org +++ b/config.org @@ -1161,3 +1161,37 @@ This should normally be done by the init.el to load this configuration. | M-x untabify/tabify | Convert to spaces/tabs | | M-x describe-bindings | List all mapped keys/commands | | M-q | Fill paragraph | + +** Minibuffer + +*** Close minibuffer when pressing C-g + +'Inspired' by https://protesilaos.com/codelog/2024-11-28-basic-emacs-configuration/#h:1e4fde73-a2a2-4dc5-82ad-02cf3884ece6 . +#+BEGIN_SRC emacs-lisp +(defun myrmi/keyboard-quit-dwim () + "Do-What-I-Mean behaviour for a general `keyboard-quit'. + +The generic `keyboard-quit' does not do the expected thing when +the minibuffer is open. Whereas we want it to close the +minibuffer, even without explicitly focusing it. + +The DWIM behaviour of this command is as follows: + +- When the region is active, disable it. +- When a minibuffer is open, but not focused, close the minibuffer. +- When the Completions buffer is selected, close it. +- In every other case use the regular `keyboard-quit'." + (interactive) + (cond + ((region-active-p) + (keyboard-quit)) + ((derived-mode-p 'completion-list-mode) + (delete-completion-window)) + ((> (minibuffer-depth) 0) + (abort-recursive-edit)) + (t + (keyboard-quit)))) + +(define-key global-map (kbd "C-g") #'myrmi/keyboard-quit-dwim) + +#+END_SRC From ede533e7927a4933659c427e536692d74cb2224a Mon Sep 17 00:00:00 2001 From: Laurens Miers Date: Thu, 9 Jan 2025 20:53:30 +0100 Subject: [PATCH 5/6] Use load-file option for custom file and notes iso manual check --- init.el | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/init.el b/init.el index fa74166..3d52422 100644 --- a/init.el +++ b/init.el @@ -12,9 +12,6 @@ (when (file-readable-p my-config-file) (org-babel-load-file (expand-file-name my-config-file))) - (when (file-readable-p custom-file) - (load custom-file)) - - (when (file-readable-p notes-config-file) - (load notes-config-file)) + (load notes-config-file :no-error-if-file-is-missing) + (load custom-file :no-error-if-file-is-missing) ) From 17e062e07f32968ec5463d3ad635d31c923ed9c8 Mon Sep 17 00:00:00 2001 From: Laurens Miers Date: Thu, 9 Jan 2025 20:54:38 +0100 Subject: [PATCH 6/6] Add font and icon/nerd-font section --- config.org | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/config.org b/config.org index 4e8e23a..09e47b6 100644 --- a/config.org +++ b/config.org @@ -1053,6 +1053,45 @@ Inspired by https://github.com/org-roam/org-roam/wiki/User-contributed-Tricks#fi (org-roam-node-tags node)))))) #+END_SRC +** Font + +'Inspired' by https://protesilaos.com/codelog/2024-11-28-basic-emacs-configuration/#h:1e4fde73-a2a2-4dc5-82ad-02cf3884ece6 . +#+BEGIN_SRC emacs-lisp +(let ((mono-spaced-font "Monospace") + (proportionately-spaced-font "Sans")) + (set-face-attribute 'default nil :family mono-spaced-font :height 100) + (set-face-attribute 'fixed-pitch nil :family mono-spaced-font :height 1.0) + (set-face-attribute 'variable-pitch nil :family proportionately-spaced-font :height 1.0)) +#+END_SRC + +*** Icon fonts + +To make this setup work, the user must type M-x and then call the +command 'nerd-icons-install-fonts'. This will store the icon font files +in a local directory (on Linux this is ~/.local/share/fonts). + +#+BEGIN_SRC emacs-lisp +(use-package nerd-icons + :ensure t) + +(use-package nerd-icons-completion + :ensure t + :after marginalia + :config + (add-hook 'marginalia-mode-hook #'nerd-icons-completion-marginalia-setup)) + +(use-package nerd-icons-corfu + :ensure t + :after corfu + :config + (add-to-list 'corfu-margin-formatters #'nerd-icons-corfu-formatter)) + +(use-package nerd-icons-dired + :ensure t + :hook + (dired-mode . nerd-icons-dired-mode)) +#+END_SRC + ** Sudo current buffer #+BEGIN_SRC emacs-lisp