From be00557604aa075bb522280f9fca17cb9d9e13eb Mon Sep 17 00:00:00 2001 From: Joe Ardent <code@ardent.nebcorp.com> Date: Sat, 4 Jan 2025 11:17:01 -0800 Subject: [PATCH] corfu and style tweaks --- custom-lisp/nebkor-personal.el | 7 +++-- nebkor-emacs.org | 44 ++++++++++++++--------------- nebkor-modules/nebkor-completion.el | 6 +++- nebkor-modules/nebkor-essentials.el | 2 +- nebkor-modules/nebkor-langs.el | 6 ++-- nebkor-modules/nebkor-org.el | 6 ++-- nebkor-modules/nebkor-theme.el | 6 ++-- 7 files changed, 41 insertions(+), 36 deletions(-) diff --git a/custom-lisp/nebkor-personal.el b/custom-lisp/nebkor-personal.el index 6c79487..ff0c6c7 100644 --- a/custom-lisp/nebkor-personal.el +++ b/custom-lisp/nebkor-personal.el @@ -1,4 +1,3 @@ -;; stand-in (global-set-key [C-tab] #'other-window) (global-set-key [C-S-tab] #'sother-window) (global-set-key [C-iso-lefttab] #'sother-window) @@ -9,9 +8,11 @@ (setq-default fill-column 100) (turn-on-auto-fill) (add-hook 'prog-mode-hook (lambda () (auto-fill-mode -1))) -;;(define-key icomplete-fido-mode-map (kbd "SPC") 'self-insert-command) - (add-hook 'before-save-hook #'delete-trailing-whitespace) (fset 'yes-or-no-p 'y-or-n-p) +(global-set-key (kbd "C-1") + "//-************************************************************************ +// +//-************************************************************************") (provide 'nebkor-personal) diff --git a/nebkor-emacs.org b/nebkor-emacs.org index 2dc3758..18f93f3 100644 --- a/nebkor-emacs.org +++ b/nebkor-emacs.org @@ -684,7 +684,7 @@ I have an ancient color scheme that's mostly inside the custom.el file, but I'd proper theme some day. Until then... #+begin_src emacs-lisp :tangle "nebkor-modules/nebkor-theme.el" - (add-to-list 'default-frame-alist '(background-color . "snow")) + ;;(add-to-list 'default-frame-alist '(background-color . "snow")) #+end_src ** The =nebkor-theme.el= section for highlighting lines (~lin~) @@ -876,7 +876,7 @@ Another section defines some complementary functionality (setq fontaine-presets '((small - :default-family "Noto Sans" + :default-family "Noto Sans Mono" :default-height 130) (regular :default-height 130) @@ -897,7 +897,7 @@ Another section defines some complementary functionality ;; I keep all properties for didactic purposes, but most can be ;; omitted. See the fontaine manual for the technicalities: ;; <https://protesilaos.com/emacs/fontaine>. - :default-family "Noto Sans" + :default-family "Noto Sans Mono" :default-weight regular :default-slant normal :default-width normal @@ -1338,7 +1338,6 @@ process. ("M-w" . easy-kill)) ; re-map kill-ring-save #+end_src - ** The =nebkor-essentials.el= section about auto management of treesit modules (~treesit-auto~) :PROPERTIES: :CUSTOM_ID: h:C9748AB2-AEFB-46E7-A3AD-0910D9CB153A @@ -1347,10 +1346,7 @@ process. :END: ~treesit-auto~ automatically downloads and installs tree-sitter -modules. Tree-sitter is amazing new tech that is built into Emacs from -v29 onwards, and enables much better syntax highlighting and -code-navigation. I'll write more about tree-sitter in this section at -a later date. +modules. #+begin_src emacs-lisp :tangle "nebkor-modules/nebkor-essentials.el" ;;; Install and use tree-sitter major modes where possible @@ -1379,14 +1375,12 @@ designed for tree-sitter (Lisp seems to work regardless). The package offers the ~expreg-expand~ and ~expreg-contract~ commands. #+end_quote -I expect ~expreg~ to eventually completely replace ~easy-kill~ () - #+begin_src emacs-lisp :tangle "nebkor-modules/nebkor-essentials.el" ;;; Mark syntactic constructs efficiently if tree-sitter is available (expreg) (use-package expreg :ensure t :functions (prot/expreg-expand prot/expreg-expand-dwim) - :bind ("C-M-SPC" . prot/expreg-expand-dwim) ; overrides `mark-sexp' + :bind ("C-=" . prot/expreg-expand-dwim) ; overrides `mark-sexp' :config (defun prot/expreg-expand (n) "Expand to N syntactic units, defaulting to 1 if none is provided interactively." @@ -2036,7 +2030,11 @@ Also see [[#h:567bb00f-1d82-4746-93e5-e0f60721728a][the =nebkor-completion.el= s ;; when it does not need to perform an indentation change. :bind (:map corfu-map ("<tab>" . corfu-complete)) :config - (setq corfu-preview-current #'insert + (setq corfu-auto t + corfu-auto-delay 0.3 + corfu-auto-prefix 1 + corfu-count 15 + corfu-preview-current #'insert corfu-min-width 20 corfu-preselect 'prompt corfu-on-exact-match nil @@ -3514,8 +3512,6 @@ Finally, we ~provide~ the module. :CUSTOM_ID: h:d799c3c0-bd6a-40bb-bd1a-ba4ea5367840 :END: -Watch these talks that I've given about Org: - Watch these talks by Prot: - [[https://protesilaos.com/codelog/2023-12-18-emacs-org-advanced-literate-conf/][Advanced literate configuration with Org]] (2023-12-18) @@ -3602,8 +3598,8 @@ Org is far more capable, so I switched to it completely. calendar-longitude 33.36) (require 'cal-dst) - (setq calendar-standard-time-zone-name "+0200") - (setq calendar-daylight-time-zone-name "+0300")) + (setq calendar-standard-time-zone-name "+0700") + (setq calendar-daylight-time-zone-name "+0800")) #+end_src ** The =nebkor-org.el= section about appointment reminders (~appt~) @@ -3644,7 +3640,7 @@ done at a specific time, such as coaching sessions ([[#h:f8f06938-0dfe-45c3-b4cf appt-display-format nil appt-display-mode-line t appt-display-interval 3 - appt-audible nil ; TODO 2023-01-25: t does nothing because I disable `ring-bell-function'? + appt-audible nil appt-warning-time-regexp "appt \\([0-9]+\\)" ; This is for the diary appt-message-warning-time 6) @@ -4566,7 +4562,8 @@ title of the task, and the like. The documentation string of (setq tab-always-indent 'complete) (setq tab-first-completion nil) (setq-default tab-width 4 - indent-tabs-mode nil)) + indent-tabs-mode nil) + (electric-pair-mode 1)) #+end_src ** The =nebkor-langs.el= settings highlighting parens (~show-paren-mode~) @@ -4975,7 +4972,8 @@ colors (you can use tree-sitter to do *syntactic* highlighting, but that's diffe lsp-rust-analyzer-display-lifetime-elision-hints-use-parameter-names t lsp-rust-analyzer-display-closure-return-type-hints t lsp-rust-analyzer-display-parameter-hints nil - lsp-rust-analyzer-display-reborrow-hints t) + lsp-rust-analyzer-display-reborrow-hints t + read-process-output-max (* 1024 1024)) :hook ( (lsp-mode . lsp-enable-which-key-integration) @@ -6590,7 +6588,6 @@ figure it out. :END: #+begin_src emacs-lisp :tangle "custom-lisp/nebkor-personal.el" :mkdirp yes - ;; stand-in (global-set-key [C-tab] #'other-window) (global-set-key [C-S-tab] #'sother-window) (global-set-key [C-iso-lefttab] #'sother-window) @@ -6601,11 +6598,12 @@ figure it out. (setq-default fill-column 100) (turn-on-auto-fill) (add-hook 'prog-mode-hook (lambda () (auto-fill-mode -1))) - ;;(define-key icomplete-fido-mode-map (kbd "SPC") 'self-insert-command) - (add-hook 'before-save-hook #'delete-trailing-whitespace) (fset 'yes-or-no-p 'y-or-n-p) - + (global-set-key (kbd "C-1") + "//-************************************************************************ + // + //-************************************************************************") #+end_src *** Finally, we provide the =nebkor-personal.el= module diff --git a/nebkor-modules/nebkor-completion.el b/nebkor-modules/nebkor-completion.el index 2dcc0ec..6ca8b47 100644 --- a/nebkor-modules/nebkor-completion.el +++ b/nebkor-modules/nebkor-completion.el @@ -194,7 +194,11 @@ ;; when it does not need to perform an indentation change. :bind (:map corfu-map ("<tab>" . corfu-complete)) :config - (setq corfu-preview-current #'insert + (setq corfu-auto t + corfu-auto-delay 0.3 + corfu-auto-prefix 1 + corfu-count 15 + corfu-preview-current #'insert corfu-min-width 20 corfu-preselect 'prompt corfu-on-exact-match nil diff --git a/nebkor-modules/nebkor-essentials.el b/nebkor-modules/nebkor-essentials.el index c540152..4a151f5 100644 --- a/nebkor-modules/nebkor-essentials.el +++ b/nebkor-modules/nebkor-essentials.el @@ -130,7 +130,7 @@ (use-package expreg :ensure t :functions (prot/expreg-expand prot/expreg-expand-dwim) - :bind ("C-M-SPC" . prot/expreg-expand-dwim) ; overrides `mark-sexp' + :bind ("C-=" . prot/expreg-expand-dwim) ; overrides `mark-sexp' :config (defun prot/expreg-expand (n) "Expand to N syntactic units, defaulting to 1 if none is provided interactively." diff --git a/nebkor-modules/nebkor-langs.el b/nebkor-modules/nebkor-langs.el index 411ffe8..cea4c46 100644 --- a/nebkor-modules/nebkor-langs.el +++ b/nebkor-modules/nebkor-langs.el @@ -6,7 +6,8 @@ (setq tab-always-indent 'complete) (setq tab-first-completion nil) (setq-default tab-width 4 - indent-tabs-mode nil)) + indent-tabs-mode nil) + (electric-pair-mode 1)) ;;;; Parentheses (show-paren-mode) (use-package paren @@ -207,7 +208,8 @@ lsp-rust-analyzer-display-lifetime-elision-hints-use-parameter-names t lsp-rust-analyzer-display-closure-return-type-hints t lsp-rust-analyzer-display-parameter-hints nil - lsp-rust-analyzer-display-reborrow-hints t) + lsp-rust-analyzer-display-reborrow-hints t + read-process-output-max (* 1024 1024)) :hook ( (lsp-mode . lsp-enable-which-key-integration) diff --git a/nebkor-modules/nebkor-org.el b/nebkor-modules/nebkor-org.el index 48e4d95..108a7f0 100644 --- a/nebkor-modules/nebkor-org.el +++ b/nebkor-modules/nebkor-org.el @@ -18,8 +18,8 @@ calendar-longitude 33.36) (require 'cal-dst) - (setq calendar-standard-time-zone-name "+0200") - (setq calendar-daylight-time-zone-name "+0300")) + (setq calendar-standard-time-zone-name "+0700") + (setq calendar-daylight-time-zone-name "+0800")) ;;; Appt (appointment reminders which also integrate with Org agenda) (use-package appt @@ -30,7 +30,7 @@ appt-display-format nil appt-display-mode-line t appt-display-interval 3 - appt-audible nil ; TODO 2023-01-25: t does nothing because I disable `ring-bell-function'? + appt-audible nil appt-warning-time-regexp "appt \\([0-9]+\\)" ; This is for the diary appt-message-warning-time 6) diff --git a/nebkor-modules/nebkor-theme.el b/nebkor-modules/nebkor-theme.el index 9ca0d1b..622e059 100644 --- a/nebkor-modules/nebkor-theme.el +++ b/nebkor-modules/nebkor-theme.el @@ -1,6 +1,6 @@ ;;; Everything related to the look of Emacs -(add-to-list 'default-frame-alist '(background-color . "snow")) +;;(add-to-list 'default-frame-alist '(background-color . "snow")) ;;;; Lin ;; Read the lin manual: <https://protesilaos.com/emacs/lin>. @@ -101,7 +101,7 @@ (setq fontaine-presets '((small - :default-family "Noto Sans" + :default-family "Noto Sans Mono" :default-height 130) (regular :default-height 130) @@ -122,7 +122,7 @@ ;; I keep all properties for didactic purposes, but most can be ;; omitted. See the fontaine manual for the technicalities: ;; <https://protesilaos.com/emacs/fontaine>. - :default-family "Noto Sans" + :default-family "Noto Sans Mono" :default-weight regular :default-slant normal :default-width normal