[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/smartparens 2834c66: feat(r): do not pair \( in R short-la
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/smartparens 2834c66: feat(r): do not pair \( in R short-lambda syntax |
Date: |
Sat, 4 Sep 2021 12:57:42 -0400 (EDT) |
branch: elpa/smartparens
commit 2834c66c4f09778d0c57e99886c329188eed591a
Author: Matus Goljer <matus.goljer@gmail.com>
Commit: Matus Goljer <matus.goljer@gmail.com>
feat(r): do not pair \( in R short-lambda syntax
---
smartparens-ess.el | 3 +++
test/smartparens-ess-test.el | 13 +++++++++++++
2 files changed, 16 insertions(+)
diff --git a/smartparens-ess.el b/smartparens-ess.el
index 569a2ba..25ba455 100644
--- a/smartparens-ess.el
+++ b/smartparens-ess.el
@@ -229,6 +229,9 @@ ID, ACTION, CONTEXT."
:post-handlers '((sp-ess-open-sexp-indent "M-j"))
:suffix "{[^}]*}"))
+(sp-with-modes '(ess-r-mode inferior-ess-r-mode)
+ (sp-local-pair "\\(" nil
+ :unless '(:add sp-in-code-p)))
(provide 'smartparens-ess)
;;; smartparens-ess ends here
diff --git a/test/smartparens-ess-test.el b/test/smartparens-ess-test.el
index 89499aa..b1bddf2 100644
--- a/test/smartparens-ess-test.el
+++ b/test/smartparens-ess-test.el
@@ -69,3 +69,16 @@ kill it as a word/symbol"
(sp-test--ess-mode)
(sp-backward-kill-word 1)
(sp-buffer-equals "ggplot(mtcars, aes(mpg, am)) + facet_|()"))))
+
+(prog1 "Test the new R lambda function syntax"
+ (ert-deftest sp-test-ess-short-lambda-function-in-code ()
+ (sp-test-with-temp-buffer "|"
+ (sp-test--ess-mode)
+ (execute-kbd-macro "\\(foo")
+ (sp-buffer-equals "\\(foo|)")))
+
+ (ert-deftest sp-test-ess-short-lambda-function-in-string ()
+ (sp-test-with-temp-buffer "\"|\""
+ (sp-test--ess-mode)
+ (execute-kbd-macro "\\(foo")
+ (sp-buffer-equals "\"\\(foo|\\)\""))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [nongnu] elpa/smartparens 2834c66: feat(r): do not pair \( in R short-lambda syntax,
ELPA Syncer <=