From e2bac100e0988713e3733a4a15ff8229a0a45b24 Mon Sep 17 00:00:00 2001 From: Daniel Ziltener Date: Wed, 13 Dec 2023 13:28:20 +0100 Subject: [PATCH] feat: add rules for Scheme languages --- smartparens-scheme.el | 60 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 smartparens-scheme.el diff --git a/smartparens-scheme.el b/smartparens-scheme.el new file mode 100644 index 00000000..dd80c74c --- /dev/null +++ b/smartparens-scheme.el @@ -0,0 +1,60 @@ +;;; smartparens-clojure.el --- Additional configuration for Emacs Lisp mode. -*- lexical-binding: t; -*- + +;; Copyright (C) 2023 Daniel Ziltener + +;; Author: Daniel Ziltener +;; Created: 13 December 2023 +;; Keywords: abbrev convenience editing +;; 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 Emacs Lisp mode. To use +;; it, simply add: +;; +;; (require 'smartparens-scheme) +;; +;; into your configuration. You can use this in conjunction with the +;; default config or your own configuration. +;; +;;; Code: + +(require 'smartparens) + +(defvar sp-scheme-prefix "\\(?:[@`'#,_]+\\)" + "Prefix used in `sp-sexp-prefix' for emacs lisp mode.") + +(defvar sp-scheme-modes '(scheme-mode geiser-mode) + "List of Scheme-related modes.") + +(dolist (mode sp-scheme-modes) + (add-to-list 'sp-sexp-prefix `(,mode regexp ,sp-scheme-prefix))) + +;; Match "`" with "`" in strings and comments +(sp-with-modes sp-scheme-modes + (sp-local-pair "'" nil :actions nil) + (sp-local-pair "`" "`" + :when '(sp-in-string-p + sp-in-comment-p))) + +(provide 'smartparens-scheme) +;;; smartparens-scheme.el ends here