From 27a8b03fa5490be365c8de92abe57257499281b3 Mon Sep 17 00:00:00 2001 From: Gerard Vermeulen Date: Wed, 26 Apr 2023 10:20:10 +0200 Subject: [PATCH] Setup `smartparens' for `go-ts-mode' (no `go-ts-mode-hook' yet) --- README.org | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.org b/README.org index 2277b51..84f646a 100644 --- a/README.org +++ b/README.org @@ -5735,6 +5735,7 @@ contrary to for instance [[https://github.com/Fanael/rainbow-delimiters#readme][ (dolist (hook '(emacs-lisp-mode-hook geiser-repl-startup-hook + ;; go-mode-ts-hook is not operational in Emacs-29! ielm-mode-hook lisp-data-mode-hook lisp-mode-hook @@ -5743,6 +5744,16 @@ contrary to for instance [[https://github.com/Fanael/rainbow-delimiters#readme][ sly-mrepl-mode-hook)) (add-hook hook #'smartparens-strict-mode)) + (when (fboundp 'go-ts-mode) + ;; Stolen from `smartparens-go': + (sp-with-modes 'go-ts-mode + (sp-local-pair "{" nil :post-handlers '(("||\n[i]" "RET"))) + (sp-local-pair "/*" "*/" :post-handlers '(("| " "SPC") + ("* ||\n[i]" "RET")))) + ;; Go has no sexp suffices. This fixes slurping: + ;; (|foo).bar -> (foo.bar) + (add-to-list 'sp-sexp-suffix (list #'go-mode 'regexp ""))) + ;; https://xenodium.com/emacs-smartparens-auto-indent/index.html (defun indent-between-pair (&rest _ignored) (newline)