From 05cdbd0fb2f1a851391ef4d147d0f0f18fe95705 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Fri, 30 Oct 2020 18:23:10 -0700 Subject: [PATCH] =?UTF-8?q?Add=20=E2=80=98embrace=E2=80=99=20configuration?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- oni-core.el | 4 +-- oni-embrace.el | 41 +++++++++++++++++++++++++++++++ oni-groovy.el | 4 +-- test/integration/oni-embrace.bats | 10 ++++++++ test/integration/oni-groovy.bats | 10 ++++++++ 5 files changed, 65 insertions(+), 4 deletions(-) create mode 100644 oni-embrace.el create mode 100755 test/integration/oni-embrace.bats diff --git a/oni-core.el b/oni-core.el index c24e719..c7ad289 100644 --- a/oni-core.el +++ b/oni-core.el @@ -4,8 +4,8 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 2020.1019.134634 -;; Package-Requires: (oni-data-dir expand-region multiple-cursors embrace gcmh diminish ws-butler) +;; Version: 2020.1030.180657 +;; Package-Requires: (oni-data-dir oni-embrace expand-region multiple-cursors gcmh diminish ws-butler) ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by diff --git a/oni-embrace.el b/oni-embrace.el new file mode 100644 index 0000000..4e6389e --- /dev/null +++ b/oni-embrace.el @@ -0,0 +1,41 @@ +;;; oni-embrace.el --- Configuration for embrace -*- lexical-binding: t; -*- + +;; Copyright (C) 2020 Tom Willemse + +;; Author: Tom Willemse +;; Keywords: local +;; Version: 2020.1030.180221 +;; Package-Requires: (embrace) + +;; This program 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. + +;; This program 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 this program. If not, see . + +;;; Commentary: + +;; Configuration for embrace. + +;;; Code: + +(require 'embrace) + +(defun oni-embrace-add-slashes () + "Add slashes to the embrace pairs. +‘groovy-mode’ for example supports strings delimited by slashes." + (embrace-add-pair ?/ "/" "/")) + +(add-hook 'groovy-mode-hook #'oni-embrace-add-slashes) + +;;;###autoload(with-eval-after-load 'embrace (require 'oni-embrace)) + +(provide 'oni-embrace) +;;; oni-embrace.el ends here diff --git a/oni-groovy.el b/oni-groovy.el index 9312c0c..43f6294 100644 --- a/oni-groovy.el +++ b/oni-groovy.el @@ -4,8 +4,8 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 2020.1019.103906 -;; Package-Requires: (groovy-mode groovy-imports rainbow-delimiters jenkinsfile-mode) +;; Version: 2020.1030.180316 +;; Package-Requires: (groovy-mode oni-embrace groovy-imports rainbow-delimiters jenkinsfile-mode) ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by diff --git a/test/integration/oni-embrace.bats b/test/integration/oni-embrace.bats new file mode 100755 index 0000000..0f9f532 --- /dev/null +++ b/test/integration/oni-embrace.bats @@ -0,0 +1,10 @@ +#!/usr/bin/env bats + +@test "Loading embrace loads oni-embrace" { + run emacs -batch -l package -f package-initialize -l embrace \ + -eval "(prin1 (featurep 'oni-embrace))" + + echo "$output" + + [[ "$output" == *"t" ]] +} diff --git a/test/integration/oni-groovy.bats b/test/integration/oni-groovy.bats index 5a768a3..dc86b82 100755 --- a/test/integration/oni-groovy.bats +++ b/test/integration/oni-groovy.bats @@ -39,3 +39,13 @@ [[ "$output" == *"jenkinsfile-mode" ]] } + +@test "Groovy has slashy string support in Embrace" { + run emacs -batch -l package -f package-initialize -l embrace \ + -visit "test.groovy" \ + -eval "(prin1 (not (null (alist-get ?/ embrace--pair-list))))" + + echo "$output" + + [[ "$output" == *"t" ]] +}