From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Corwin Brust Newsgroups: gmane.emacs.bugs Subject: bug#43847: ERC - prevent yanking multiple lines into IRC (feature request) *patch* Date: Fri, 9 Oct 2020 10:41:26 -0500 Message-ID: References: <87tuv43sod.fsf@gnus.org> <878scfj0oa.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8987"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 43847@debbugs.gnu.org, Amin Bandali To: =?UTF-8?Q?K=C3=A9vin?= Le Gouguec , Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Oct 09 17:42:11 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kQuX2-00028v-1M for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 09 Oct 2020 17:42:08 +0200 Original-Received: from localhost ([::1]:34336 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kQuX0-0006EM-Vy for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 09 Oct 2020 11:42:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55126) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kQuWw-0006Do-3k for bug-gnu-emacs@gnu.org; Fri, 09 Oct 2020 11:42:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:52764) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kQuWv-0007OT-Qs for bug-gnu-emacs@gnu.org; Fri, 09 Oct 2020 11:42:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kQuWv-0007uL-O2 for bug-gnu-emacs@gnu.org; Fri, 09 Oct 2020 11:42:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Corwin Brust Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 09 Oct 2020 15:42:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43847 X-GNU-PR-Package: emacs Original-Received: via spool by 43847-submit@debbugs.gnu.org id=B43847.160225810630375 (code B ref 43847); Fri, 09 Oct 2020 15:42:01 +0000 Original-Received: (at 43847) by debbugs.gnu.org; 9 Oct 2020 15:41:46 +0000 Original-Received: from localhost ([127.0.0.1]:36077 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kQuWg-0007tr-5A for submit@debbugs.gnu.org; Fri, 09 Oct 2020 11:41:46 -0400 Original-Received: from mail-ej1-f49.google.com ([209.85.218.49]:40562) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kQuWd-0007tb-GI for 43847@debbugs.gnu.org; Fri, 09 Oct 2020 11:41:44 -0400 Original-Received: by mail-ej1-f49.google.com with SMTP id p15so13707970ejm.7 for <43847@debbugs.gnu.org>; Fri, 09 Oct 2020 08:41:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=hi7MauzQJvuOcmTG914DW2+aklalnS4FTtDmLu6Hjkc=; b=cTJ5FKg/hCg1OUrZEeuDcNinES7X2iQhnXvx8iyEKsuL5gQ47moNZ50qT/lMls+g/N Z/lmD7LY2tfPchbiIv7kPRuSjIvHRCMbloggL9nu6gMK+46gJMI/U+XmhAtuqhWxazH+ hptMOP1m1uNaHBQOP0+xSYenamV7rCR/FBdRZXO6Gjow0uMLN9vuSvS3QOqoG9/SLpS3 ZyqknwoDHj0tbWNSBwCfrU/dq9mhh7DSBBjIpfsk4reRHfc8H4WMmetIJ1+Y9JVQJB4v 0079rUmTm0J2u/+OhkfcJ9EiVBoqZhQRzX7L2SVUpNJiBSotCORWrSREOaTUFe8HSGmN ibzw== X-Gm-Message-State: AOAM532N+psimEyq93YtGEtG61UkQInoDReZGSFZLJJMqpeRi2p9Pkf6 8U9EdiT/QaK01muw8o+/QJtYmLrImy6zsSeE9XA= X-Google-Smtp-Source: ABdhPJwgJJIJ6aZNqpjwZphJexLQx0N0itMc0UoMk0j7cSA1TQNg4HZa8O1GKYekuSY9Q6Q07Vt6WwVASx9xzjiqwHI= X-Received: by 2002:a17:906:340b:: with SMTP id c11mr14885287ejb.213.1602258097654; Fri, 09 Oct 2020 08:41:37 -0700 (PDT) In-Reply-To: <878scfj0oa.fsf@gmail.com> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:190168 Archived-At: Hi K=C3=A9vin and Lars. CCd Amin on this one also :) On Fri, Oct 9, 2020 at 2:54 AM K=C3=A9vin Le Gouguec wrote: > > Lars Ingebrigtsen writes: > > > Corwin Brust 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 b= e > > pretty surprising for users if we rebind `C-y' in this way. > > Seconded. I think a whitespace-fixing yank command could be useful in > more situations than just ERC; OTOH I'd much rather keep C-y as a > "reliably dumb" yank in all contexts, at least by default. > I mean, diversity, right :) This hasn't come up for me outside IRC/ERC, that I can recall, but it definitely does makes sense to me that people would want an easy way to strip new-lines when yanking in contexts out-side IRC. Any thoughts as to the approach for this? The first thing that occurs would be to have an additional var akin to `yank-handled-properties' and `yank-excluded-properties', perhaps `yank-unfilled'. This would change the behavior of `yank' when bound to a non-nil value. I guess we'd want a new function wrapping `yank' with the new var lexically bound to t. As for a default binding for this, I note that M-y doesn't seem to do anything helpful when not proceeded by a C-y. Maybe more special case logic there? That said, I opened this bug with the goal of making it realy easy to avoid accidental muli-line spaces when pasting into ERC. To double confirm, both of you are saying that it is a frequent use-case that you want to yank content including new-lines into erc-mode buffers? I'd really like to see something like a defcustom that can make the default behavior of C-y for ERC buffers less IRC surly. IMHO, making this default to t is more newbie friendly, while those who have a use-case for multi-line paste directly into ERC seem more likely to be those who will know how to set the var. (defcustom erc-yank-unfilled t "When non-nill, ERC unfills before inserting from the kill-ring.") (defun erc-yank (..) .. (let ((yank-unfilled erc-yank-unfilled)) .. )) Couple additional notes: - I need to respin this to use [rebind] (thanks to wgreenhouse from #erc) - I haven't written anything for News, which I suspect anything we would decide on will end-up reaching Thanks much, Corwin