From 126538bd8900f4851918713742339fe97e85217a Mon Sep 17 00:00:00 2001 From: Daniel Ziltener Date: Thu, 14 Dec 2023 17:35:16 +0100 Subject: [PATCH] . --- emacs/init.el | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index 862e322..36b9c5c 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -540,6 +540,18 @@ Point must be at the beginning of balanced expression (sexp)." (call-interactively #'forward-char) (call-interactively #'paredit-newline)) +(defun cc/slurp-forward () + "Slurps forward when the key is after the closing paren." + (interactive) + (call-interactively #'backward-char) + (call-interactively #'paredit-forward-slurp-sexp)) + +(defun cc/barf-forward () + "Barfs forward even when the key is after the closing paren." + (interactive) + (call-interactively #'backward-char) + (call-interactively #'paredit-forward-barf-sexp)) + (defun looking-at-opening-paren () (looking-at (rx (or "(" "{" "[")))) @@ -570,7 +582,11 @@ Point must be at the beginning of balanced expression (sexp)." (kbd "s") (conditional-keybind #'looking-at-opening-paren #'cc/move-sexp-forward) (kbd "c") (conditional-keybind #'looking-at-opening-paren - #'cc/clone-sexp))) + #'cc/clone-sexp) + (kbd ">") (conditional-keybind #'being-past-closing-paren + #'cc/slurp-forward) + (kbd "<") (conditional-keybind #'being-past-closing-paren + #'cc/barf-forward))) ;; (use-package smartparens ;; :delight (smartparens-mode " 󰅲 ")