Skip to content

Commit

Permalink
Adjust whitespace when pasting before and after
Browse files Browse the repository at this point in the history
This adjustment is based on the actual content being pasted, and
whether it already includes whitespace or not.
  • Loading branch information
countvajhula committed Jun 15, 2024
1 parent 273f42e commit d82f68f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions symex-transformations-lisp.el
Original file line number Diff line number Diff line change
Expand Up @@ -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 ()
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit d82f68f

Please sign in to comment.