This commit is contained in:
Daniel Ziltener 2023-12-14 17:35:16 +01:00
parent 051092c4be
commit 126538bd89
Signed by: zilti
GPG key ID: B38976E82C9DAE42

View file

@ -540,6 +540,18 @@ Point must be at the beginning of balanced expression (sexp)."
(call-interactively #'forward-char) (call-interactively #'forward-char)
(call-interactively #'paredit-newline)) (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 () (defun looking-at-opening-paren ()
(looking-at (rx (or "(" "{" "[")))) (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 (kbd "s") (conditional-keybind #'looking-at-opening-paren
#'cc/move-sexp-forward) #'cc/move-sexp-forward)
(kbd "c") (conditional-keybind #'looking-at-opening-paren (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 ;; (use-package smartparens
;; :delight (smartparens-mode " 󰅲 ") ;; :delight (smartparens-mode " 󰅲 ")