From 92a733e106e0c4cdad5657443ec471204a27abf5 Mon Sep 17 00:00:00 2001 From: Alexander Rosenberg Date: Mon, 31 Aug 2026 22:13:53 -0700 Subject: [PATCH] Add lisp-ts-mode --- init.el | 46 ++++++++++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/init.el b/init.el index bf96d4c..20c57ed 100644 --- a/init.el +++ b/init.el @@ -1668,12 +1668,11 @@ With PROJECT, give diagnostics for all buffers in the current project." (add-to-list 'apheleia-formatters '(raco-fmt "raco" "fmt" (apheleia-formatters-fill-column "--width"))) - (add-to-list 'apheleia-mode-alist - '(racket-mode . lisp-indent)) - (add-to-list 'apheleia-mode-alist - '(mhtml-ts-mode . prettier-html)) (setf (alist-get 'java-mode apheleia-mode-alist) 'clang-format - (alist-get 'java-ts-mode apheleia-mode-alist) 'clang-format)) + (alist-get 'java-ts-mode apheleia-mode-alist) 'clang-format + (alist-get 'lisp-ts-mode apheleia-mode-alist) 'lisp-indent + (alist-get 'racket-mode apheleia-mode-alist) 'lisp-indent + (alist-get 'mhtml-ts-mode apheleia-mode-alist) 'prettier-html)) ;; awk (with-eval-after-load 'cc-mode @@ -2425,22 +2424,37 @@ line in the block and manually deal with indentation." elisp-add-help-echo nil) ;; common lisp -(use-package lisp-mode - :ensure nil - :hook (lisp-mode . my/-format-only-when-sly-running) +(defun my/apheleia-sly-skip-function () + "`apheleia-skip-functions' to skip when sly is not running." + (or (not (bound-and-true-p sly-mode)) + (not (sly-connected-p)))) +(defun my/format-only-when-sly-running () + "Make apheleia-mode format Lisp buffers only when sly is running." + (add-to-list (make-local-variable 'apheleia-skip-functions) + #'my/-apheleia-sly-skip-function)) +(with-eval-after-load 'lisp-mode + (add-hook 'lisp-mode-hook #'my/format-only-when-sly-running)) + +;; lisp-ts-mode +(use-package lisp-ts-mode + :hook ((lisp-ts-mode . my/format-only-when-sly-running) + (lisp-ts-mode . rainbow-delimiters-mode) + (lisp-ts-mode . sly-editing-mode) + (lisp-ts-mode . lisp-ts-format-support-mode) + (lisp-ts-mode . auto-highlight-symbol-mode)) + :custom + (lisp-ts-mode-format-rainbow-delimiters t) :init - (defun my/-apheleia-sly-skip-function () - (or (not (bound-and-true-p sly-mode)) - (not (sly-connected-p)))) - (defun my/-format-only-when-sly-running () - "Make apheleia-mode format lisp buffers only when sly is running." - (add-to-list (make-local-variable 'apheleia-skip-functions) - #'my/-apheleia-sly-skip-function))) + (add-to-list 'major-mode-remap-alist '(lisp-mode . lisp-ts-mode)) + :config + (setf (alist-get 'lisp-ts-mode font-lock-ignore) + lisp-ts-mode-font-lock-ignore-keywords)) + ;; sly (use-package sly :bind (:map sly-mode-map ("C-c e" . my/diagnostic-at-point)) - :autoload sly-connected-p + :autoload (sly-connected-p sly--lisp-indent-lisp-mode-hook sly-editing-mode) :custom (inferior-lisp-program "/usr/bin/sbcl") :init