From 36f2e80c79a11aaede58232f43df765748454a03 Mon Sep 17 00:00:00 2001 From: Matus Goljer Date: Thu, 27 Jun 2024 17:32:03 +0200 Subject: [PATCH 01/13] docs: fix the use-package declaration in README Fixes #1207 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3ed43502..0cdbee65 100644 --- a/README.md +++ b/README.md @@ -67,10 +67,10 @@ You may want to try `smartparens-strict-mode`. This enforces that pairs are always balanced, so commands like `kill-line` keep your code well-formed. -You can also use `use-package` to install and setup `smartparens`. A minimal config is: +You can also use `use-package` to install and setup `smartparens`. An example config is: ``` elisp -(use-package smartparens-mode +(use-package smartparens :ensure smartparens ;; install the package :hook (prog-mode text-mode markdown-mode) ;; add `smartparens-mode` to these hooks :config From 0fe32ac56da6d8e725850e9c438904db24be0bb9 Mon Sep 17 00:00:00 2001 From: Matus Goljer Date: Sat, 29 Jun 2024 15:07:42 +0200 Subject: [PATCH 02/13] feat(lisp): insert space before opening paren after slurping This prevents some weirdly formatted code like (foo)(bar) becomnig (foo(bar)) instead of (foo (bar)) Fixes #781 --- smartparens-config.el | 12 ++++++++ smartparens.el | 12 ++++++-- test/smartparens-elisp-test.el | 51 ++++++++++++++++++++++++++++++++++ 3 files changed, 72 insertions(+), 3 deletions(-) diff --git a/smartparens-config.el b/smartparens-config.el index c639e5e9..8709c520 100644 --- a/smartparens-config.el +++ b/smartparens-config.el @@ -70,9 +70,21 @@ ID, ACTION, CONTEXT." ;; do not consider punctuation (not (looking-at "[?.,;!]")))))))) +(defun sp-lisp-insert-space-after-slurp (_id action _context) + (-let (((&plist :ok-orig :next-thing) sp-handler-context)) + (when (and (eq action 'slurp-forward) + (sp-get ok-orig (/= :beg-in :end-in))) + (save-excursion + (sp-get ok-orig (goto-char :end-in)) + (skip-syntax-backward " ") + (unless (looking-at-p (rx (or whitespace eol))) + (insert " ")))))) + ;; emacs is lisp hacking environment, so we set up some most common ;; lisp modes too (sp-with-modes sp-lisp-modes + (sp-local-pair "(" nil :post-handlers '(:add sp-lisp-insert-space-after-slurp)) + (sp-local-pair "[" nil :post-handlers '(:add sp-lisp-insert-space-after-slurp)) ;; disable ', it's the quote character! (sp-local-pair "'" nil :actions nil)) diff --git a/smartparens.el b/smartparens.el index f6251907..e10585f8 100644 --- a/smartparens.el +++ b/smartparens.el @@ -7362,7 +7362,12 @@ Examples: (let ((n (abs (prefix-numeric-value arg))) (enc (sp-get-enclosing-sexp)) (in-comment (sp-point-in-comment)) - next-thing ok) + next-thing ok + ;; At some places we mutate the value of `ok' + ;; destructively (updating the end). The original value + ;; is useful in the handlers for manipulating the + ;; surroundings, so we copy it here. + ok-orig) (when enc (save-excursion (if (sp--raw-argument-p arg) @@ -7387,6 +7392,7 @@ Examples: (goto-char (sp-get next-thing :end-suf)) (setq ok next-thing) (setq next-thing (sp-get-thing nil))) + (setq ok-orig (copy-sequence ok)) ;; do not allow slurping into a different context from ;; inside a comment (if (and in-comment @@ -7427,14 +7433,14 @@ Examples: (insert " ")))) (sp--run-hook-with-args (sp-get enc :op) :pre-handlers 'slurp-forward - (list :arg arg :enc enc :ok ok :next-thing next-thing)) + (list :arg arg :enc enc :ok ok :ok-orig ok-orig :next-thing next-thing)) (sp-get ok (insert :cl :suffix)) (sp--indent-region (sp-get ok :beg-prf) (point)) ;; HACK: update the "enc" data structure if ok==enc (when (= (sp-get enc :beg) (sp-get ok :beg)) (plist-put enc :end (point))) (sp--run-hook-with-args (sp-get enc :op) :post-handlers 'slurp-forward - (list :arg arg :enc enc :ok ok :next-thing next-thing))) + (list :arg arg :enc enc :ok ok :ok-orig ok-orig :next-thing next-thing))) (setq n (1- n))) (sp-message :cant-slurp) (setq n -1)))))))) diff --git a/test/smartparens-elisp-test.el b/test/smartparens-elisp-test.el index 9e1036e2..334725c7 100644 --- a/test/smartparens-elisp-test.el +++ b/test/smartparens-elisp-test.el @@ -25,3 +25,54 @@ punctuation was considered invalid." (sp-backward-delete-char) (sp-backward-delete-char) (sp-buffer-equals ";; `a-symbol-name'? I|"))) + +(prog1 "#781" + (ert-deftest sp-test-slurp-insert-space-for-style--next-sexp-paren-no-space () + (sp-test-with-temp-elisp-buffer "(foo|)(bar)" + (call-interactively 'sp-forward-slurp-sexp) + (sp-buffer-equals "(foo| (bar))") + (call-interactively 'sp-forward-barf-sexp) + (sp-buffer-equals "(foo|) (bar)") + (call-interactively 'sp-forward-slurp-sexp) + (sp-buffer-equals "(foo| (bar))"))) + + (ert-deftest sp-test-slurp-insert-space-for-style--next-sexp-paren-space () + (sp-test-with-temp-elisp-buffer "(foo|) (bar)" + (call-interactively 'sp-forward-slurp-sexp) + (sp-buffer-equals "(foo| (bar))") + (call-interactively 'sp-forward-barf-sexp) + (sp-buffer-equals "(foo|) (bar)") + (call-interactively 'sp-forward-slurp-sexp) + (sp-buffer-equals "(foo| (bar))"))) + + (ert-deftest sp-test-slurp-insert-space-for-style--next-sexp-symbol-no-space () + (sp-test-with-temp-elisp-buffer "(foo|)bar" + (call-interactively 'sp-forward-slurp-sexp) + (sp-buffer-equals "(foo| bar)") + (call-interactively 'sp-forward-barf-sexp) + (sp-buffer-equals "(foo|) bar") + (call-interactively 'sp-forward-slurp-sexp) + (sp-buffer-equals "(foo| bar)"))) + + (ert-deftest sp-test-slurp-insert-space-for-style--next-sexp-symbol-space () + (sp-test-with-temp-elisp-buffer "(foo|) bar" + (call-interactively 'sp-forward-slurp-sexp) + (sp-buffer-equals "(foo| bar)") + (call-interactively 'sp-forward-barf-sexp) + (sp-buffer-equals "(foo|) bar") + (call-interactively 'sp-forward-slurp-sexp) + (sp-buffer-equals "(foo| bar)"))) + + (ert-deftest sp-test-slurp-insert-space-for-style--no-extra-space-from-empty-sexp () + (sp-test-with-temp-elisp-buffer "(|)foo" + (call-interactively 'sp-forward-slurp-sexp) + (sp-buffer-equals "(|foo)") + (call-interactively 'sp-forward-barf-sexp) + (sp-buffer-equals "(|)foo"))) + + (ert-deftest sp-test-slurp-insert-space-for-style--next-on-new-line () + (sp-test-with-temp-elisp-buffer "(foo|)\n(bar)" + (call-interactively 'sp-forward-slurp-sexp) + (sp-buffer-equals "(foo|\n (bar))") + (call-interactively 'sp-forward-barf-sexp) + (sp-buffer-equals "(foo|)\n(bar)")))) From 2cb5996cf9d1ddbf7a8cd417b94ba1b0f07be248 Mon Sep 17 00:00:00 2001 From: Matus Goljer Date: Sat, 29 Jun 2024 15:08:28 +0200 Subject: [PATCH 03/13] ci: add Emacs 29.4 to test matrix --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 956bf8b6..e74e4324 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,6 +14,7 @@ jobs: - '29.1' - '29.2' - '29.3' + - '29.4' - 'snapshot' include: - emacs_version: 'snapshot' From c5ddcb79720647f9cab8bfe0043796f01bd14097 Mon Sep 17 00:00:00 2001 From: Dieter Komendera Date: Sun, 4 Feb 2024 16:49:03 +0100 Subject: [PATCH 04/13] feat(clojure): add support for clojure-ts-mode (and its derived modes) --- smartparens-clojure.el | 3 ++- smartparens-config.el | 3 ++- smartparens.el | 6 ++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/smartparens-clojure.el b/smartparens-clojure.el index 4408e8ae..2d98bee5 100644 --- a/smartparens-clojure.el +++ b/smartparens-clojure.el @@ -44,7 +44,8 @@ (defvar sp-clojure-prefix "\\(?:[@`'#~,_?^]+\\)" "Prefix used in `sp-sexp-prefix' for clojure modes.") -(dolist (mode '(clojure-mode clojurescript-mode clojurec-mode cider-repl-mode)) +(dolist (mode '(clojure-mode clojurescript-mode clojurec-mode cider-repl-mode + clojure-ts-mode clojurescript-ts-mode clojurec-ts-mode)) (add-to-list 'sp-sexp-prefix `(,mode regexp ,sp-clojure-prefix))) ;; Match "`" with "`" in strings and comments diff --git a/smartparens-config.el b/smartparens-config.el index 8709c520..7d328b42 100644 --- a/smartparens-config.el +++ b/smartparens-config.el @@ -129,7 +129,8 @@ ID, ACTION, CONTEXT." ;; macro, you MUST supply the major mode argument. (eval-after-load 'cc-mode '(require 'smartparens-c)) -(eval-after-load 'clojure-mode '(require 'smartparens-clojure)) +(--each '(clojure-mode clojure-ts-mode) + (eval-after-load it '(require 'smartparens-clojure))) (eval-after-load 'crystal-mode '(require 'smartparens-crystal)) (eval-after-load 'elixir-mode '(require 'smartparens-elixir)) (eval-after-load 'elixir-ts-mode '(require 'smartparens-elixir)) diff --git a/smartparens.el b/smartparens.el index e10585f8..a81d0a63 100644 --- a/smartparens.el +++ b/smartparens.el @@ -565,6 +565,9 @@ Symbol is defined as a chunk of text recognized by clojurec-mode clojurescript-mode clojurex-mode + clojure-ts-mode + clojurescript-ts-mode + clojurec-ts-mode common-lisp-mode emacs-lisp-mode eshell-mode @@ -597,6 +600,9 @@ Symbol is defined as a chunk of text recognized by clojurec-mode clojurescript-mode clojurex-mode + clojure-ts-mode + clojurescript-ts-mode + clojurec-ts-mode inf-clojure-mode ) "List of Clojure-related modes." From 470451b12fd89eebd641fda7acb2adb1e2afa97f Mon Sep 17 00:00:00 2001 From: Matus Goljer Date: Sat, 29 Jun 2024 15:13:53 +0200 Subject: [PATCH 05/13] style: re-format list of modes for better diffs --- smartparens-clojure.el | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/smartparens-clojure.el b/smartparens-clojure.el index 2d98bee5..a38ebce7 100644 --- a/smartparens-clojure.el +++ b/smartparens-clojure.el @@ -44,8 +44,15 @@ (defvar sp-clojure-prefix "\\(?:[@`'#~,_?^]+\\)" "Prefix used in `sp-sexp-prefix' for clojure modes.") -(dolist (mode '(clojure-mode clojurescript-mode clojurec-mode cider-repl-mode - clojure-ts-mode clojurescript-ts-mode clojurec-ts-mode)) +(dolist (mode '( + cider-repl-mode + clojure-mode + clojure-ts-mode + clojurec-mode + clojurec-ts-mode + clojurescript-mode + clojurescript-ts-mode + )) (add-to-list 'sp-sexp-prefix `(,mode regexp ,sp-clojure-prefix))) ;; Match "`" with "`" in strings and comments From 236748ccf8ee0b305bf7892138db55425ccc1b36 Mon Sep 17 00:00:00 2001 From: Matus Goljer Date: Sat, 29 Jun 2024 20:15:00 +0200 Subject: [PATCH 06/13] feat(coq): add basic config for Coq Fixes #1007 --- smartparens-config.el | 1 + smartparens-coq.el | 60 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 smartparens-coq.el diff --git a/smartparens-config.el b/smartparens-config.el index 7d328b42..80ab8202 100644 --- a/smartparens-config.el +++ b/smartparens-config.el @@ -131,6 +131,7 @@ ID, ACTION, CONTEXT." (eval-after-load 'cc-mode '(require 'smartparens-c)) (--each '(clojure-mode clojure-ts-mode) (eval-after-load it '(require 'smartparens-clojure))) +(eval-after-load 'coq-mode '(require 'smartparens-coq)) (eval-after-load 'crystal-mode '(require 'smartparens-crystal)) (eval-after-load 'elixir-mode '(require 'smartparens-elixir)) (eval-after-load 'elixir-ts-mode '(require 'smartparens-elixir)) diff --git a/smartparens-coq.el b/smartparens-coq.el new file mode 100644 index 00000000..c84a6cfc --- /dev/null +++ b/smartparens-coq.el @@ -0,0 +1,60 @@ +;;; smartparens-coq.el --- Additional configuration for Coq proof assistant -*- lexical-binding: t; -*- + +;; Copyright (C) 2024 Matus Goljer + +;; Author: Matus Goljer +;; Maintainer: Matus Goljer +;; Created: 29 June 2024 +;; Keywords: smartparens, coq +;; URL: https://github.com/Fuco1/smartparens + +;; This file is not part of GNU Emacs. + +;;; License: + +;; This file is part of Smartparens. + +;; Smartparens is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; Smartparens is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with Smartparens. If not, see . + +;;; Commentary: + +;; This file provides some additional configuration for Coq proof +;; assistant. To use it, simply add: +;; +;; (require 'smartparens-coq) +;; +;; into your configuration. You can use this in conjunction with the +;; default config or your own configuration. +;; +;; If you have good ideas about what should be added please file an +;; issue on the github tracker. +;; +;; For more info, see github readme at +;; https://github.com/Fuco1/smartparens + +;;; Code: + +(require 'smartparens) + +(sp-with-modes '(coq-mode) + ;; Disable ' because it is used in pattern-matching + (sp-local-pair "'" nil :actions nil) + ;; Disable ` because it is used in polymorphic variants + (sp-local-pair "`" nil :actions nil) + (sp-local-pair "(*" "*)" + :post-handlers '(("| " "SPC") + (" | " "*")))) + +(provide 'smartparens-coq) +;;; smartparens-coq.el ends here From 74d2b65531d7004f3b9baadb5d986bb719faee6e Mon Sep 17 00:00:00 2001 From: Matus Goljer Date: Sat, 29 Jun 2024 22:28:15 +0200 Subject: [PATCH 07/13] feat: disable strict mode if smartparens-mode is turned off This will remove some strict mode map remappings which would otherwise stay in effect. --- smartparens.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/smartparens.el b/smartparens.el index a81d0a63..d82a2c9f 100644 --- a/smartparens.el +++ b/smartparens.el @@ -743,6 +743,8 @@ You can enable pre-set bindings by customizing (add-hook 'pre-command-hook 'sp--save-pre-command-state nil 'local) (add-hook 'post-command-hook 'sp--post-command-hook-handler nil 'local) (run-hooks 'smartparens-enabled-hook)) + (when smartparens-strict-mode + (smartparens-strict-mode -1)) (remove-hook 'self-insert-uses-region-functions 'sp-wrap--can-wrap-p 'local) (remove-hook 'post-self-insert-hook 'sp--post-self-insert-hook-handler 'local) (remove-hook 'pre-command-hook 'sp--save-pre-command-state 'local) From cf5704812a36e7bb64f7b449a4de646f9325afa7 Mon Sep 17 00:00:00 2001 From: timor Date: Mon, 25 Mar 2019 20:01:32 +0100 Subject: [PATCH 08/13] Add customizable behavior allowing backward-delete of blank sexps This also changes the return value of `sp-point-in-blank-sexp` to return the beginning and ending positions of the enclosing regexp. --- smartparens.el | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/smartparens.el b/smartparens.el index d82a2c9f..946444d2 100644 --- a/smartparens.el +++ b/smartparens.el @@ -1535,6 +1535,12 @@ kill \"subwords\" when `subword-mode' is active." :type 'boolean :group 'smartparens) +(defcustom sp-delete-blank-sexps nil + "If non-nil, allow deletion of enclosing pair when it only + contains whitespace." + :type 'boolean + :group 'smartparens) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Selection mode handling @@ -1829,14 +1835,18 @@ If optional argument P is present test this instead of point." If optional argument P is present test this instead of point. +Returns a cons containing the position of the beginning and end +delimiters. + Warning: it is only safe to call this when point is inside a sexp, otherwise the call may be very slow." (save-excursion (when p (goto-char p)) (-when-let (enc (sp-get-enclosing-sexp)) - (sp-get enc (string-match-p - "\\`[ \t\n]*\\'" - (buffer-substring-no-properties :beg-in :end-in)))))) + (sp-get enc (when (string-match-p + "\\`[ \t\n]*\\'" + (buffer-substring-no-properties :beg-in :end-in)) + (cons :beg :end)))))) (defun sp-char-is-escaped-p (&optional point) "Test if the char at POINT is escaped or not. @@ -9141,6 +9151,8 @@ If on a closing delimiter, move backward into balanced expression. If on a opening delimiter, refuse to delete unless the balanced expression is empty, in which case delete the entire expression. +If `sp-delete-blank-sexps' is non-nil, the expression is also +considered empty if it contains only white-space. If the delimiter does not form a balanced expression, it will be deleted normally. @@ -9186,6 +9198,13 @@ Examples: ok) ;; make this customizable (setq n (1- n))) + ((and sp-delete-blank-sexps + (sp--looking-back (sp--get-opening-regexp (sp--get-pair-list-context 'navigate))) + (-when-let ((beg . end) (sp-point-in-blank-sexp)) + (goto-char beg) + (delete-char (- end beg)) + t)) + (setq n (1- n))) ((and (sp-point-in-string) (save-excursion (backward-char) (not (sp-point-in-string)))) (setq n 0)) From a865339f7c13c04ae5fdefa8b49957ce7b32179d Mon Sep 17 00:00:00 2001 From: Matus Goljer Date: Sat, 29 Jun 2024 23:03:50 +0200 Subject: [PATCH 09/13] docs: clarify the docstrings --- smartparens.el | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/smartparens.el b/smartparens.el index 946444d2..309cea11 100644 --- a/smartparens.el +++ b/smartparens.el @@ -1536,8 +1536,11 @@ kill \"subwords\" when `subword-mode' is active." :group 'smartparens) (defcustom sp-delete-blank-sexps nil - "If non-nil, allow deletion of enclosing pair when it only - contains whitespace." + "If non-nil, automatically delete enclosing pair when it only +contains whitespace. + +This setting only has effect if `smartparens-strict-mode' is +active." :type 'boolean :group 'smartparens) @@ -1835,18 +1838,19 @@ If optional argument P is present test this instead of point." If optional argument P is present test this instead of point. -Returns a cons containing the position of the beginning and end -delimiters. +If the sexp around the point is blank, the return value is a cons +containing the beginning and end of the expression. Warning: it is only safe to call this when point is inside a sexp, otherwise the call may be very slow." (save-excursion (when p (goto-char p)) (-when-let (enc (sp-get-enclosing-sexp)) - (sp-get enc (when (string-match-p - "\\`[ \t\n]*\\'" - (buffer-substring-no-properties :beg-in :end-in)) - (cons :beg :end)))))) + (sp-get enc + (when (string-match-p + "\\`[ \t\n]*\\'" + (buffer-substring-no-properties :beg-in :end-in)) + (cons :beg :end)))))) (defun sp-char-is-escaped-p (&optional point) "Test if the char at POINT is escaped or not. From 98f135746c63bcef25fb2991cf72d8baf03a076c Mon Sep 17 00:00:00 2001 From: Matus Goljer Date: Sat, 29 Jun 2024 23:08:50 +0200 Subject: [PATCH 10/13] test: add test for sp-delete-blank-sexps --- test/smartparens-commands-test.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/smartparens-commands-test.el b/test/smartparens-commands-test.el index 3e43b7f7..32111e2a 100644 --- a/test/smartparens-commands-test.el +++ b/test/smartparens-commands-test.el @@ -725,7 +725,10 @@ be." ((nil ("[foo]|" "[foo|]") ("\\{foo\\}|" "\\{foo|\\}") - ("\"foo\\\\\"|" "\"foo\\\\|\"")))) + ("\"foo\\\\\"|" "\"foo\\\\|\"") + ("(|)" "|")) + (((sp-delete-blank-sexps t)) + ("[| ]" "|")))) (ert-deftest sp-test-command-sp-backward-delete-char-hungry-delete-mode () "In `hungry-delete-mode' we should kill all whitespace." From f9fc6c9c3c2b3fc54d3389bed2200fc5ac5bb1b0 Mon Sep 17 00:00:00 2001 From: Akinori MUSHA Date: Tue, 2 Jul 2024 22:41:25 +0900 Subject: [PATCH 11/13] Use fboundp for functions --- smartparens-ruby.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/smartparens-ruby.el b/smartparens-ruby.el index 31267c7d..27b9c365 100644 --- a/smartparens-ruby.el +++ b/smartparens-ruby.el @@ -56,14 +56,14 @@ (defun sp-ruby-forward-sexp () "Wrapper for `ruby-forward-sexp' based on `enh-ruby-mode'." (interactive) - (if (boundp 'enh-ruby-forward-sexp) + (if (fboundp 'enh-ruby-forward-sexp) (enh-ruby-forward-sexp) (ruby-forward-sexp))) (defun sp-ruby-backward-sexp () "Wrapper for `ruby-backward-sexp' based on `enh-ruby-mode'." (interactive) - (if (boundp 'enh-ruby-backward-sexp) + (if (fboundp 'enh-ruby-backward-sexp) (enh-ruby-backward-sexp) (ruby-backward-sexp))) From ab475c78916d7b1666a495e3fe9c54b250195637 Mon Sep 17 00:00:00 2001 From: Matus Goljer Date: Sun, 7 Jul 2024 18:35:18 +0200 Subject: [PATCH 12/13] docs: fix typo fixes #1214 --- smartparens.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smartparens.el b/smartparens.el index 309cea11..ba6eb648 100644 --- a/smartparens.el +++ b/smartparens.el @@ -5853,7 +5853,7 @@ Pair object is anything delimited by pairs from `sp-pair-list'." (execute-kbd-macro cmd)))) (defun sp-prefix-symbol-object (&optional _arg) - "Read the command and invoke it on the next pair object. + "Read the command and invoke it on the next symbol object. If you specify a regular emacs prefix argument this is passed to the executed command. Therefore, executing From cf78df174010b6926dddaae94f1aa471c7c1d138 Mon Sep 17 00:00:00 2001 From: Jimmy Yuen Ho Wong Date: Sat, 13 Jul 2024 01:43:16 +0100 Subject: [PATCH 13/13] config for c-ts-mode and c++-ts-mode --- smartparens-config.el | 3 ++- smartparens.el | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/smartparens-config.el b/smartparens-config.el index 80ab8202..981641f5 100644 --- a/smartparens-config.el +++ b/smartparens-config.el @@ -128,7 +128,8 @@ ID, ACTION, CONTEXT." ;; automatically. If you want to call sp-local-pair outside this ;; macro, you MUST supply the major mode argument. -(eval-after-load 'cc-mode '(require 'smartparens-c)) +(--each '(cc-mode c-ts-mode) + (eval-after-load it '(require 'smartparens-c))) (--each '(clojure-mode clojure-ts-mode) (eval-after-load it '(require 'smartparens-clojure))) (eval-after-load 'coq-mode '(require 'smartparens-coq)) diff --git a/smartparens.el b/smartparens.el index ba6eb648..7ea05734 100644 --- a/smartparens.el +++ b/smartparens.el @@ -612,6 +612,8 @@ Symbol is defined as a chunk of text recognized by (defcustom sp-c-modes '( c-mode c++-mode + c-ts-mode + c++-ts-mode ) "List of C-related modes." :type '(repeat symbol)