From 56c14264e054bd2e2db9d96b936b50c6b1dbddb4 Mon Sep 17 00:00:00 2001 From: Alexander Rosenberg Date: Fri, 8 May 2026 23:27:46 -0700 Subject: [PATCH] Cleanup init.el --- disabled.el | 374 --------------------- init.el | 948 +++++++++++++++++++++++++--------------------------- 2 files changed, 462 insertions(+), 860 deletions(-) delete mode 100644 disabled.el diff --git a/disabled.el b/disabled.el deleted file mode 100644 index e1674ae..0000000 --- a/disabled.el +++ /dev/null @@ -1,374 +0,0 @@ -;; icomplete -;; (use-package icomplete -;; :disable -;; :ensure nil -;; :demand t -;; :bind (:map icomplete-minibuffer-map -;; ("C-S-s" . kill-line) -;; ("C-j" . icomplete-forward-completions) -;; ("C-k" . icomplete-backward-completions) -;; ("DEL" . icomplete-fido-backward-updir) -;; ("M-DEL". delete-backward-char) -;; ("M-RET" . icomplete-force-complete-and-exit) -;; ("TAB" . icomplete-force-complete) -;; ("" . abort-recursive-edit) -;; ("C-;" . embark-dwim) -;; ("C-." . embark-act) -;; ("" . backward-char) -;; ("" . forward-char)) -;; :hook (icomplete-minibuffer-setup . my/icomplete-setup-hook-func) -;; :init -;; (defun my/icomplete-setup-hook-func () -;; (setq truncate-lines t)) -;; (setq completion-ignore-case t -;; read-file-name-completion-ignore-case t -;; read-buffer-completion-ignore-case t -;; enable-recursive-minibuffers t -;; minibuffer-prompt-properties '(read-only t -;; cursor-intangible t -;; face minibuffer-prompt) -;; ;;completions-detailed t -;; icomplete-compute-delay 0 -;; icomplete-scroll t) -;; (defun my/crm-indicator (args) -;; (cons (format "[CRM%s] %s" -;; (replace-regexp-in-string -;; "\\`\\[.*?]\\*\\|\\[.*?]\\*\\'" "" -;; crm-separator) -;; (car args)) -;; (cdr args))) -;; (advice-add #'completing-read-multiple :filter-args #'my/crm-indicator) -;; (defun my/marginalia-trim-right (list) -;; (cl-loop for (cand prefix suffix) in list collect -;; (list cand prefix (string-trim-right suffix)))) -;; (advice-add #'marginalia--align :filter-return #'my/marginalia-trim-right) -;; :config -;; (set-face-attribute 'icomplete-selected-match nil :inherit 'region) -;; (fido-mode 1) -;; (fido-vertical-mode 1)) - -;; lsp-mode -;; (use-package consult-lsp) -;; (use-package lsp-mode -;; :hook (((c-ts-mode c++-ts-mode java-ts-mode rust-ts-mode python-ts-mode -;; latex-mode markdown-mode blueprint-ts-mode) . lsp-mode) -;; (lsp-mode . my/-setup-lsp-mode-buffer)) -;; :init -;; (setq lsp-completion-provider :none -;; lsp-headerline-breadcrumb-enable nil -;; lsp-inlay-hint-enable nil -;; lsp-signature-doc-lines 1) -;; (defun my/-setup-lsp-mode-buffer () -;; "Called by `lsp-mode-hook' to setup lsp-mode buffers." -;; (evil-define-key '(normal visual motion) 'local -;; "gR" #'lsp-rename -;; "gA" #'lsp-execute-code-action -;; "gs" #'consult-lsp-symbols) -;; (setq-local evil-lookup-func #'lsp-describe-thing-at-point))) - -;; vterm -;; (use-package vterm -;; :hook (vterm-mode . with-editor-export-editor) -;; :init -;; (defvar my/project-vterm-hash-table (make-hash-table :test 'equal) -;; "Hash table that maps project root dirs to vterm buffers.") -;; (defun my/project-vterm (prompt) -;; "Switch to or create a vterm buffer in the current projects root." -;; (interactive (list t)) -;; (if-let ((proj (project-current prompt)) -;; (default-directory (project-root proj))) -;; (if-let ((vterm-buff (gethash default-directory -;; my/project-vterm-hash-table)) -;; ((buffer-live-p vterm-buff))) -;; (switch-to-buffer vterm-buff) -;; (puthash default-directory -;; (vterm (concat "*vterm for project " default-directory "*")) -;; my/project-vterm-hash-table)))) -;; (defun my/project-vterm-or-default () -;; "Open a vterm for the current project, otherwise, open a normal vterm." -;; (interactive) -;; (unless (my/project-vterm nil) -;; (if-let ((vterm-buff (gethash nil my/project-vterm-hash-table)) -;; ((buffer-live-p vterm-buff))) -;; (switch-to-buffer vterm-buff) -;; (puthash nil (vterm vterm-buffer-name) my/project-vterm-hash-table))))) - -;; ai stuff (also mostly fun) -;; (use-package ellama -;; :defer nil -;; :custom -;; (ellama-sessions-directory (no-littering-expand-var-file-name -;; "ellama-sessions")) -;; (ellama-major-mode 'markdown-mode) ;; fix text inserting at top of buffer -;; (ellama-session-file-extension "md") -;; (ellama-nick-prefix "##") -;; (ellama-keymap-prefix "C-c m") -;; :hook (ellama-session-mode . my/-ellama-startup-hook) -;; :init -;; (defun my/-ellama-startup-hook () -;; "Hook to do stuff in llama buffers." -;; (auto-fill-mode -1))) - -;; company (in buffer auto-complete) -;; (use-package company -;; :defer nil -;; :bind (("M-TAB" . company-complete) -;; ("M-" . company-complete) -;; ("C-c f" . company-files) -;; ([remap dabbrev-expand] . company-dabbrev) -;; :map prog-mode-map -;; ([remap company-dabbrev] . company-dabbrev-code)) -;; :hook ((company-search-mode . my/-company-search-mode-add-lighter) -;; (sh-mode . my/-company-setup-shell-mode)) -;; :config -;; (defun my/-company-setup-shell-mode () -;; (setq-local company-backends '(company-files company-keywords -;; company-dabbrev-code))) -;; (defun my/-company-search-mode-add-lighter () -;; (if company-search-mode -;; (cl-pushnew company-search-lighter global-mode-string :test 'equal) -;; (setq global-mode-string -;; (cl-delete company-search-lighter global-mode-string :test 'equal)))) -;; (defun my/-company-set-completion-styles (oldfun &rest args) -;; (let ((completion-styles '(basic emacs21 flex))) -;; (apply oldfun args))) -;; (advice-add 'company-capf :around 'my/-company-set-completion-styles) -;; (setopt company-format-margin-function #'company-text-icons-margin -;; company-require-match nil -;; company-tooltip-align-annotations t) -;; (setq company-transformers '(company-sort-by-occurrence)) -;; (global-company-mode 1)) -;; (use-package company-quickhelp -;; :bind (:map company-active-map -;; ("M-h" . company-quickhelp-manual-begin)) -;; :after company -;; :config -;; (company-quickhelp-mode 1) -;; (setopt company-quickhelp-delay nil)) - -;; (La)TeX -;; (use-package tex-mode -;; :hook ((latex-mode . eglot-ensure) -;; (tex-mode . my/-setup-tex-mode-compile-command)) -;; :init -;; (defun my/-setup-tex-mode-compile-command () -;; "Setup `compile-command' for `tex-mode'." -;; (let ((quoted-name (shell-quote-argument buffer-file-name))) -;; (setq-local compile-command -;; (concat "latexmk -pdf " -;; "-auxdir=" quoted-name "-build" -;; " " quoted-name)))) -;; :config -;; (add-to-list 'auto-mode-alist '("/\\.latexmkrc\\'" . perl-mode))) - -;; flyspell -;; (use-package flyspell -;; :hook -;; (((text-mode message-mode tex-mode) . flyspell-mode) -;; (prog-mode . flyspell-prog-mode)) -;; :config -;; (setq ispell-program-name "hunspell" -;; flyspell-issue-message-flag nil -;; flyspell-issue-welcome-flag nil) -;; (define-key flyspell-mode-map (kbd "C-;") nil t) -;; (define-key flyspell-mode-map (kbd "C-,") nil t)) - -;; (use-package aggressive-indent -;; :hook (prog-mode . aggressive-indent-mode) -;; :config -;; (add-to-list 'aggressive-indent-protected-commands -;; #'evil-undo)) - -;; ;; easier identification of local variables -;; (use-package color-identifiers-mode -;; :hook (prog-mode . color-identifiers-mode-maybe) -;; :init -;; (setq color-identifiers:num-colors 10 -;; color-identifiers:recoloring-delay 0.5) -;; :config -;; ;; make sure that remapped treesitter modes are handled -;; (defun my/color-identifiers-mode-remap-ts-modes () -;; (dolist (entry color-identifiers:modes-alist) -;; (cl-destructuring-bind (mode &rest props) entry -;; (when-let ((remapped-mode (alist-get mode major-mode-remap-alist)) -;; ((string-match-p "-ts-" (symbol-name remapped-mode))) -;; ((not (assq remapped-mode color-identifiers:modes-alist)))) -;; ;; no need to test with `add-to-list' -;; (push (cons remapped-mode props) color-identifiers:modes-alist))))) -;; (my/color-identifiers-mode-remap-ts-modes) -;; (setf (alist-get 'lisp-interaction-mode color-identifiers:modes-alist) -;; (alist-get 'emacs-lisp-mode color-identifiers:modes-alist)) -;; (defun my/-color-identifiers-elisp-handle-let-like (sexp output) -;; (cl-destructuring-bind (_name &optional vars &rest body) sexp -;; (dolist (entry vars body) -;; (cond -;; ((and entry (symbolp entry)) (puthash entry t output)) -;; ((and (car entry) (symbolp (car entry))) -;; (puthash (car entry) t output)))))) -;; (defun my/-color-identifiers-parse-lambda-list (list output) -;; (dolist (entry list) -;; (cond -;; ((and entry (symbolp entry) -;; (not (string-prefix-p ":" (symbol-name entry))) -;; (not (string-prefix-p "&" (symbol-name entry)))) -;; (puthash entry t output)) -;; ((and (car-safe entry) (symbolp (car entry))) -;; (puthash (car entry) t output))))) -;; (defun my/-color-identifiers-elisp-handle-destructing-bind-like -;; (sexp output) -;; (cl-destructuring-bind (_name &optional vars &rest expr-and-body) sexp -;; (my/-color-identifiers-parse-lambda-list vars output) -;; expr-and-body)) -;; (defun my/-color-identifiers-elisp-handle-defun-like -;; (sexp output) -;; (cl-destructuring-bind (_name _func &optional vars &rest body) sexp -;; (my/-color-identifiers-parse-lambda-list vars output) -;; body)) -;; (defun my/-color-identifiers-elisp-handle-dolist-like -;; (sexp output) -;; (cl-destructuring-bind (_name &optional spec &rest body) sexp -;; (cl-destructuring-bind (&optional var &rest forms) spec -;; (when (symbolp var) -;; (puthash var t output)) -;; (append body forms)))) -;; (defun my/-color-identifiers-elisp-handle-loop (sexp output) -;; (let (body-forms) -;; (cl-maplist -;; (lambda (kwds) -;; (cl-case (car kwds) -;; (for ;; this could be a dotted list -;; (let ((tail (ensure-list (cadr kwds)))) -;; (while tail -;; (when (and (consp tail) (symbolp (car tail))) -;; (puthash (car tail) t output)) -;; (when (and (consp tail) (symbolp (cdr tail))) -;; (puthash (cdr tail) t output)) -;; (setq tail (cdr-safe tail))))) -;; (using -;; (when (and (listp (cdr kwds)) -;; (symbolp (cl-second (cdr kwds)))) -;; (puthash (cl-second (cdr kwds)) t output))) -;; ((with into) -;; (when (symbolp (cadr kwds)) -;; (puthash (cadr kwds) t output))) -;; (t -;; (unless (atom (car kwds)) -;; (push (car kwds) body-forms))))) -;; (cdr sexp)) -;; body-forms)) -;; (defun my/-color-identifiers-elisp-handle-do-like (sexp output) -;; (let ((eval-forms)) -;; (cl-destructuring-bind (name &optional vars test-forms &rest body) sexp -;; (dolist (entry vars (append eval-forms test-forms body)) -;; (cl-destructuring-bind (&optional var init step &rest _) -;; entry -;; (when (symbolp var) -;; (puthash var t output) -;; (cl-callf nconc eval-forms (list init step)))))))) -;; (defvar my/-color-identifiers-eslip-handlers -;; (let ((table (make-hash-table))) -;; (puthash 'quote #'ignore table) -;; (puthash 'function #'ignore table) -;; (puthash 'let #'my/-color-identifiers-elisp-handle-let-like table) -;; (puthash 'let* #'my/-color-identifiers-elisp-handle-let-like table) -;; (puthash 'cl-destructuring-bind -;; #'my/-color-identifiers-elisp-handle-destructing-bind-like table) -;; (puthash 'with-slots -;; #'my/-color-identifiers-elisp-handle-destructing-bind-like table) -;; (puthash 'lambda -;; #'my/-color-identifiers-elisp-handle-destructing-bind-like table) -;; (puthash 'cl-function -;; #'my/-color-identifiers-elisp-handle-destructing-bind-like table) -;; (puthash 'defun -;; #'my/-color-identifiers-elisp-handle-defun-like table) -;; (puthash 'cl-defun -;; #'my/-color-identifiers-elisp-handle-defun-like table) -;; (puthash 'defmacro -;; #'my/-color-identifiers-elisp-handle-defun-like table) -;; (puthash 'cl-defmacro -;; #'my/-color-identifiers-elisp-handle-defun-like table) -;; (puthash 'cl-defmacro -;; #'my/-color-identifiers-elisp-handle-defun-like table) -;; (puthash 'cl-loop -;; #'my/-color-identifiers-elisp-handle-loop table) -;; (puthash 'dolist -;; #'my/-color-identifiers-elisp-handle-dolist-like table) -;; (puthash 'dotimes -;; #'my/-color-identifiers-elisp-handle-dolist-like table) -;; (puthash 'cl-dolist -;; #'my/-color-identifiers-elisp-handle-dolist-like table) -;; (puthash 'cl-dotimes -;; #'my/-color-identifiers-elisp-handle-dolist-like table) -;; (puthash 'cl-do -;; #'my/-color-identifiers-elisp-handle-do-like table) -;; table) -;; "A list of functions that find declarations in variables. -;; This is used in `my/-color-identifiers-elisp-declarations-in-sexp'. It is a -;; hash table of function (or macro) names and a function that handles them. The -;; functions should be of two arguments. The first is the sexp to parse. The -;; second is a hash table with the keys being the symbols of local variables. The -;; function should return a list of the forms that it contains that should be -;; recursively searched.") -;; (defun my/-color-identifiers-lisp-declarations-in-sexp (sexp output table) -;; "Get all of the variable declarations in SEXP and place them in OUTPUT. -;; OUTPUT is a hash table. TABLE is a table like -;; `my/-color-identifiers-elisp-declarations-in-sexp'." -;; (let ((stack (list sexp))) -;; (while (and stack (not (input-pending-p))) -;; (let ((entry (pop stack))) -;; (when (proper-list-p entry) -;; (if-let ((handler (gethash (car entry) table))) -;; (cl-callf nconc stack -;; (copy-sequence (funcall handler entry output))) -;; (cl-callf nconc stack -;; (copy-sequence (cdr entry))))))))) -;; (defun my/-color-identifiers-lisp-declarations-in-buffer (&optional buffer) -;; (let ((result (make-hash-table))) -;; (save-excursion -;; (goto-char (point-min)) -;; (condition-case nil -;; (while t -;; (condition-case nil -;; (let ((sexp (read (or buffer (current-buffer))))) -;; (my/-color-identifiers-lisp-declarations-in-sexp -;; sexp result my/-color-identifiers-eslip-handlers)) -;; (invalid-read-syntax nil))) -;; (end-of-file nil)) -;; (let ((names)) -;; (maphash (lambda (k _v) -;; (unless (or (eq k t) (not k) (boundp k)) -;; (push (symbol-name k) names))) -;; result) -;; names)))) -;; (color-identifiers:set-declaration-scan-fn -;; 'emacs-lisp-mode -;; 'my/-color-identifiers-lisp-declarations-in-buffer) -;; (color-identifiers:set-declaration-scan-fn -;; 'lisp-interaction-mode -;; 'my/-color-identifiers-lisp-declarations-in-buffer)) - -;; page break lines -;; (use-package page-break-lines -;; :config -;; (global-page-break-lines-mode 1) -;; (add-to-list 'page-break-lines-modes 'prog-mode) -;; (add-to-list 'page-break-lines-modes 'text-mode) -;; (add-to-list 'page-break-lines-modes 'helpful-mode)) - -;; (use-package js-comint -;; :bind (:map js-ts-mode-map -;; ("C-x C-e" . js-send-last-sexp) -;; ("C-c C-b" . js-send-buffer) -;; ("C-c C-r" . js-send-region) -;; ("C-M-x" . my/js-send-defun)) -;; :hook (js-comint-mode . my/-setup-js-comint-mode) -;; :config -;; (my/setup-c-style-newline-keys js-ts-mode-map) -;; (defun my/-setup-js-comint-mode () -;; (setq-local comint-highlight-input nil)) -;; (defun my/js-send-defun () -;; "Send the defun under point to the inferior JavaScript process." -;; (interactive) -;; (if-let ((code (thing-at-point 'defun))) -;; (js-comint-send-string code) -;; (user-error "No defun under point")))) diff --git a/init.el b/init.el index 89062ff..4e30e6b 100644 --- a/init.el +++ b/init.el @@ -3,6 +3,8 @@ ;;; Code: (require 'cl-lib) (require 'xdg) +(require 'server) +(require 'crm) ;; Setup PATH (dolist (file '("/usr/local/sbin" "~/.local/bin" "~/.ghcup/bin" @@ -67,205 +69,231 @@ (alist-get key my/private-config)) ;; basic stuff -(use-package emacs - :hook (;;(emacs-lisp-mode . my/-emacs-lisp-mode-setup-evil-lookup) - ;;(prog-mode . electric-pair-local-mode) - ((text-mode tex-mode prog-mode) . auto-fill-mode) - ((text-mode tex-mode prog-mode) . my/-enable-show-trailing-whitespace) - ((tex-mode prog-mode) . kill-ring-deindent-mode)) - :init - (with-eval-after-load 'find-func - (when (and (file-directory-p "~/src/emacs/src/")) - (setq find-function-C-source-directory "~/src/emacs/src/"))) +(defun my/-enable-show-trailing-whitespace () + "Enable showing trailing whitespace in the current buffer." + (setq-local show-trailing-whitespace t)) - (defun my/-enable-show-trailing-whitespace () - (setq-local show-trailing-whitespace t)) - ;; (defun my/-emacs-lisp-mode-setup-evil-lookup () - ;; (setq-local evil-lookup-func - ;; #'my/describe-symbol-at-point)) - (defun my/describe-symbol-at-point () - "Calls `describe-symbol' on the return value of `symbol-at-point'." - (interactive) - (let ((form (symbol-at-point))) - (if (consp form) - (describe-symbol (cadr form)) - (describe-symbol form)))) +(dolist (mode '(text-mode-hook tex-mode-hook prog-mode-hook)) + (add-hook mode #'auto-fill-mode) + (add-hook mode #'my/-enable-show-trailing-whitespace)) - ;; Trusted buffer stuff - (defvar-local my/-trusted-content-segment-cache nil - "Cache variable used in my/-trusted-content-segment. +(add-hook 'tex-mode-hook #'kill-ring-deindent-mode) +(add-hook 'prog-mode-hook #'kill-ring-deindent-mode) + +(with-eval-after-load 'find-func + (defvar find-function-C-source-directory) + (when (and (file-directory-p "~/src/emacs/src/")) + (setq find-function-C-source-directory "~/src/emacs/src/"))) + +(defun my/describe-symbol-at-point () + "Call `describe-symbol' on the return value of `symbol-at-point'." + (interactive) + (let ((form (symbol-at-point))) + (if (consp form) + (describe-symbol (cadr form)) + (describe-symbol form)))) + +;; Trusted buffer stuff +(put 'trusted-content 'permanent-local t) +(defvar-local my/-trusted-content-segment-cache nil + "Cache variable used in my/-trusted-content-segment. This is a single element list with that element being the file's trusted status.") - (defvar-local my/inhibit-trusted-content-segment nil - "When non-nil, don't display the trusted content segment.") - (defun my/temp-trust-buffer () - "Set the current buffers local value of `trusted-content' to \\=:all." - (interactive) - (setq-local trusted-content :all - ;; reset the cache - my/-trusted-content-segment-cache nil) +(defvar-local my/inhibit-trusted-content-segment nil + "When non-nil, don't display the trusted content segment.") +(defun my/temp-trust-buffer () + "Set the current buffers local value of `trusted-content' to \\=:all." + (interactive) + (setq-local trusted-content :all + ;; reset the cache + my/-trusted-content-segment-cache nil) + (cond + ((and (buffer-modified-p) (y-or-n-p "Save and reload buffer?")) + (save-buffer) + (revert-buffer-quick)) + ((y-or-n-p "Revert buffer?") + (revert-buffer-quick)))) +(defun my/-trusted-content-segment () + "Mode line segment to show buffer trust status." + (when (and (not my/inhibit-trusted-content-segment) + (derived-mode-p 'prog-mode) + (not buffer-read-only)) (cond - ((and (buffer-modified-p) (y-or-n-p "Save and reload buffer?")) - (save-buffer) - (revert-buffer-quick)) - ((y-or-n-p "Revert buffer?") - (revert-buffer-quick)))) - (put 'trusted-content 'permanent-local t) - (defun my/-trusted-content-segment () - (when (and (not my/inhibit-trusted-content-segment) - (derived-mode-p 'prog-mode) - (not buffer-read-only)) - (cond - ((and (local-variable-p 'trusted-content) - (equal trusted-content :all) - buffer-file-name) - (propertize "[Temp. Trusted]" 'face 'warning)) - ((progn - (unless my/-trusted-content-segment-cache - (setq-local my/-trusted-content-segment-cache - (list (trusted-content-p)))) - (not (car my/-trusted-content-segment-cache))) - (propertize "[Untrusted]" 'face 'error))))) - (add-to-list 'mode-line-misc-info - '(:eval (my/-trusted-content-segment))) - (defun my/-fix-trusted-content-p-for-remote (oldfun &rest args) - (let ((source (or buffer-file-truename default-directory))) - (if (or (not source) (eq trusted-content :all)) - (apply oldfun (ensure-list args)) - (let* ((method (file-remote-p source 'method)) - (host (file-remote-p source 'host)) - (trusted-content (cl-remove-if-not - (llama and (equal method (file-remote-p % 'method)) - (equal host (file-remote-p % 'host))) - trusted-content))) - (apply oldfun args))))) - (advice-add 'trusted-content-p :around - #'my/-fix-trusted-content-p-for-remote) - ;; Try to fix the scratch buffer - (defun my/-fix-scratch-buffer-trusted-state () + ((and (local-variable-p 'trusted-content) + (equal trusted-content :all) + buffer-file-name) + (propertize "[Temp. Trusted]" 'face 'warning)) + ((progn + (unless my/-trusted-content-segment-cache + (setq-local my/-trusted-content-segment-cache + (list (trusted-content-p)))) + (not (car my/-trusted-content-segment-cache))) + (propertize "[Untrusted]" 'face 'error))))) +(add-to-list 'mode-line-misc-info + '(:eval (my/-trusted-content-segment))) +(defun my/-fix-trusted-content-p-for-remote (oldfun &rest args) + "Advice around `trusted-content-p' to not hang with remote files. +Apply OLDFUN with to ARGS." + (let ((source (or buffer-file-truename default-directory))) + (if (or (not source) (eq trusted-content :all)) + (apply oldfun (ensure-list args)) + (let* ((method (file-remote-p source 'method)) + (host (file-remote-p source 'host)) + (trusted-content (cl-remove-if-not + (llama and (equal method (file-remote-p % 'method)) + (equal host (file-remote-p % 'host))) + trusted-content))) + (apply oldfun args))))) +(advice-add 'trusted-content-p :around + #'my/-fix-trusted-content-p-for-remote) +;; Try to fix the scratch buffer +(defun my/-fix-scratch-buffer-trusted-state () + "Fix the trusted state of the scratch buffer." + (with-current-buffer (get-scratch-buffer-create) (setq-local trusted-content :all - my/-trusted-content-segment-cache nil)) - (add-hook 'after-init-hook #'my/-fix-scratch-buffer-trusted-state) + my/-trusted-content-segment-cache nil))) +(add-hook 'after-init-hook #'my/-fix-scratch-buffer-trusted-state) - ;; Increase responsiveness - (setq gc-cons-threshold 80000000 - inhibit-compacting-font-caches t - read-process-output-max (* 4 1024 1024)) ;; 4mb - (global-so-long-mode 1) +;; Increase responsiveness +(setq gc-cons-threshold 80000000 + inhibit-compacting-font-caches t + read-process-output-max (* 4 1024 1024)) ;; 4mb +(global-so-long-mode 1) - ;; Disable bidi text scanning (supposedly increases performance) - (setq-default bidi-display-reordering t - bidi-paragraph-direction 'left-to-right) - (setq bidi-inhibit-bpa t) +;; Disable bidi text scanning (supposedly increases performance) +(setq-default bidi-display-reordering t + bidi-paragraph-direction 'left-to-right) +(setq bidi-inhibit-bpa t) - ;; Make emacs wait until typing is done to fontify (also increases - ;; performance) - (setq redisplay-skip-fontification-on-input t) +;; Make Emacs wait until typing is done to fontify (also increases +;; performance) +(setq redisplay-skip-fontification-on-input t) - ;; Some kill ring settings - (setq save-interprogram-paste-before-kill t - kill-do-not-save-duplicates t) +;; Some kill ring settings +(setq save-interprogram-paste-before-kill t + kill-do-not-save-duplicates t) - ;; Terminal mouse support - (xterm-mouse-mode 1) +;; Terminal mouse support +(xterm-mouse-mode 1) - ;; Make cursor more visible - (global-hl-line-mode 1) - (blink-cursor-mode -1) +;; Make cursor more visible +(global-hl-line-mode 1) +(blink-cursor-mode -1) - ;; Enable all disabled stuff - (setq disabled-command-function nil) +;; Enable all disabled stuff +(setq disabled-command-function nil) - ;; Make window balancing better - (setq window-combination-resize t) +;; Make window balancing better +(setq window-combination-resize t) - ;; Stop some annoying stuff - (setq extended-command-suggest-shorter nil - suggest-key-bindings nil) +;; Stop some annoying stuff +(setq extended-command-suggest-shorter nil + suggest-key-bindings nil) - ;; Better scrolling - (setq mouse-scroll-delay 0 - scroll-conservatively 10 - scroll-margin 2 - scroll-preserve-screen-position t) +;; Better scrolling +(setq mouse-scroll-delay 0 + scroll-conservatively 10 + scroll-margin 2 + scroll-preserve-screen-position t) - ;; Make show paren instant - (setq show-paren-delay 0) - (show-paren-mode 1) +;; Make show paren instant +(setq show-paren-delay 0) +(show-paren-mode 1) - ;; Display line numbers - (global-display-line-numbers-mode 1) +;; Display line numbers +(global-display-line-numbers-mode 1) - ;; Allow the frame to be any size - (setq frame-resize-pixelwise t) +;; Allow the frame to be any size +(setq frame-resize-pixelwise t) - ;; Don't use a gtk file picker - (setq use-file-dialog nil) +;; Don't use a gtk file picker +(setq use-file-dialog nil) - ;; Make yes-or-no-p less verbose (and not use windows) - (setq use-dialog-box nil - use-short-answers t) +;; Make yes-or-no-p less verbose (and not use windows) +(setq use-dialog-box nil + use-short-answers t) - ;; Disable startup screen - (setq inhibit-startup-screen t - server-client-instructions nil) +;; Disable startup screen +(setq inhibit-startup-screen t + server-client-instructions nil) - ;; show column numbers - (column-number-mode 1) +;; show column numbers +(column-number-mode 1) - ;; Disable the menu and tool bars - (menu-bar-mode -1) - (tool-bar-mode -1) +;; Disable the menu and tool bars +(menu-bar-mode -1) +(tool-bar-mode -1) - ;; No scroll bars - (scroll-bar-mode -1) +;; No scroll bars +(scroll-bar-mode -1) - ;; Visual line mode - (global-visual-line-mode 1) +;; Visual line mode +(global-visual-line-mode 1) - ;; Better line wrapping - (global-visual-wrap-prefix-mode 1) +;; Better line wrapping +(global-visual-wrap-prefix-mode 1) - ;; Make some commands easier to enter multiple times - (repeat-mode 1) +;; Make some commands easier to enter multiple times +(repeat-mode 1) - ;; Easier buffer navigation - (keymap-global-set "C-c <" #'previous-buffer) - (keymap-global-set "C-c >" #'next-buffer) - (keymap-global-set "C-c k" #'previous-buffer) - (keymap-global-set "C-c j" #'next-buffer) +;; Easier buffer navigation +(keymap-global-set "C-c <" #'previous-buffer) +(keymap-global-set "C-c >" #'next-buffer) +(keymap-global-set "C-c k" #'previous-buffer) +(keymap-global-set "C-c j" #'next-buffer) - ;; Seems useful... - (keymap-global-set "C-c u" #'browse-url) +;; Seems useful... +(keymap-global-set "C-c u" #'browse-url) - ;; Set fonts - (add-to-list 'default-frame-alist '(font . "FiraCode Nerd Font Mono-12")) - (add-hook 'server-after-make-frame-hook - (lambda () - (set-fontset-font t 'japanese-jisx0208 "IPAGothic"))) +;; Set fonts +(add-to-list 'default-frame-alist '(font . "FiraCode Nerd Font Mono-12")) +(add-hook 'server-after-make-frame-hook + (lambda () + (set-fontset-font t 'japanese-jisx0208 "IPAGothic"))) - ;; Enable color in compilation buffers - (add-hook 'compilation-filter-hook 'ansi-color-compilation-filter) +;; Enable color in compilation buffers +(add-hook 'compilation-filter-hook 'ansi-color-compilation-filter) - ;; Some settings for programming - (setq-default indent-tabs-mode nil - tab-width 4 - fill-column 80 - comment-multi-line t - comment-empty-lines 'eol) - (add-to-list 'auto-mode-alist '("\\.[cC][nN][fF]\\'" . conf-mode)) - (add-to-list 'auto-mode-alist `(,(rx "." (or "service" "timer" "target" - "socket" "slice" "mount") - eos) - . conf-mode)) - (add-to-list 'auto-mode-alist `(,(rx (or bos "/") "README" eos) . markdown-mode)) - (keymap-set emacs-lisp-mode-map "C-c C-r" #'eval-region) - (defun my/-fix-emacs-lisp-mode-system-files () - (when (string-prefix-p lisp-directory buffer-file-name) - ;; system Emacs files use tab characters and look weird without this. - (setq-local tab-width 8))) - (add-hook 'emacs-lisp-mode-hook #'my/-fix-emacs-lisp-mode-system-files) +;; Some settings for programming +(setq-default indent-tabs-mode nil + tab-width 4 + fill-column 80 + comment-multi-line t + comment-empty-lines 'eol) +(add-to-list 'auto-mode-alist '("\\.[cC][nN][fF]\\'" . conf-mode)) +(add-to-list 'auto-mode-alist `(,(rx "." (or "service" "timer" "target" + "socket" "slice" "mount") + eos) + . conf-mode)) +(add-to-list 'auto-mode-alist `(,(rx (or bos "/") "README" eos) . markdown-mode)) +(keymap-set emacs-lisp-mode-map "C-c C-r" #'eval-region) +(defun my/-fix-emacs-lisp-mode-system-files () + "Fix tabs in system Lisp files." + (when (string-prefix-p lisp-directory buffer-file-name) + ;; system Emacs files use tab characters and look weird without this. + (setq-local tab-width 8))) +(add-hook 'emacs-lisp-mode-hook #'my/-fix-emacs-lisp-mode-system-files) - ;; Tree sitter download locations +;; Minibuffer stuff +(add-hook 'minibuffer-setup-hook #'cursor-intangible-mode) +(defun my/-crm-indicator (args) + "Filter args for `completing-read-multiple' to add an indicator. +ARGS are the args to filter." + (cons (format "[CRM%s] %s" + (replace-regexp-in-string + "\\`\\[.*?]\\*\\|\\[.*?]\\*\\'" "" + crm-separator) + (car args)) + (cdr args))) +(advice-add #'completing-read-multiple :filter-args #'my/crm-indicator) +(setopt enable-recursive-minibuffers t + read-extended-command-predicate nil) +(unless (plist-get minibuffer-prompt-properties 'cursor-intangible) + (setopt minibuffer-prompt-properties + (plist-put minibuffer-prompt-properties 'cursor-intangible t))) + +;; Tree sitter download locations +(with-eval-after-load 'treesit + (defvar treesit-language-source-alist) (setq treesit-language-source-alist '((c "https://github.com/tree-sitter/tree-sitter-c") (cpp "https://github.com/tree-sitter/tree-sitter-cpp") @@ -305,19 +333,22 @@ This is a single element list with that element being the file's trusted status. (cmake-mode . cmake-ts-mode) ;; (go-mode . go-ts-mode) <- doesn't work very well )) - (add-to-list 'major-mode-remap-alist ent)) - (defun my/treesit-compile-all (force) - "Compile all the modules defined in `treesit-language-source-alist'. + (add-to-list 'major-mode-remap-alist ent))) +(defun my/treesit-compile-all (force) + "Compile all the modules defined in `treesit-language-source-alist'. If FORCE, recompile all modules, even ones that are already compiled. Interactively, force the recompile if called with a prefix." - (interactive "P") - (let ((did-build nil)) - (dolist (lang treesit-language-source-alist) - (when (or force (not (treesit-language-available-p (car lang)))) - (treesit-install-language-grammar (car lang)) - (setq did-build t))) - (unless did-build - (message "All defined parsers installed!"))))) + (interactive "P") + (require 'treesit) + (defvar treesit-language-source-alist) + (let ((did-build nil)) + (dolist (lang treesit-language-source-alist) + (when (or force (not (treesit-language-available-p (car lang)))) + (treesit-install-language-grammar (car lang) + (car treesit-extra-load-path)) + (setq did-build t))) + (unless did-build + (message "All defined parsers installed!")))) (use-package auth-source :ensure nil @@ -489,6 +520,8 @@ PRED is nil, the value of `my/kill-some-buffers-default-pred' is used." (tab-bar-mode 1) (tab-bar-history-mode 1)) +(with-eval-after-load 'tab-bar) + ;; jinx (better flyspell) (use-package jinx :hook (emacs-startup . global-jinx-mode) @@ -514,17 +547,18 @@ t with a prefix argument." ;; recentf (use-package recentf - :init - (setq recentf-exclude `("^/tmp/.*" - "^~/.mail/[^/]/Drafts/.*" - ,(format "^%svar/dape-breakpoints" user-emacs-directory) - ,(format "^%svar/elpa/.*" user-emacs-directory) - ,(format "^%svar/elfeed/.*" user-emacs-directory) - ,(format "^%svar/gnus/.*" user-emacs-directory) - ,(format "^%svar/ellama-sessions/.*" user-emacs-directory) - ,(format "^%setc/gnus/.*" user-emacs-directory) - ,(format "^%svar/bookmark-default.el" user-emacs-directory))) + :defer nil :bind ("C-c r" . recentf) + :custom + (recentf-exclude `("^/tmp/.*" + "^~/.mail/[^/]/Drafts/.*" + ,(format "^%svar/dape-breakpoints" user-emacs-directory) + ,(format "^%svar/elpa/.*" user-emacs-directory) + ,(format "^%svar/elfeed/.*" user-emacs-directory) + ,(format "^%svar/gnus/.*" user-emacs-directory) + ,(format "^%svar/ellama-sessions/.*" user-emacs-directory) + ,(format "^%setc/gnus/.*" user-emacs-directory) + ,(format "^%svar/bookmark-default.el" user-emacs-directory))) :config (recentf-mode 1)) @@ -592,70 +626,15 @@ directory. Otherwise, run `find-file' on that file." (advice-add #'map-y-or-n-p :around #'my/kkp-disable-around-advice) (advice-add #'read-multiple-choice :around #'my/kkp-disable-around-advice)) -;; some eww (status bar) stuff -(defun my/cmdline-for-pid (pid) - "Return the command line arguments passed to PID. -PID can be a string or a number." - (butlast (string-split - (with-temp-buffer - (insert-file-contents-literally - (format "/proc/%s/cmdline" pid)) - (buffer-substring-no-properties (point-min) - (point-max))) - "\0"))) -(defun my/eww-current-config-dir () - "Return the configuration directory for a currently running eww process." - ;; This probably only works on Linux - (catch 'found - (dolist (subdir (directory-files "/proc")) - (when (string-match-p (rx bos (+ num) eos) subdir) - (ignore-error permission-denied - (let* ((attrs (file-attributes (format "/proc/%s/exe" subdir))) - (type (file-attribute-type attrs))) - (when (and (stringp type) - (string-match-p (rx (or bos "/") "eww") type)) - (cl-maplist (lambda (tail) - (when (equal (car tail) "-c") - (throw 'found (cl-second tail)))) - (my/cmdline-for-pid subdir))))))))) -(defun my/eww-update-variables (&rest vars) - "Update the key value pairs in VARS. -Each key should be either a symbol or a string. Each value will have its -printed representation (via `princ') set as the new value for the key." - (let* ((mappings (map-apply - #'(lambda (key val) - (when (symbolp key) (setq key (symbol-name key))) - (when (cl-find ?= key) - (error "Key cannot contain an equal sign (=): %s" key)) - (format "%s=%s" key val)) - vars)) - (args (cons "update" mappings)) - (cfg-dir (my/eww-current-config-dir))) - (when cfg-dir - (setq args (nconc (list "-c" cfg-dir) args))) - (ignore-errors - (apply 'call-process "eww" nil 0 nil args)))) -(defun my/eww-poll-variables (&rest vars) - "Poll each variable in VARS, which is a lists of strings or symbols." - (let* ((args (cons "poll" (mapcar #'(lambda (elt) (format "%s" elt)) vars))) - (cfg-dir (my/eww-current-config-dir))) - (when cfg-dir - (setq args (nconc (list "-c" cfg-dir) args))) - (ignore-errors - (apply 'call-process "eww" nil 0 nil args)))) - ;; mozc (require 'mozc nil t) (setq default-input-method "japanese-mozc") -(defun my/-set-eww-fcitx-state (enabled) - "Set the fcitx state for eww to ENABLED." - (my/eww-update-variables "fcitx5-state" (if enabled 2 1))) (defun my/-update-waybar-fcitx-state () "Update the waybar fcitx5 state." (call-process "pkill" nil 0 nil "-RTMIN+1" "waybar")) -(defun my/global-toggle-mozc (&optional no-eww) +(defun my/global-toggle-mozc (&optional no-update-bar) "Toggle mozc for all buffers. -With NO-EWW, don't update eww's state." +With NO-UPDATE-BAR, don't update any status bar's state." (interactive) (let ((default-input-method "japanese-mozc") (default-directory "~")) @@ -670,8 +649,7 @@ With NO-EWW, don't update eww's state." (mozc-mode -1) (when (boundp 'evil-input-method) (setq-local evil-input-method nil))))) - (unless no-eww - (my/-set-eww-fcitx-state activate) + (unless no-update-bar (my/-update-waybar-fcitx-state))) (force-mode-line-update t))) (keymap-global-set "C-\\" #'my/global-toggle-mozc) @@ -703,7 +681,7 @@ With NO-EWW, don't update eww's state." (when (cl-some 'my/mozc-active-in-buffer-p (buffer-list)) (my/global-toggle-mozc t) (my/-set-fcitx-enabled t) - (my/-set-eww-fcitx-state t)))) + (my/-update-waybar-fcitx-state)))) (add-function :after after-focus-change-function #'my/-normalize-mozc-state) ;; fix the helper process failing if mozc is built with debug flags ;; (with-eval-after-load 'mozc @@ -726,14 +704,17 @@ With NO-EWW, don't update eww's state." ;; migemo (use-package migemo - :config - (setq migemo-dictionary "/usr/share/migemo/utf-8/migemo-dict" - migemo-coding-system 'utf-8-unix - migemo-regex-dictionary nil - migemo-user-dictionary nil - migemo-isearch-enable-p t) + :defer nil + :custom + (migemo-dictionary "/usr/share/migemo/utf-8/migemo-dict") + (migemo-coding-system 'utf-8-unix) + (migemo-regex-dictionary nil) + (migemo-user-dictionary nil) + (migemo-isearch-enable-p t) + :init (keymap-global-set "C-c w" 'isearch-forward) (keymap-global-set "C-c W" 'isearch-backward) + :config (migemo-init)) ;; undo-tree @@ -747,14 +728,13 @@ With NO-EWW, don't update eww's state." (global-undo-tree-mode)) ;; evil -(use-package evil - :init - (setq evil-want-integration t +(setopt evil-want-integration t evil-want-C-d-scroll nil evil-want-keybinding nil evil-undo-system 'undo-tree evil-search-module 'isearch evil-respect-visual-line-mode t) +(use-package evil :config (evil-mode 1) (evil-define-key '(normal visual motion) proced-mode-map @@ -769,11 +749,13 @@ With NO-EWW, don't update eww's state." 'evil-append-line)) (use-package evil-collection :after evil + :defer nil :diminish evil-collection-unimpaired-mode :config (evil-collection-init)) (use-package evil-surround :after evil + :defer nil :config (evil-define-key 'operator evil-surround-mode-map "z" #'evil-surround-edit @@ -784,6 +766,7 @@ With NO-EWW, don't update eww's state." (global-evil-surround-mode 1)) (use-package evil-terminal-cursor-changer :after evil + :defer nil :config (evil-terminal-cursor-changer-activate)) (use-package evil-numbers @@ -967,7 +950,6 @@ in the region and indents once)." (advice-add 'xclip-get-selection :around 'my/-xclip-detect-wl-paste-error)) ;; Set the WAYLAND_DISPLAY environment variable -(require 'xdg) (defun my/detect-wayland-display () "Try to set the WAYLAND_DISPLAY environment variable. This attempts to detect a running Wayland session and set the WAYLAND_DISPLAY @@ -995,28 +977,26 @@ environment variable accordingly." (which-key-mode 1)) ;; avy +(define-minor-mode my/evil-avy-mode + "Allow avy commands with s and S in evil's normal and visual states." + :keymap (make-sparse-keymap)) +(define-globalized-minor-mode my/evil-avy-global-mode my/evil-avy-mode + (lambda () (my/evil-avy-mode 1)) + :group 'avy + :predicate '((not magit-mode dired-mode + proced-mode mu4e-main-mode + mu4e-view-mode mu4e-headers-mode + ibuffer-mode calc-mode calc-trail-mode + gnus-group-mode) t)) (use-package avy :bind (("C-c C-j" . avy-resume) ("M-s s" . evil-avy-goto-char-2) ("M-s S" . evil-avy-goto-line)) :init - (define-minor-mode my/evil-avy-mode - "A minor mode for binding avy commands to s and S in evil's normal and -visual states." - :keymap (make-sparse-keymap)) (evil-define-key '(normal visual operator motion) my/evil-avy-mode-map "s" #'evil-avy-goto-char-2 "S" #'evil-avy-goto-line) - (define-globalized-minor-mode my/evil-avy-global-mode my/evil-avy-mode - (lambda () (my/evil-avy-mode 1)) - :predicate '((not magit-mode dired-mode - proced-mode mu4e-main-mode - mu4e-view-mode mu4e-headers-mode - ibuffer-mode calc-mode calc-trail-mode - gnus-group-mode) t)) - (my/evil-avy-global-mode 1) - :config - (avy-setup-default)) + (my/evil-avy-global-mode 1)) ;; re-builder (use-package re-builder @@ -1039,9 +1019,8 @@ visual states." ;; save-place (use-package saveplace - :init - (save-place-mode 1) :config + (save-place-mode 1) ;; From Doom, apparently (defun my/-recenter-save-place-after-find-file () (when buffer-file-name @@ -1077,6 +1056,7 @@ visual states." ;; vertico (use-package vertico + :defer nil :bind (:map vertico-map ("C-RET" . vertico-exit-input) ("C-" . vertico-exit-input) @@ -1086,35 +1066,22 @@ visual states." ("RET" . vertico-directory-enter) ("DEL" . vertico-directory-delete-char) ("M-DEL" . vertico-directory-delete-word)) - :hook (minibuffer-setup . cursor-intangible-mode) - :init - (defun my/crm-indicator (args) - (cons (format "[CRM%s] %s" - (replace-regexp-in-string - "\\`\\[.*?]\\*\\|\\[.*?]\\*\\'" "" - crm-separator) - (car args)) - (cdr args))) - (advice-add #'completing-read-multiple :filter-args #'my/crm-indicator) - (setq vertico-cycle t - enable-recursive-minibuffers t - ;; read-extended-command-predicate #'command-completion-default-include-p - read-extended-command-predicate nil - minibuffer-prompt-properties '(read-only t ;; noindent 3 - cursor-intangible t - face minibuffer-prompt)) + :custom + (vertico-cycle t) + :config (vertico-mode 1) ;; for jinx (require 'vertico-multiform) + (defvar vertico-multiform-categories) (add-to-list 'vertico-multiform-categories '(jinx grid (vertico-grid-annotate . 20))) (vertico-multiform-mode 1)) ;; orderless (use-package orderless - :autoload orderless-define-completion-style :hook (text-mode . my/-setup-text-mode-completion-styles) - :init + :defer nil + :config (defun my/-setup-text-mode-completion-styles () (setq-local completion-styles '(basic))) (orderless-define-completion-style my/orderless-with-initialism @@ -1130,9 +1097,10 @@ visual states." ;; marginalia (use-package marginalia + :defer nil :bind (:map minibuffer-local-map ("M-a" . marginalia-cycle)) - :init + :config (marginalia-mode 1)) ;; embark @@ -1146,11 +1114,11 @@ visual states." :map embark-become-file+buffer-map ("b" . consult-buffer) ("B" . switch-to-buffer)) - :init - (setq embark-quit-after-action nil - embark-indicators '(embark-minimal-indicator - embark-isearch-highlight-indicator - embark-highlight-indicator)) + :custom + (embark-quit-after-action nil) + (embark-indicators '(embark-minimal-indicator + embark-isearch-highlight-indicator + embark-highlight-indicator)) :config (defvar-keymap my/embark-string-map :doc "Keymap for Embark string actions." @@ -1228,33 +1196,35 @@ visual states." ;; corfu (autocomplete) (use-package corfu + :defer nil :bind (("M-" . completion-at-point) :map corfu-map ("C-j" . corfu-next) ("C-k" . corfu-previous) ("M-SPC" . corfu-insert-separator) ("M-m" . my/corfu-move-to-minibuffer)) - :init + :custom + (corfu-cycle t) + (corfu-auto nil) + (corfu-on-exact-match nil) + (corfu-popupinfo-delay '(1.0 . 0.5)) + (completion-cycle-threshold nil) + (global-corfu-minibuffer + ;; only enable corfu in the minibuffer in graphical frames + (lambda () + (and (display-graphic-p) + (not (eq (current-local-map) + read-passwd-map))))) + :config (defun my/corfu-move-to-minibuffer () (interactive) (when completion-in-region--data (let ((completion-extra-properties corfu--extra) (completion-cycle-threshold completion-cycling)) (apply #'consult-completion-in-region completion-in-region--data)))) - (setq corfu-cycle t - corfu-auto nil - corfu-on-exact-match nil - corfu-popupinfo-delay '(1.0 . 0.5) - completion-cycle-threshold nil - global-corfu-minibuffer - ;; only enable corfu in the minibuffer in graphical frames - (lambda () - (and (display-graphic-p) - (not (eq (current-local-map) - read-passwd-map))))) (global-corfu-mode 1) (corfu-popupinfo-mode 1) - :config + (add-to-list 'corfu-continue-commands #'my/corfu-move-to-minibuffer) (defun my/help-buffer-exists-p () "Return if the buffer that `help-buffer' would, or nil if it doesn't exist." @@ -1354,8 +1324,8 @@ to `posframe-show' if the display is graphical." :hook ((sh-mode emacs-lisp-mode) . my/flycheck-if-trusted) :custom (flycheck-indication-mode 'left-margin) + (flycheck-display-errors-function nil) :init - (setq flycheck-display-errors-function nil) (defun my/flycheck-if-trusted () (when (trusted-content-p) (flycheck-mode))) @@ -1506,21 +1476,30 @@ With PROJECT, give diagnostics for all buffers in the current project." ;; eldoc (use-package eldoc :diminish eldoc-mode - :init - (setq-default eldoc-echo-area-use-multiline-p nil)) + :custom + (eldoc-echo-area-use-multiline-p nil)) ;; eglot (use-package eglot - :demand t :pin gnu ;; try to force Elpa version to fix warnings - :hook ((eglot-managed-mode . my/-eglot-setup)) + :hook (eglot-managed-mode . my/-eglot-setup) + :custom + (eglot-autoshutdown t) + (eglot-ignored-server-capabilities '(:documentOnTypeFormattingProvider)) :init - ;; (defun my/eglot-in-text-mode-only () - ;; (when (eq major-mode 'text-mode) - ;; (eglot-ensure))) (defun my/eglot-if-trusted () (when (trusted-content-p) (eglot-ensure))) + :config + (defun my/-eglot-setup () + "Setup eldoc variables for `eglot-managed-mode-hook'." + (setq-local evil-lookup-func #'my/eglot-documentation-at-point) + (evil-define-key '(normal motion) 'local + "K" #'evil-lookup + "gR" #'eglot-rename + "gA" #'eglot-code-actions + "gs" #'consult-eglot-symbols) + (eglot-inlay-hints-mode -1)) (defvar my/-eglot-documentation-buffer nil "Buffer for showing documentation for `my/eglot-documentation-at-point'.") (define-derived-mode my/eglot-documentation-mode special-mode "Eglot-Doc" @@ -1561,18 +1540,6 @@ With PROJECT, give diagnostics for all buffers in the current project." (buffer-list))) (kill-buffer my/-eglot-documentation-buffer))) (advice-add 'eglot-shutdown :after 'my/-eglot-cleanup-doc-buffer) - (defun my/-eglot-setup () - "Setup eldoc variables for `eglot-managed-mode-hook'." - (setq-local evil-lookup-func #'my/eglot-documentation-at-point) - (evil-define-key '(normal motion) 'local - "K" #'evil-lookup - "gR" #'eglot-rename - "gA" #'eglot-code-actions - "gs" #'consult-eglot-symbols) - (eglot-inlay-hints-mode -1)) - (setq eglot-autoshutdown t - eglot-ignored-server-capabilities '(:documentOnTypeFormattingProvider)) - :config ;; Fix directory local variables in remote buffers (defun my/-eglot-fix-dir-locals-in-remote-dirs (oldfun server &optional path) (if (not (file-remote-p (or path default-directory))) @@ -1601,6 +1568,7 @@ With PROJECT, give diagnostics for all buffers in the current project." (cons '(arduino-ts-mode) '("arduino-language-server")))) (use-package eglot-inactive-regions + :after eglot :custom (eglot-inactive-regions-style 'darken-foreground) (eglot-inactive-regions-opacity 0.4) @@ -1618,10 +1586,9 @@ With PROJECT, give diagnostics for all buffers in the current project." (defun my/apheleia-disable-in-current-buffer () (setq-local apheleia-inhibit t)) :config - (with-eval-after-load 'apheleia - (setf (alist-get 'java-mode apheleia-mode-alist) 'clang-format - (alist-get 'java-ts-mode apheleia-mode-alist) 'clang-format)) - (apheleia-global-mode +1)) + (apheleia-global-mode 1) + (setf (alist-get 'java-mode apheleia-mode-alist) 'clang-format + (alist-get 'java-ts-mode apheleia-mode-alist) 'clang-format)) ;; awk (with-eval-after-load 'cc-mode @@ -1629,15 +1596,14 @@ With PROJECT, give diagnostics for all buffers in the current project." ;; gud (use-package gud - :demand t :ensure nil :after (project evil) :bind (:map project-prefix-map ("U" . my/project-gdb)) :custom (gud-highlight-current-line t) - :config - (setq gdb-debuginfod-enable-setting t) + (gdb-debuginfod-enable-setting t) + :init (defvar my/project-gdb-command nil "Command to use in `my/project-gdb'.") (put 'my/project-gdb-command 'safe-local-variable (lambda (val) @@ -1649,6 +1615,7 @@ With PROJECT, give diagnostics for all buffers in the current project." (list project (gud-query-cmdline 'gdb)))) (let ((default-directory (project-root project))) (gdb command-line))) + :config (evil-set-initial-state 'gdb-locals-mode 'motion) (evil-collection-inhibit-insert-state 'gdb-locals-mode-map) (evil-define-key '(normal motion visual) gdb-locals-mode-map @@ -1704,22 +1671,23 @@ With PROJECT, give diagnostics for all buffers in the current project." ;; dape (use-package dape + :demand t :hook ((after-init . dape-breakpoint-load) (kill-emacs . dape-breakpoint-save) (dape-start . save-some-buffers) (dape-display-source . pulse-momentary-highlight-one-line)) - :init - (setopt dape-default-breakpoints-file (no-littering-expand-var-file-name - "dape-breakpoints")) + :custom + (dape-default-breakpoints-file (no-littering-expand-var-file-name + "dape-breakpoints")) + (dape-buffer-window-arrangement 'right) :config (evil-define-key 'motion dape-info-parent-mode-map (kbd "TAB") #'dape--info-buffer-tab) - (setopt dape-buffer-window-arrangement 'right) (dape-breakpoint-global-mode 1)) ;; dumb-jump (use-package dumb-jump - :init + :config (add-hook 'xref-backend-functions #'dumb-jump-xref-activate)) ;; yasnippet @@ -1736,8 +1704,9 @@ With PROJECT, give diagnostics for all buffers in the current project." :map project-prefix-map ("s" . my/project-eshell) ("u" . my/project-run)) - :init - (setq uniquify-dirname-transform #'project-uniquify-dirname-transform) + :custom + (uniquify-dirname-transform #'project-uniquify-dirname-transform) + :config (defvar eshell-buffer-name) (defun my/project-eshell (prompt &optional arg) "Switch to or create an eshell buffer in the current projects root." @@ -1808,7 +1777,7 @@ COMMAND and COMINT are like `compile'." (compile command comint) (when (not my/project-run-command) (setq my/project-run-command command)))) - :config + (defun my/project-try-dotfile (dir) (if-let* ((root (locate-dominating-file dir my/project-root-marker))) (list 'vc nil root))) @@ -1841,15 +1810,16 @@ COMMAND and COMINT are like `compile'." :ensure nil :hook (nxml-mode . my/-nxml-setup) :init + (add-to-list 'auto-mode-alist + `(,(concat + (regexp-opt '("gschema" "gresource" "ui")) "\\'") + . nxml-mode)) + :config (defun my/-nxml-setup () "Setup `nxml-mode'." (sgml-electric-tag-pair-mode 1) (setq-local completion-at-point-functions - '(rng-completion-at-point cape-file))) - (add-to-list 'auto-mode-alist - `(,(concat - (regexp-opt '("gschema" "gresource" "ui")) "\\'") - . nxml-mode))) + '(rng-completion-at-point cape-file)))) ;; devdocs (use-package devdocs @@ -1858,8 +1828,6 @@ COMMAND and COMINT are like `compile'." ;; woman (use-package woman :ensure nil - :bind (:map help-map - ("C-m" . woman)) :init (add-to-list 'warning-suppress-log-types '(defvaralias losing-value woman-topic-history)) @@ -1949,6 +1917,9 @@ otherwise, call `bibtex-find-text'." ;; Latex help (from elisp file) (require 'latex-help) +(with-eval-after-load 'tex + (defvar TeX-mode-map) + (keymap-set TeX-mode-map "C-c ?" #'latex-help)) ;; AUCTeX (use-package auctex @@ -1957,8 +1928,6 @@ otherwise, call `bibtex-find-text'." (LaTeX-mode . my/-setup-LaTeX-mode) (LaTeX-mode . my/flycheck-if-trusted) (TeX-mode . kill-ring-deindent-mode)) - :bind (:map TeX-mode-map - ("C-c ?" . latex-help)) :init (add-to-list 'major-mode-remap-alist '(plain-tex-mode . plain-TeX-mode)) (add-to-list 'major-mode-remap-alist '(latex-mode . LaTeX-mode)) @@ -1968,6 +1937,10 @@ otherwise, call `bibtex-find-text'." (add-to-list 'major-mode-remap-alist '(doctex-mode . docTeX-mode)) (add-to-list 'auto-mode-alist '("/\\.latexmkrc\\'" . perl-mode)) (add-to-list 'auto-mode-alist '("\\.[tT]e[xX]\\'" . LaTeX-mode)) + :custom + (TeX-auto-save t) + (TeX-parse-self t) + (reftex-plug-into-AUCTeX t) :config (defun my/-auctex-texdoc-setup-env (oldfun &rest args) (let ((process-environment process-environment) @@ -1979,9 +1952,6 @@ otherwise, call `bibtex-find-text'." (advice-add 'TeX-documentation-texdoc :around 'my/-auctex-texdoc-setup-env) (defun my/-setup-LaTeX-mode () (setq evil-lookup-func 'latex-help-at-point)) - (setq TeX-auto-save t - TeX-parse-self t - reftex-plug-into-AUCTeX t) (evil-define-operator my/evil-LaTeX-fill (beg end) "Like `evil-fill', but using auctex." ;; The code here came straight from `evil-fill' @@ -2011,17 +1981,16 @@ otherwise, call `bibtex-find-text'." ;; blueprint (use-package blueprint-ts-mode - :hook (blueprint-ts-mode . my/eglot-if-trusted) - :after eglot) + :hook (blueprint-ts-mode . my/eglot-if-trusted)) ;; python-ts-mode (use-package python :ensure nil :hook ((python-ts-mode . my/eglot-if-trusted) (python-ts-mode . my/-setup-python-ts-mode)) - :init - (setq python-shell-interpreter "ipython" - python-shell-interpreter-args "-i --simple-prompt") + :custom + (python-shell-interpreter "ipython") + (python-shell-interpreter-args "-i --simple-prompt") :config (defun my/-setup-python-ts-mode () (setq-local fill-column 79))) @@ -2109,18 +2078,21 @@ This is :around advice, so OLDFUN is the real function ;; GLSL (use-package glsl-mode + :defer t :config (my/setup-c-style-newline-keys glsl-mode-map)) ;; php-mode (use-package php-ts-mode + :defer t :ensure nil :hook (php-mode . my/eglot-if-trusted)) ;; web-mode (use-package web-mode + :defer t :hook (web-mode . my/eglot-if-trusted) - :init + :config (add-to-list 'eglot-server-programs '(web-mode . ("vscode-html-language-server" "--stdio")))) @@ -2144,23 +2116,25 @@ This is :around advice, so OLDFUN is the real function :hook (sh-mode . my/-setup-sh-mode) :init (add-to-list 'auto-mode-alist '("/\\.envrc\\'" . sh-mode)) + :config (defun my/-setup-sh-mode () (add-hook 'completion-at-point-functions #'cape-file nil t))) ;; zsh-ts-mode (use-package zsh-ts-mode + :defer t :ensure nil) ;; go mode (use-package go-mode - :defer nil :hook (go-mode . my/eglot-if-trusted) :config (my/setup-c-style-newline-keys go-mode-map)) (use-package go-ts-mode :ensure nil :hook (go-ts-mode . my/eglot-if-trusted) - :custom (go-ts-mode-indent-offset 4)) + :custom + (go-ts-mode-indent-offset 4)) ;; rust (use-package rust-mode) @@ -2186,11 +2160,14 @@ This is :around advice, so OLDFUN is the real function (use-package groovy-mode) ;; cmake -(require 'cmake-mode) -(require 'cmake-ts-mode) +(require 'cmake-mode nil t) +(unless (featurep 'cmake-mode) + (require 'cmake-ts-mode) + (message "Failed to load `cmake-mode'.")) (with-eval-after-load 'cmake-mode + (defvar cmake-ts-mode-indent-offset) (add-hook 'cmake-ts-mode-hook #'my/eglot-if-trusted) - (setq cmake-ts-mode-indent-offset tab-width)) + (setopt cmake-ts-mode-indent-offset tab-width)) ;; kdl (require 'kdl-ts-mode) @@ -2321,15 +2298,12 @@ line in the block and manually deal with indentation." #'my/-apheleia-sly-skip-function))) ;; sly (use-package sly - ;; :hook (lisp-mode . my/-lisp-mode-autoconnect-sly) :bind (:map sly-mode-map ("C-c e" . my/diagnostic-at-point)) :autoload sly-connected-p + :custom + (inferior-lisp-program "/usr/bin/sbcl") :init - (defun my/-lisp-mode-autoconnect-sly () - (unless (sly-connected-p) - (sly))) - (setq inferior-lisp-program "/usr/bin/sbcl") (defun my/-sly-fix-special-buffers () (when (string-match-p (rx bos "*" (* any) "*" eos) (buffer-name)) (setq-local show-trailing-whitespace nil))) @@ -2429,21 +2403,6 @@ Note that this erases the buffer before doing anything." (use-package jupyter :hook (jupyter-repl-mode . my/-setup-jupyter-mode) :init - (defun my/-jupyter-dont-use-ts-modes (retval) - "Prevent `jupyter-kernel-language-mode-properties' from selecting TS modes." - (cl-destructuring-bind (mode syntax-table) retval - (if-let* (((string-suffix-p "-ts-mode" (symbol-name mode))) - (non-ts (car (rassq mode major-mode-remap-alist))) - ((not (string-suffix-p "-ts-mode" (symbol-name non-ts))))) - (list non-ts - (if-let* ((table-sym (intern-soft (format "%s-syntax-table" - non-ts)))) - (symbol-value table-sym) - syntax-table)) - retval))) - (advice-add 'jupyter-kernel-language-mode-properties - :filter-return #'my/-jupyter-dont-use-ts-modes) - (with-eval-after-load 'jupyter-org-client ;; fix some bugs (defun my/-fix-jupyter-org--set-src-block-cache (oldfun) @@ -2466,6 +2425,21 @@ Note that this erases the buffer before doing anything." (advice-add 'jupyter-org--define-key-filter :around #'my/-fix-jupyter-org--define-key-filter)) :config + (defun my/-jupyter-dont-use-ts-modes (retval) + "Prevent `jupyter-kernel-language-mode-properties' from selecting TS modes." + (cl-destructuring-bind (mode syntax-table) retval + (if-let* (((string-suffix-p "-ts-mode" (symbol-name mode))) + (non-ts (car (rassq mode major-mode-remap-alist))) + ((not (string-suffix-p "-ts-mode" (symbol-name non-ts))))) + (list non-ts + (if-let* ((table-sym (intern-soft (format "%s-syntax-table" + non-ts)))) + (symbol-value table-sym) + syntax-table)) + retval))) + (advice-add 'jupyter-kernel-language-mode-properties + :filter-return #'my/-jupyter-dont-use-ts-modes) + (face-spec-set 'jupyter-repl-traceback '((default . (:background unspecified))) 'face-override-spec) @@ -2601,8 +2575,9 @@ current buffer is a Jupyter buffer, just use that." ;; pdf-tools (use-package pdf-tools + :defer nil :hook (pdf-view-mode . my/setup-pdf-view-mode) - :init + :config (setq pdf-misc-print-program-executable "lp") (defun my/setup-pdf-view-mode () (display-line-numbers-mode -1) @@ -2610,14 +2585,14 @@ current buffer is a Jupyter buffer, just use that." (kbd "C-s") #'isearch-forward (kbd "C-r") #'isearch-backward) (setq-local cursor-type nil)) - (pdf-tools-install)) + (pdf-tools-install t t)) ;; doc view (use-package doc-view :ensure nil :hook (doc-view-mode . my/-setup-doc-view-mode) :custom (doc-view-odf->pdf-converter-program "/usr/bin/soffice") - :init + :config (defun my/-setup-doc-view-mode () (display-line-numbers-mode -1) (evil-define-key '(motion normal visual) 'local @@ -2632,15 +2607,15 @@ current buffer is a Jupyter buffer, just use that." ("M-" . calc-roll-up) ("M-TAB" . calc-roll-up)) :hook ((calc-mode calc-trail-mode) . my/setup-calc-calc-trail-mode) - :init + :custom + (mode-line-right-align-edge 'right-margin) + :config (defun my/setup-calc-calc-trail-mode () (setq-local doom-modeline-percent-position '() truncate-partial-width-windows nil) (visual-line-mode -1) (display-line-numbers-mode -1) (toggle-truncate-lines 1)) - (setq mode-line-right-align-edge 'right-margin) - :config (defun my/-window-dedicated-modeline-segment () (let ((dedicated (window-dedicated-p))) (cond @@ -2691,21 +2666,20 @@ current buffer is a Jupyter buffer, just use that." ;; sage (for when calc is not enough) (use-package sage-shell-mode - :demand :bind ("C-c g" . my/run-sage) :hook (sage-shell-mode . my/-setup-sage-shell-mode) :init - (defun my/-setup-sage-shell-mode () - (setq-local comint-dynamic-complete-functions - '(comint-c-a-p-replace-by-expanded-history))) - :config (defun my/run-sage (p) "Like `sage-shell:run-sage', but does not ask anything without a prefix argument." (interactive "P") (let ((sage-shell:ask-command-options p)) (funcall-interactively #'sage-shell:run-sage - (sage-shell:read-command))))) + (sage-shell:read-command)))) + :config + (defun my/-setup-sage-shell-mode () + (setq-local comint-dynamic-complete-functions + '(comint-c-a-p-replace-by-expanded-history)))) ;; fricas (because I like calculators) (add-to-list 'load-path "/usr/lib/fricas/emacs") @@ -2838,8 +2812,8 @@ Actually, return the method name." ;; eshell stuff (use-package eshell + :demand t :ensure nil - :defer nil :hook ((eshell-load . eat-eshell-visual-command-mode) (eshell-mode . eat-eshell-mode) (eshell-mode . my/-eshell-mode-setup) @@ -2849,7 +2823,7 @@ Actually, return the method name." ("" . completion-at-point)) :custom (eshell-history-append t) - :init + :config (defun my/-eshell-filter-alias-list () (cl-remove-if-not (lambda (elt) (or (string-match-p @@ -3001,11 +2975,11 @@ If no name is given, list all bookmarks instead." (directory-files-and-attributes dir-path)) path-end)))))))) (use-package eshell-syntax-highlighting - :init + :config (eshell-syntax-highlighting-global-mode 1)) (use-package eshell-starship + :after eshell :ensure nil - :demand t :hook (eshell-prompt-mode . eshell-starship-prompt-mode) :config (eshell-starship-setup-evil-keybindings) @@ -3030,15 +3004,16 @@ ARG is the same as for either of the above functions." ;; proced (use-package proced :bind ("C-x j" . proced) - :init + :hook (proced-mode . my/-setup-proced-mode) + :custom + (proced-auto-update-flag t) + (proced-auto-update-interval 1) + :config (evil-define-key '(motion visual normal) proced-mode-map "u" 'proced-unmark) - (setq proced-auto-update-flag t - proced-auto-update-interval 1) (defun my/-setup-proced-mode () (visual-line-mode -1) - (setq-local truncate-lines t)) - (add-hook 'proced-mode-hook 'my/-setup-proced-mode)) + (setq-local truncate-lines t))) ;; dired (use-package dired @@ -3047,26 +3022,26 @@ ARG is the same as for either of the above functions." (dired-listing-switches "-l --almost-all --human-readable --group-directories-first --no-group") (dired-hide-details-hide-symlink-targets nil) - :init - (setq-default dired-kill-when-opening-new-dired-buffer t) - (setq delete-by-moving-to-trash t - dired-recursive-copies 'always - dired-recursive-deletes 'always - dired-dwim-target t - dired-create-destination-dirs 'ask - dired-create-destination-dirs-on-trailing-dirsep t - dired-isearch-filenames 'dwim - dired-do-revert-buffer (lambda (dir) - (not (file-remote-p dir))) - dired-clean-up-buffers-too t - dired-clean-confirm-killing-deleted-buffers t) + (delete-by-moving-to-trash t) + (dired-recursive-copies 'always) + (dired-recursive-deletes 'always) + (dired-dwim-target t) + (dired-create-destination-dirs 'ask) + (dired-create-destination-dirs-on-trailing-dirsep t) + (dired-isearch-filenames 'dwim) + (dired-do-revert-buffer (lambda (dir) + (not (file-remote-p dir)))) + (dired-clean-up-buffers-too t) + (dired-clean-confirm-killing-deleted-buffers t) + (dired-kill-when-opening-new-dired-buffer t) + :config (evil-define-key '(normal visual motion) dired-mode-map "u" #'dired-unmark "U" #'dired-unmark-all-marks)) ;; dirvish (use-package dirvish - :defer nil + :demand t :bind (("C-c b" . dirvish-quick-access) :map dirvish-mode-map ("" . dirvish-subtree-toggle-or-open) @@ -3221,34 +3196,30 @@ ARG is the same as for either of the above functions." :map org-mode-map ("C-c t" . org-table-create)) :hook (org-mode . org-table-header-line-mode) + :custom + (org-directory "~/org") + (org-agenda-files '("~/org/")) + (org-confirm-babel-evaluate 'my/-check-org-babel-eval-no-confirm) + (org-log-into-drawer t) + (org-log-done 'time) + (org-log-redeadline 'time) + (org-preview-latex-default-process 'dvisvgm) + (org-highlight-latex-and-related '(native entities)) + (org-startup-with-inline-images t) + (org-adapt-indentation t) + (org-hide-leading-stars t) + (org-html-with-latex 'dvisvgm) + (org-preview-latex-process-alist + '((dvisvgm + :image-input-type "dvi" + :image-output-type "svg" + :image-size-adjust (1.7 . 1.5) + :latex-compiler ("pdflatex -interaction nonstopmode -output-format=dvi -output-directory=%o %f") + :image-converter ("dvisvgm %o%b.dvi --no-fonts --exact-bbox --scale=%S --output=%O")))) :init - (font-lock-add-keywords 'org-mode - `((,(rx bol (* " ") (group "-") " ") - (0 (prog1 nil - (compose-region (match-beginning 1) - (match-end 1) "•")))))) (defun my/-check-org-babel-eval-no-confirm (&rest args) (not (trusted-content-p))) - (setq org-directory "~/org" - org-agenda-files '("~/org/") - org-confirm-babel-evaluate 'my/-check-org-babel-eval-no-confirm - org-log-into-drawer t - org-log-done 'time - org-log-redeadline 'time - org-log-reschedule 'time - org-preview-latex-default-process 'dvisvgm - org-highlight-latex-and-related '(native entities) - org-startup-with-inline-images t - org-adapt-indentation t - org-hide-leading-stars t - org-html-with-latex 'dvisvgm - org-preview-latex-process-alist - '((dvisvgm - :image-input-type "dvi" - :image-output-type "svg" - :image-size-adjust (1.7 . 1.5) - :latex-compiler ("pdflatex -interaction nonstopmode -output-format=dvi -output-directory=%o %f") - :image-converter ("dvisvgm %o%b.dvi --no-fonts --exact-bbox --scale=%S --output=%O")))) + :config (defun my/-org-allow-in-derived-mode (oldfun &rest r) "Allow OLDFUN to run, even if `major-mode' is only derived from `org-mode'. R is rest of the arguments to OLDFUN." @@ -3259,7 +3230,11 @@ R is rest of the arguments to OLDFUN." (advice-add 'org-element-at-point :around 'my/-org-allow-in-derived-mode) (advice-add 'org-table-header-line-mode :around 'my/-org-allow-in-derived-mode) - :config + (font-lock-add-keywords 'org-mode + `((,(rx bol (* " ") (group "-") " ") + (0 (prog1 nil + (compose-region (match-beginning 1) + (match-end 1) "•")))))) ;; zero-width-space entity (add-to-list 'org-entities-user '("zwsp" "\\hspace{0pt}" nil "​" "​" "[zwsp]" "​")) @@ -3276,7 +3251,7 @@ R is rest of the arguments to OLDFUN." (use-package evil-org :after org :hook (org-mode . evil-org-mode) - :init + :config (require 'evil-org-agenda) (evil-org-agenda-set-keys)) @@ -3423,20 +3398,18 @@ This is the same as `evil-ret' except that it works for links in (use-package mu4e-alert :after mu4e :hook (after-init . mu4e-alert-enable-notifications) - :init - (setq mu4e-alert-set-window-urgency nil - mu4e-alert-interesting-mail-query my/mu4e-interesting-mail-query) + :custom + (mu4e-alert-set-window-urgency nil) + (mu4e-alert-interesting-mail-query my/mu4e-interesting-mail-query) :config (mu4e-alert-set-default-style 'libnotify)) (mu4e t) (mu4e-context-switch nil "Personal") ;; refresh the eww message count -(defun my/-mu4e-eww-refresh-unread-count () - "Refresh the eww unread message count. -This will also update waybar." - (my/eww-poll-variables "mu4e") +(defun my/-mu4e-status-bar-refresh-unread-count () + "Refresh the unread count in the status bar (waybar)." (call-process "pkill" nil 0 nil "-RTMIN+2" "waybar")) -(add-hook 'mu4e-message-changed-hook #'my/-mu4e-eww-refresh-unread-count) +(add-hook 'mu4e-message-changed-hook #'my/-mu4e-status-bar-refresh-unread-count) ;; mu4e compose HTML messages (use-package org-mime) @@ -3517,6 +3490,10 @@ BUFFER is the buffer-or-string to match against." (defun my/-setup-helpful-mode () (setq-local evil-lookup-func #'helpful-at-point tab-width 8)) + :custom + (helpful-switch-buffer-function 'my/-helpful-switch-buffer-function) + (helpful-max-buffers 2) + :config (defvar my/helpful-symbol-history-size 50 "Max size of `my/helpful-symbol-history'.") (defvar my/helpful-symbol-history '() @@ -3589,9 +3566,7 @@ buffers `helpful--sym' to `my/helpful-symbol-history'." (setq my/-helpful-last-entry entry)) (if window (window--display-buffer helpful-buf window 'reuse) - (pop-to-buffer helpful-buf)))) - (setq helpful-switch-buffer-function 'my/-helpful-switch-buffer-function - helpful-max-buffers 2)) + (pop-to-buffer helpful-buf))))) ;; useful for debugging (defun my/describe-symbol-plist (symbol) @@ -3701,7 +3676,7 @@ one of the normal rainbow-delimiters-depth-N-face faces." base-face) base-face)))) (setopt rainbow-delimiters-pick-face-function - 'my/rainbow-delimiters-parinfer-pick-face)) + #'my/rainbow-delimiters-parinfer-pick-face)) ;; make regexp look nicer (use-package easy-escape @@ -3753,10 +3728,10 @@ one of the normal rainbow-delimiters-depth-N-face faces." (nerd-icons-dired-mode)))) (use-package kind-icon :after corfu - :init - (setq kind-icon-default-face 'corfu-default - kind-icon-default-style - '(:padding -1 :stroke 0 :margin 0 :radius 0 :height 0.5 :scale 1)) + :custom + (kind-icon-default-face 'corfu-default) + (kind-icon-default-style + '(:padding -1 :stroke 0 :margin 0 :radius 0 :height 0.5 :scale 1)) :config (add-to-list 'corfu-margin-formatters #'kind-icon-margin-formatter)) @@ -3764,12 +3739,22 @@ one of the normal rainbow-delimiters-depth-N-face faces." (use-package doom-modeline :custom (doom-modeline-modal-icon t) - :init - (setq doom-modeline-support-imenu t) + (doom-modeline-support-imenu t) + :config (doom-modeline-mode 1)) ;; dashboard.el (use-package dashboard + :custom + (initial-buffer-choice (lambda () (get-buffer-create "*dashboard*"))) + (dashboard-force-refresh t) + (dashboard-display-icons-p t) + (dashboard-icon-type 'nerd-icons) + (dashboard-set-file-icons t) + (dashboard-projects-backend 'project-el) + (dashboard-items '((recents . 5) + (projects . 5) + (bookmarks . 5))) :config (defvar-local my/-dashboard-did-fix-image nil "Weather or not the dashboard image has been fixed in this buffer.") @@ -3782,25 +3767,16 @@ one of the normal rainbow-delimiters-depth-N-face faces." (setq-local display-line-numbers nil)) (add-hook 'dashboard-mode-hook 'my/-dashboard-setup-function) (set-face-background 'dashboard-banner-logo-title nil) - (dashboard-setup-startup-hook) - (setq initial-buffer-choice (lambda () (get-buffer-create "*dashboard*")) - dashboard-force-refresh t - dashboard-display-icons-p t - dashboard-icon-type 'nerd-icons - dashboard-set-file-icons t - dashboard-projects-backend 'project-el - dashboard-items '((recents . 5) - (projects . 5) - (bookmarks . 5)))) + (dashboard-setup-startup-hook)) ;; world clocks -(setq zoneinfo-style-world-list - '(("America/Los_Angeles" "California") - ("Asia/Tokyo" "Tokyo") - ("America/New_York" "New York") - ("Europe/London" "London") - ("Europe/Paris" "Paris") - ("Asia/Calcutta" "Bangalore"))) +(setopt zoneinfo-style-world-list + '(("America/Los_Angeles" "California") + ("Asia/Tokyo" "Tokyo") + ("America/New_York" "New York") + ("Europe/London" "London") + ("Europe/Paris" "Paris") + ("Asia/Calcutta" "Bangalore"))) ;; dictionaries (use-package dictionary