GNU bug report logs - #43847
ERC - prevent yanking multiple lines into IRC (feature request) *patch*

Previous Next

Package: emacs;

Reported by: Corwin Brust <corwin <at> bru.st>

Date: Wed, 7 Oct 2020 14:13:01 UTC

Severity: wishlist

Full log


Message #29 received at 43847 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Corwin Brust <corwin <at> bru.st>
Cc: 43847 <at> debbugs.gnu.org
Subject: Re: bug#43847: ERC - prevent yanking multiple lines into IRC
 (feature request) *patch*
Date: Fri, 09 Oct 2020 06:54:42 +0200
Corwin Brust <corwin <at> 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




This bug report was last modified 4 years and 304 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.