[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#43847: ERC - prevent yanking multiple lines into IRC (feature reques
From: |
Lars Ingebrigtsen |
Subject: |
bug#43847: ERC - prevent yanking multiple lines into IRC (feature request) *patch* |
Date: |
Fri, 09 Oct 2020 06:54:42 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Corwin Brust <corwin@bru.st> writes:
> I hate it when I accidentally paste multi-line text into ERC. I
> *never* actually intend to do this.
I sometimes want to, and sometimes I don't want to. I think it would be
pretty surprising for users if we rebind `C-y' in this way.
I'm using a command that fixes whitespace and removes newlines from the
kill ring, which is perhaps more generally useful. Let's see...
(global-set-key
[(hyper y)]
(lambda ()
(interactive)
(insert
(with-temp-buffer
(yank)
(goto-char (point-min))
(while (re-search-forward "[\t\n ]+" nil t)
(replace-match " "))
(goto-char (point-min))
(when (re-search-forward " +$" nil t)
(replace-match ""))
(buffer-string)))))
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
bug#43847: ERC - prevent yanking multiple lines into IRC (feature request) *patch*, Brett Gilio, 2020/10/07
bug#43847: ERC - prevent yanking multiple lines into IRC (feature request) *patch*,
Lars Ingebrigtsen <=