Setup `smartparens' for `go-ts-mode' (no `go-ts-mode-hook' yet)

This commit is contained in:
Gerard Vermeulen 2023-04-26 10:20:10 +02:00
parent 0103313c16
commit 27a8b03fa5
1 changed files with 11 additions and 0 deletions

View File

@ -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)