diff --git a/config.org b/config.org index 4b14626..09e47b6 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 @@ -471,9 +471,12 @@ C-c C-c to apply." *** Corfu -#+BEGIN_SRC +#+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 @@ -499,7 +502,7 @@ C-c C-c to apply." *** Company-mode -#+BEGIN_SRC emacs-lisp +#+BEGIN_SRC (use-package company :config (define-key prog-mode-map @@ -1050,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 @@ -1158,3 +1200,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 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) )