commit 721f23e6e87f481a04d7591081f915670994727c parent 1307b1391003080b06836b0a147d0dc432b41da0 Author: Yuval Langer <yuval.langer@gmail.com> Date: Thu, 18 Jul 2024 00:05:30 +0300 Add the `kakafarm/yank-unlines` function. Diffstat:
M | config/emacs/kakafarm-utils.el | | | 12 | ++++++++++++ |
1 file changed, 12 insertions(+), 0 deletions(-)
diff --git a/config/emacs/kakafarm-utils.el b/config/emacs/kakafarm-utils.el @@ -299,3 +299,15 @@ who-knows-where-and-who." list-of-lines :initial-value '()))) (message "%s" url))) + +(defun kakafarm/yank-unlines () + "Yank with each consecutive newlines converted to a single space, and trim both ends." + (interactive) + + (insert + (string-trim + (with-temp-buffer + (yank) + (goto-char 1) + (replace-regexp "\n+" " ") + (buffer-string)))))