1
0
Fork 0

Add ‘embrace’ configuration

This commit is contained in:
Tom Willemse 2020-10-30 18:23:10 -07:00
parent 897ab273a0
commit 05cdbd0fb2
5 changed files with 65 additions and 4 deletions

View file

@ -4,8 +4,8 @@
;; Author: Tom Willemse <tom@ryuslash.org>
;; 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

41
oni-embrace.el Normal file
View file

@ -0,0 +1,41 @@
;;; oni-embrace.el --- Configuration for embrace -*- lexical-binding: t; -*-
;; Copyright (C) 2020 Tom Willemse
;; Author: Tom Willemse <chelys@rincewind>
;; 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 <https://www.gnu.org/licenses/>.
;;; 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

View file

@ -4,8 +4,8 @@
;; Author: Tom Willemse <tom@ryuslash.org>
;; 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

View file

@ -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" ]]
}

View file

@ -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" ]]
}