From 08cc760f1c3b3174557277748a9a1a3cfbc7b913 Mon Sep 17 00:00:00 2001 From: Maciej Szlosarczyk Date: Wed, 8 Apr 2026 14:38:54 +0300 Subject: [PATCH] Update --- .gitignore | 2 - lisp/icejam-base.el | 26 ++++++------ lisp/icejam-complete-at-point.el | 30 +++++++------ lisp/icejam-custom-init.el | 27 ++++++++++-- lisp/icejam-fonts.el | 68 +++++++++++------------------- lisp/langs/icejam-lang-elixir.el | 2 - lisp/langs/icejam-lang-markdown.el | 34 +++++++-------- lisp/langs/icejam-lang-web.el | 11 +++-- 8 files changed, 97 insertions(+), 103 deletions(-) diff --git a/.gitignore b/.gitignore index a1d668e..a657fe2 100644 --- a/.gitignore +++ b/.gitignore @@ -12,8 +12,6 @@ eshell/history tramp url/* transient/* -.lsp-session-* -lsp-cache eshell/* .yas-compiled-snippets.el ac-comphist.dat diff --git a/lisp/icejam-base.el b/lisp/icejam-base.el index cf837c1..a8150e5 100644 --- a/lisp/icejam-base.el +++ b/lisp/icejam-base.el @@ -24,6 +24,9 @@ bidi-paragraph-direction 'left-to-right bidi-inhibit-bpa t) +;; Skip fontification when you are typing +(setopt redisplay-skip-fontification-on-input t) + ;; Reduce rendering/line scan work for Emacs by not rendering cursors or regions ;; in non-focused windows. (setq-default cursor-in-non-selected-windows nil) @@ -63,18 +66,16 @@ (setopt gcmh-high-cons-threshold (* 256 1024 1024))) ;; #====================== Backup config #============================== -(setopt backup-directory-alist - `((".*" . "~/.emacs.d/backups/auto-save-list"))) -(setopt auto-save-file-name-transforms - `((".*", "~/.emacs.d/backups/auto-save-list" t))) +(setopt + backup-directory-alist `((".*" . "~/.emacs.d/backups/auto-save-list")) + auto-save-file-name-transforms `((".*" ,"~/.emacs.d/backups/auto-save-list" t)) + backup-by-copying t + delete-old-versions t + kept-new-versions 10 + kept-old-versions 5 + version-control t) -(setopt backup-by-copying t) -(setopt delete-old-versions t - kept-new-versions 10 - kept-old-versions 5 - version-control t) - -; Do not create .#foo.file lock files +;; Do not create .#foo.file lock files (setopt create-lockfiles nil) ;; Enable line numbers and show cursors position @@ -149,8 +150,7 @@ :hook ((elpaca-after-init . treemacs-follow-mode) (elpaca-after-init . treemacs-project-follow-mode)) :commands (treemacs-follow-mode treemacs-project-follow-mode treemacs) - :bind (:map icejam-keys-mode-map - ([(hyper b)] . treemacs)) + :bind (:map icejam-keys-mode-map ([(hyper b)] . treemacs)) :config (setopt treemacs-tag-follow-delay 1.0)) (use-package treemacs-all-the-icons :ensure t :defer t diff --git a/lisp/icejam-complete-at-point.el b/lisp/icejam-complete-at-point.el index 694e264..01f0acb 100644 --- a/lisp/icejam-complete-at-point.el +++ b/lisp/icejam-complete-at-point.el @@ -2,6 +2,17 @@ ;;; Commentary: ;;; Completion framework configuration ;;; Code: +(eval-when-compile + (defvar corfu-terminal-mode 'corfu-terminal) + (declare-function cape-dabbrev 'cape) + (declare-function cape-file 'cape) + (declare-function cape-keyword 'cape) + (declare-function cape-elisp-symbol 'cape) + (declare-function cape-capf-super 'cape) + (declare-function yasnippet-capf 'yasnippet) + (declare-function nerd-icons-corfu-formatter 'nerd-icons-corfu) + (declare-function eglot-completion-at-point 'eglot)) + (use-package yasnippet :ensure t :defer t :hook ((elpaca-after-init . yas-global-mode)) :config @@ -19,7 +30,6 @@ ;; Go up to go the the last item on the list (setopt corfu-cycle t corfu-count 20 ;; Show 20 completion candidates - corfu-max-width 100 ;; Max width of the corfu frame corfu-right-margin-width 0.5 corfu-left-margin-width 0.5 @@ -45,12 +55,6 @@ ;; These are actual completions (use-package cape :ensure t :after corfu :config - (declare-function cape-dabbrev 'cape) - (declare-function cape-file 'cape) - (declare-function cape-keyword 'cape) - (declare-function cape-elisp-symbol 'cape) - (declare-function cape-capf-super 'cape) - ;; Set default completion values: (set-default 'completion-at-point-functions (list (cape-capf-super #'cape-dabbrev #'yasnippet-capf) @@ -67,9 +71,10 @@ (defun icejam-set-eglot-capfs () "Set `completion-at-point-function` to list where LSP is supported." (setq-local completion-at-point-functions - (list (cape-capf-super #'yasnippet-capf #'eglot-completion-at-point) - #'cape-dabbrev - #'cape-file))) + (list + (cape-capf-super #'yasnippet-capf #'eglot-completion-at-point) + #'cape-dabbrev + #'cape-file))) (defun icejam-set-elisp-capfs () "Set `completion-at-point-function` to what is useful in Elisp." @@ -82,13 +87,10 @@ (use-package yasnippet-capf :ensure t :after corfu :defer t :config - (declare-function yasnippet-capf 'yasnippet) (setopt yasnippet-capf-lookup-by 'name)) -(use-package nerd-icons-corfu :ensure t :defer 5 - :after corfu +(use-package nerd-icons-corfu :ensure t :after corfu :defer 5 :config - (declare-function nerd-icons-corfu-formatter 'nerd-icons-corfu) (add-to-list 'corfu-margin-formatters #'nerd-icons-corfu-formatter)) (provide 'icejam-complete-at-point) diff --git a/lisp/icejam-custom-init.el b/lisp/icejam-custom-init.el index c9f58bf..21b88f6 100644 --- a/lisp/icejam-custom-init.el +++ b/lisp/icejam-custom-init.el @@ -1,4 +1,4 @@ -;;; icejam-custom-init.el --- summary +;;; icejam-custom-init.el --- summary -*- lexical-binding: t; -*- ;; Author: Maciej Szlosarczyk ;; Maintainer: Maciej Szlosarczyk @@ -9,16 +9,33 @@ ;; custom-init does a thing. ;;; Code: +(eval-when-compile + (declare-function elpaca 'elpaca) + (declare-function elpaca-process-queues 'elpaca) + (declare-function elpaca-generate-autoloads 'elpaca) + (declare-function elpaca-write-lock-file 'elpaca) + (declare-function elpaca-use-package-mode 'elpaca-use-package)) ;; Set GC at 500 MB for startup (setopt gc-cons-threshold 500000000) (setopt gc-cons-percentage 5.0) -(add-hook 'after-init-hook (lambda () +(add-hook 'elpaca-after-init-hook (lambda () ;; Restore GC to normal, but still high - (setopt gc-cons-threshold 204800000) + (setopt gc-cons-threshold (* 100 1024 1024 2)) (setopt gc-cons-percentage 0.2))) +;; Increase how much data emacs reads from processes to 4 MB. +(setopt read-process-output-max (* 4 1024 1024)) + +;; Change file handler for startup +(defvar last-file-name-handler-alist file-name-handler-alist) +(setopt file-name-handler-alist nil) +(add-hook 'after-init-hook (lambda () + ;; Restore to normal file handler + (setopt file-name-handler-alist + last-file-name-handler-alist))) + ;; Allow for deeper stacktraces / recursion ;; (setopt max-lisp-eval-depth 10000) @@ -88,7 +105,9 @@ (add-to-list 'load-path (concat user-emacs-directory "lisp/themes")) (add-to-list 'load-path (concat user-emacs-directory "lisp/langs")) -(defgroup :icejam nil "My customisation group.") +(defgroup icejam nil + "My customisation group." + :group 'local) ;; General configuration files. (use-package icejam-keys-mode :ensure nil) diff --git a/lisp/icejam-fonts.el b/lisp/icejam-fonts.el index db86e44..1515d58 100644 --- a/lisp/icejam-fonts.el +++ b/lisp/icejam-fonts.el @@ -26,13 +26,15 @@ ;; (defconst icejam-font "Iosevka Term" "Default font.") (defconst icejam-default-font-family "Iosevka Term" "Default font.") -(defconst icejam-variable-font-family "Lexica Ultralegible" "Variable pitch font.") +(defconst icejam-variable-font-family "Lexica Ultralegible" + "Variable pitch font.") (defconst icejam-markdown-font-family "Iosevka Comfy Motion" "Font used to render code blocks in markdown. It is different than default font to keep it visually distinct.") ;; Require dash functions to be included: -(declare-function -> "dash.el") +(eval-when-compile + (declare-function -> "dash.el")) (defconst icejam-font-height 14 "Default height of then font. @@ -61,20 +63,6 @@ in `icejam-set-font-to-screen`.") :group 'icejam) ;;;;;;;;;;;;;;;;;;;;;; Font configuration ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; First, let's silence a warning about free variables -(defvar lsp-ui-doc-frame-hook) - -(defun icejam-set-lsp-ui-font-hook () - "Reset LSP IO font to specified `icejam-font` and `icejam-font-height`." - (setopt lsp-ui-doc-frame-hook nil) - (add-hook 'lsp-ui-doc-frame-hook - (lambda (frame _w) - (set-face-attribute 'default frame - :family icejam-mut-default-font-family - :height (-> icejam-mut-font-height - (- 2) - (* 10)))))) - (defun icejam-set-font (family height) "Set font to FAMILY and its HEIGHT to X. @@ -89,52 +77,44 @@ two points smaller." (setopt icejam-mut-variable-font-family icejam-variable-font-family) ;; Set default font. - (set-face-attribute 'default nil - :family family - :height (-> height - (* 10))) + (dolist (face '(default)) + (set-face-attribute face nil + :family family + :height (-> height (* 10)))) ;; Set variable-pitch font - (set-face-attribute 'variable-pitch nil - :family icejam-mut-variable-font-family - :height (-> height - (* 10))) + (dolist (face '(variable-pitch)) + (set-face-attribute face nil + :family icejam-mut-variable-font-family + :height (-> height (* 10)))) - ;; Some font faces look better when they are 1 point smaller. + ;; Tooltips look better when they are 1 point smaller. (dolist (face '(tooltip)) (set-face-attribute face nil :height (-> height (- 1) (* 10)))) - ;; And some, mainly in modeline with 2 points. + ;; Modeline looks better when it is 2 points smaller. (dolist (face '(mode-line mode-line-inactive)) (set-face-attribute face nil :height (-> height (- 2) - (* 10)))) - - ;; Call LSP-UI hook - (icejam-set-lsp-ui-font-hook)) + (* 10))))) (defun icejam-set-font-to-screen () "Automatically set font height to suit the monitor." (interactive) ;; Only do anything if there's a display at all. - (if (x-display-list) - (let ((pixel-height (x-display-pixel-height))) - (cond - ;; MacBook 14" built-in screen. - ((>= 1080 pixel-height) - (icejam-set-font icejam-default-font-family icejam-font-height)) - - ;; 27" screen connected to a MacBook. - ((>= 1440 pixel-height) - (icejam-set-font icejam-default-font-family (+ icejam-font-height 3))) - - ;; 4K screen on Windows or Linux - ((>= 2160 pixel-height) - (icejam-set-font icejam-default-font-family (- icejam-font-height 3))))))) + (when (x-display-list) + (let* ((pixel-height (x-display-pixel-height)) + (adjustment (cond + ((>= 1080 pixel-height) 0) ;; Built-in 14" Macbook screen + ((>= 1440 pixel-height) 3) ;; 27" screen connected to a Macbook + ((>= 2160 pixel-height) -3)))) ;; 4K screen (i.e Linux) + (when adjustment + (icejam-set-font icejam-default-font-family + (+ icejam-font-height adjustment)))))) ;; Run the above function once, after elpaca finishes all downloads. (add-hook 'elpaca-after-init-hook 'icejam-set-font-to-screen) diff --git a/lisp/langs/icejam-lang-elixir.el b/lisp/langs/icejam-lang-elixir.el index 44b055c..c09aa8b 100644 --- a/lisp/langs/icejam-lang-elixir.el +++ b/lisp/langs/icejam-lang-elixir.el @@ -46,8 +46,6 @@ (column-enforce-n 98) (eglot-ensure) - ;; If needed, switch the one below to false to disable documentation pop-ups - ;; (setq-local lsp-ui-doc-enable t) (icejam-set-eglot-capfs) (icejam-delete-elixir-snippets)) diff --git a/lisp/langs/icejam-lang-markdown.el b/lisp/langs/icejam-lang-markdown.el index b158e16..2212d8c 100644 --- a/lisp/langs/icejam-lang-markdown.el +++ b/lisp/langs/icejam-lang-markdown.el @@ -9,25 +9,23 @@ (declare-function icejam-set-no-eglot-capfs 'icejam-prog-mode) (declare-function rxt--re-builder-switch-pcre-mode "pcre2el")) -;; Markdown is a dependency of LSP mode. By wrapping it in unless we silence -;; a warning from the byte compiler. -(unless (elpaca-installed-p 'markdown-mode) - (use-package markdown-mode :ensure t :defer t - :commands (markdown-preview) - :config - ;; Render preview and open it in browser. - (keymap-set markdown-mode-map "C-c C-v" #'markdown-preview) +(use-package markdown-mode :ensure t :defer t + :commands (markdown-preview) + :config + ;; Render preview and open it in browser. + (keymap-set markdown-mode-map "C-c C-v" #'markdown-preview) + + ;; Render HTML preview with pandoc + (setq-default markdown-command '("pandoc" + "-f" + "markdown_mmd" + "-t" + "html5" + "--template" + "github.html5" + "--highlight-style" + "pygments"))) - ;; Render HTML preview with pandoc - (setq-default markdown-command '("pandoc" - "-f" - "markdown_mmd" - "-t" - "html5" - "--template" - "github.html5" - "--highlight-style" - "pygments")))) (defun icejam-lang-activate-markdown-mode () "Reconfigure markdown mode for your own purposes." diff --git a/lisp/langs/icejam-lang-web.el b/lisp/langs/icejam-lang-web.el index 6a46ab3..7437a1b 100644 --- a/lisp/langs/icejam-lang-web.el +++ b/lisp/langs/icejam-lang-web.el @@ -13,11 +13,11 @@ ;; Vue JS (add-to-list 'auto-mode-alist '("\\.vue\\'" . web-mode)) -(setq web-mode-extra-auto-pairs - '(("eex" . (("<%" "%>"))) - ("leex" . (("<%" "%>"))) - ("erb" . (("<%" "%>") - ("beg" "end"))))) +(setopt web-mode-extra-auto-pairs + '(("eex" . (("<%" "%>"))) + ("leex" . (("<%" "%>"))) + ("erb" . (("<%" "%>") + ("beg" "end"))))) (defun icejam-activate-web-mode () "Web mode overrides." @@ -25,7 +25,6 @@ (setq-local web-mode-script-padding 2) (setq-local web-mode-code-indent-offset 2) (setq-local web-mode-markup-indent-offset 2) - (setq-local lsp-eldoc-enable-hover nil) (setq-local flycheck-check-syntax-automatically '(save mode-enabled)) (when (string-match-p ".vue" (buffer-file-name)) (eglot-ensure)))