From d82f68ff47babc7580d1bc524de017457b17fa24 Mon Sep 17 00:00:00 2001 From: Siddhartha Date: Tue, 30 Apr 2024 18:27:14 -0700 Subject: [PATCH] Adjust whitespace when pasting before and after This adjustment is based on the actual content being pasted, and whether it already includes whitespace or not. --- symex-transformations-lisp.el | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/symex-transformations-lisp.el b/symex-transformations-lisp.el index af855bb4..6e90a1d3 100644 --- a/symex-transformations-lisp.el +++ b/symex-transformations-lisp.el @@ -176,6 +176,10 @@ text, on the respective side." at-eol multiline) "\n") + ((and before + (string-match-p (concat symex--re-whitespace "$") + (symex--current-kill))) + "") (t " "))))) (defun symex-lisp--paste-before () @@ -213,6 +217,10 @@ If a symex is currently selected, then paste after the end of the selected expression. Otherwise, paste in place." (interactive) (let ((padding (symex-lisp--padding nil))) + (if (symex-lisp--point-at-last-symex-p) + (symex--kill-ring-push + (string-trim-right + (symex--kill-ring-pop)))) (save-excursion (condition-case nil (forward-sexp)