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

To reply to this bug, email your comments to 43847 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#43847; Package emacs. (Wed, 07 Oct 2020 14:13:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Corwin Brust <corwin <at> bru.st>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 07 Oct 2020 14:13:02 GMT) Full text and rfc822 format available.

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

From: Corwin Brust <corwin <at> bru.st>
To: bug-gnu-emacs <at> gnu.org
Subject: ERC - prevent yanking multiple lines into IRC (feature request)
 *patch*
Date: Wed, 7 Oct 2020 09:11:48 -0500
I hate it when I accidentally paste multi-line text into ERC.  I
*never* actually intend to do this.

This patch provides erc-yank and binds it to C-y for erc-mode buffers.
This does the same as `yank'; however, the text is unfilled (collapsed
to a single line) before it is inserted.

It might make sense to have a defcustom to get back the old behavior
but I haven't included that.  This is my second attempt at sharing a
patch for Emacs; I sent one about an hour ago.  I believe, taking both
patches together, I should be pretty close to the max for tiny-change.
I've started the copyright assignment process.

All feedback gratefully received :)


In GNU Emacs 27.1 (build 1, x86_64-w64-mingw32)
 of 2020-08-21 built on CIRROCUMULUS
Repository revision: 86d8d76aa36037184db0b2897c434cdaab1a9ae8
Repository branch: HEAD
Windowing system distributor 'Microsoft Corp.', version 10.0.18363
System Description: Microsoft Windows 10 Home (v10.0.1909.18363.1082)

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.

Configured using:
 'configure --without-dbus --host=x86_64-w64-mingw32
 --without-compress-install 'CFLAGS=-O2 -static''

Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND NOTIFY W32NOTIFY ACL GNUTLS LIBXML2
HARFBUZZ ZLIB TOOLKIT_SCROLL_BARS MODULES THREADS JSON PDUMPER LCMS2 GMP

Important settings:
  value of $LANG: ENU
  locale-coding-system: cp1252

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
format-spec rfc822 mml easymenu mml-sec password-cache epa derived epg
epg-config gnus-util rmail rmail-loaddefs text-property-search time-date
subr-x seq byte-opt gv bytecomp byte-compile cconv mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs
cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel dos-w32 ls-lisp disp-table term/w32-win w32-win w32-vars
term/common-win tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite charscript charprop case-table epa-hook
jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote threads w32notify w32 lcms2 multi-tty make-network-process
emacs)

Memory information:
((conses 16 46659 8583)
 (symbols 48 6075 1)
 (strings 32 16982 2021)
 (string-bytes 1 519943)
 (vectors 16 9274)
 (vector-slots 8 123598 13156)
 (floats 8 22 312)
 (intervals 56 222 0)
 (buffers 1000 12))

Corwin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43847; Package emacs. (Wed, 07 Oct 2020 15:28:02 GMT) Full text and rfc822 format available.

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

From: Noam Postavsky <npostavs <at> gmail.com>
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: Wed, 07 Oct 2020 11:27:14 -0400
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.
>
> This patch provides erc-yank and binds it to C-y for erc-mode buffers.
> This does the same as `yank'; however, the text is unfilled (collapsed
> to a single line) before it is inserted.

> All feedback gratefully received :)

I think you may have forgotten to include the patch :)





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43847; Package emacs. (Wed, 07 Oct 2020 15:32:01 GMT) Full text and rfc822 format available.

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

From: Corwin Brust <corwin <at> bru.st>
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: 43847 <at> debbugs.gnu.org
Subject: Re: bug#43847: ERC - prevent yanking multiple lines into IRC (feature
 request) *patch*
Date: Wed, 7 Oct 2020 10:30:47 -0500
[Message part 1 (text/plain, inline)]
Goldarn.

On Wed, Oct 7, 2020 at 10:27 AM Noam Postavsky <npostavs <at> gmail.com> wrote:
>
> Corwin Brust <corwin <at> bru.st> writes:
>
> > All feedback gratefully received :)
>
> I think you may have forgotten to include the patch :)
>

Thanks so much Noam.

Corwin
[erc-yank.patch (application/octet-stream, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43847; Package emacs. (Wed, 07 Oct 2020 16:06:02 GMT) Full text and rfc822 format available.

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

From: Noam Postavsky <npostavs <at> gmail.com>
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: Wed, 07 Oct 2020 12:05:01 -0400
I hope an ERC user will follow up (I think Bandali was going over ERC
patches at some point?), but just some general comments:

> diff -u "c:/emacs/share/emacs/27.1/lisp/erc/erc.el-27.1" "c:/emacs/share/emacs/27.1/lisp/erc/erc.el"

> +(defun erc-yank (&optional arg)
> +  "Unfill then yank.  ARG is handled by `yank', which see."
> +  (interactive)
> +  (insert
> +   (save-excursion

I believe the save-excursion is redundant since all the movement happens
inside a temp buffer.

> +     (with-temp-buffer
> +       (yank arg)
> +       (goto-char (point-min))
> +       (let ((fill-column (point-max))
> +	     (emacs-lisp-docstring-fill-column t))

I don't think binding emacs-lisp-docstring-fill-column should be needed?

> +	 (fill-paragraph))

The TAB character should be spaces instead.  I recommend (setq-default
indent-tabs-mode nil), or at least

    (defun my-lisp-mode-hook ()
      (setq-local indent-tabs-mode nil))
    (add-hook 'emacs-lisp-mode-hook #'my-lisp-mode-hook)

Note that if you edit the git repo, it comes with an indent-tabs-mode=nil
setting for emacs-lisp-mode in .dir-locals.el.

> +       (buffer-string)))))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43847; Package emacs. (Wed, 07 Oct 2020 16:57:02 GMT) Full text and rfc822 format available.

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

From: Brett Gilio <brettg <at> gnu.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: Wed, 07 Oct 2020 11:56:02 -0500
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.
>
> This patch provides erc-yank and binds it to C-y for erc-mode buffers.
> This does the same as `yank'; however, the text is unfilled (collapsed
> to a single line) before it is inserted.
>
> It might make sense to have a defcustom to get back the old behavior
> but I haven't included that.  This is my second attempt at sharing a
> patch for Emacs; I sent one about an hour ago.  I believe, taking both
> patches together, I should be pretty close to the max for tiny-change.
> I've started the copyright assignment process.
>
> All feedback gratefully received :)
>

A possible alternative behavior could be somewhat similar to what CIRCE
does, but may be more intensive to implement. CIRCE, when pasting
multiline content offers to send the content to a paste-service, and
then kills the URL to the buffer and sends that instead.

What if we had a paste.emacs.org that ERC could utilize here?

Just a thought.

Brett Gilio




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43847; Package emacs. (Fri, 09 Oct 2020 01:34:01 GMT) Full text and rfc822 format available.

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

From: Corwin Brust <corwin <at> bru.st>
To: Brett Gilio <brettg <at> gnu.org>
Cc: 43847 <at> debbugs.gnu.org
Subject: Re: bug#43847: ERC - prevent yanking multiple lines into IRC (feature
 request) *patch*
Date: Thu, 8 Oct 2020 20:32:54 -0500
Hi Brett!  Thanks so much for the reply!

On Wed, Oct 7, 2020 at 11:56 AM Brett Gilio <brettg <at> gnu.org> wrote:
>
> 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.
> >
> > This patch provides erc-yank and binds it to C-y for erc-mode buffers.
> > This does the same as `yank'; however, the text is unfilled (collapsed
> > to a single line) before it is inserted.
> >
> > It might make sense to have a defcustom to get back the old behavior
> > but I haven't included that.  This is my second attempt at sharing a
> > patch for Emacs; I sent one about an hour ago.  I believe, taking both
> > patches together, I should be pretty close to the max for tiny-change.
> > I've started the copyright assignment process.
> >
> > All feedback gratefully received :)
> >
>
> A possible alternative behavior could be somewhat similar to what CIRCE
> does, but may be more intensive to implement. CIRCE, when pasting
> multiline content offers to send the content to a paste-service, and
> then kills the URL to the buffer and sends that instead.

This is a wonderful suggestion.  Speaking for myself, personally, I'd
like to see it as somewhat of a secondary behavior, what sending a
prefix arg does, or something.  In any case a very fine feature,
indeed.

A quick perusal of CIRCE[1] (which looks lovely), suggests the present
approach there involves having various paste-services explicitly
supported.  Perhaps this could be implemented in terms of a
def-paste-service macro, of some sort.  I would expect some amount of
discussion may be involved in selecting an initial service or services
to support, as it were, of the the box.  Maybe that conversation would
be approprite to Emacs devel, in case this feature would be
interesting to a more general cross-section of users vs ERC/IRC.

> What if we had a paste.emacs.org that ERC could utilize here?

I think that's an excellet idea in several regards.  In addition to
simplifying, potentially trivializing the decision of what service to
support, it also leads to a bunch of links getting shared around which
point into the fsfverse.  It's a tiny bit of mind-share, but I'd be
inclined to take it.  That said, having a "branded" paste-service
"baked in" to Emacs would seem to me to stengthen the argument to
formalize the interface for people to setup their own; to make ours
easy and others hard would be very off-brand.

This is something I'd be happy to work on, but I'm not how we would
approach something like requesting a http facing new service, going
forward.

> Just a thought.

As I hope I made clear, I love it.

I'm tempted tho, to suggest we might move forward with my more trival
suggested change in the mean-time.

It seems like having something special at C-y in `erc-mode' is
probably on the road-map for any of this, and may make live easier for
ERC users somewhat more quickly than some of the other ideas discussed
so far can move.

>
> Brett Gilio


Regards,
Corwin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43847; Package emacs. (Fri, 09 Oct 2020 02:01:02 GMT) Full text and rfc822 format available.

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

From: Corwin Brust <corwin <at> bru.st>
To: Brett Gilio <brettg <at> gnu.org>
Cc: 43847 <at> debbugs.gnu.org
Subject: Re: bug#43847: ERC - prevent yanking multiple lines into IRC (feature
 request) *patch*
Date: Thu, 8 Oct 2020 20:59:49 -0500
Hi again.

On Thu, Oct 8, 2020 at 8:32 PM Corwin Brust <corwin <at> bru.st> wrote:
>

>
> A quick perusal of CIRCE[1] (which looks lovely), suggests the present

I see that I forgot the link for the source I looked at.  Here it is:

[1] https://github.com/jorgenschaefer/circe/blob/master/lui-autopaste.el

Corwin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43847; Package emacs. (Fri, 09 Oct 2020 02:02:01 GMT) Full text and rfc822 format available.

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

From: Corwin Brust <corwin <at> bru.st>
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: 43847 <at> debbugs.gnu.org
Subject: Re: bug#43847: ERC - prevent yanking multiple lines into IRC (feature
 request) *patch*
Date: Thu, 8 Oct 2020 21:01:19 -0500
[Message part 1 (text/plain, inline)]
Many thanks, Noam.

On Wed, Oct 7, 2020 at 11:05 AM Noam Postavsky <npostavs <at> gmail.com> wrote:
>
> I hope an ERC user will follow up (I think Bandali was going over ERC
> patches at some point?), but just some general comments:

I'm hoping Bandali and other ERC users will look, also.  I spoke to
someone on ERC today who is using the (prior version), I believe and
has agreed to mention any issues or suggestions.  (They agreed with
you about e-l-d-f-c being irrelevant, which seems pretty darned
obvious to me now too.)

> > diff -u "c:/emacs/share/emacs/27.1/lisp/erc/erc.el-27.1" "c:/emacs/share/emacs/27.1/lisp/erc/erc.el"
>
> > +(defun erc-yank (&optional arg)
> > +  "Unfill then yank.  ARG is handled by `yank', which see."
> > +  (interactive)
> > +  (insert
> > +   (save-excursion
>
> I believe the save-excursion is redundant since all the movement happens
> inside a temp buffer.

Removed save-excursion, thank you.

>
> > +     (with-temp-buffer
> > +       (yank arg)
> > +       (goto-char (point-min))
> > +       (let ((fill-column (point-max))
> > +          (emacs-lisp-docstring-fill-column t))
>
> I don't think binding emacs-lisp-docstring-fill-column should be needed?

*Smacking of forehead*  Right you are.


> > +      (fill-paragraph))
>
> The TAB character should be spaces instead.  I recommend (setq-default
> indent-tabs-mode nil), or at least
>
>     (defun my-lisp-mode-hook ()
>       (setq-local indent-tabs-mode nil))
>     (add-hook 'emacs-lisp-mode-hook #'my-lisp-mode-hook)
>
> Note that if you edit the git repo, it comes with an indent-tabs-mode=nil
> setting for emacs-lisp-mode in .dir-locals.el.
>
> > +       (buffer-string)))))

I'm pulling master now.  This version was created after evaling your
suggested one-liner in my erc.el buffer & please let me know if that's
got it.

Again, thanks

Corwin
[erc-yank_002_rm_save-excusrion-and-elsip-docstring-col.patch (application/octet-stream, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43847; Package emacs. (Fri, 09 Oct 2020 04:55:01 GMT) Full text and rfc822 format available.

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43847; Package emacs. (Fri, 09 Oct 2020 07:54:01 GMT) Full text and rfc822 format available.

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

From: Kévin Le Gouguec <kevin.legouguec <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#43847: ERC - prevent yanking multiple lines into IRC (feature
 request) *patch*
Date: Fri, 09 Oct 2020 09:52:53 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> 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.

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.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43847; Package emacs. (Fri, 09 Oct 2020 14:33:02 GMT) Full text and rfc822 format available.

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

From: Brett Gilio <brettg <at> gnu.org>
To: Corwin Brust <corwin <at> bru.st>, bandali <at> gnu.org
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 09:32:21 -0500
Corwin Brust <corwin <at> bru.st> writes:

>
> As I hope I made clear, I love it.
>
> I'm tempted tho, to suggest we might move forward with my more trival
> suggested change in the mean-time.
>


Understood. I think it would be a great discussion to have with the ERC
people to further compliment the proposed change for future? I cc'ed
bandali to see what they think.

Brett Gilio




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43847; Package emacs. (Fri, 09 Oct 2020 15:42:01 GMT) Full text and rfc822 format available.

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

From: Corwin Brust <corwin <at> bru.st>
To: Kévin Le Gouguec <kevin.legouguec <at> gmail.com>, 
 Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 43847 <at> debbugs.gnu.org, Amin Bandali <bandali <at> gnu.org>
Subject: Re: bug#43847: ERC - prevent yanking multiple lines into IRC (feature
 request) *patch*
Date: Fri, 9 Oct 2020 10:41:26 -0500
Hi Kévin and Lars.  CCd Amin on this one also :)

On Fri, Oct 9, 2020 at 2:54 AM Kévin Le Gouguec
<kevin.legouguec <at> gmail.com> wrote:
>
> Lars Ingebrigtsen <larsi <at> gnus.org> writes:
>
> > 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.
>
> 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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43847; Package emacs. (Fri, 09 Oct 2020 16:01:01 GMT) Full text and rfc822 format available.

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

From: Brett Gilio <brettg <at> gnu.org>
To: Corwin Brust <corwin <at> bru.st>
Cc: 43847 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi <at> gnus.org>,
 Amin Bandali <bandali <at> gnu.org>,
 Kévin Le Gouguec <kevin.legouguec <at> gmail.com>
Subject: Re: bug#43847: ERC - prevent yanking multiple lines into IRC
 (feature request) *patch*
Date: Fri, 09 Oct 2020 11:00:18 -0500
Corwin Brust <corwin <at> bru.st> writes:
> 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?
>

After giving it more thought, perhaps a prefix arg is the correct way to
go here. It would be enough that people would not experience a breaking
change. Or, it could be such that ERC alerts in the echo buffer that you
are about to send a multiline paste and ask if it should be sanitized?

Brett Gilio




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43847; Package emacs. (Sat, 10 Oct 2020 05:01:02 GMT) Full text and rfc822 format available.

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

From: Corwin Brust <corwin <at> bru.st>
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: 43847 <at> debbugs.gnu.org, Amin Bandali <bandali <at> gnu.org>
Subject: Re: bug#43847: ERC - prevent yanking multiple lines into IRC (feature
 request) *patch*
Date: Sat, 10 Oct 2020 00:00:31 -0500
If you are using this patch please ROLLBACK. 😊

On Thu, Oct 8, 2020 at 9:01 PM Corwin Brust <corwin <at> bru.st> wrote:
>
> Many thanks, Noam.
>
> On Wed, Oct 7, 2020 at 11:05 AM Noam Postavsky <npostavs <at> gmail.com> wrote:
> >
> > I hope an ERC user will follow up (I think Bandali was going over ERC
> > patches at some point?), but just some general comments:
>
> I'm hoping Bandali and other ERC users will look, also.  [...]

This has unpleasant results when the point is not immediately after
the ERC prompt, and likely in other cases I haven't found.

For a next pass I plan to:
* use `erc-display-line' instead of `insert'
* remove the new binding while we discuss ideal approaches
* create from master and see if I can I get tabs/spaces correct
* CC emacs-erc in hopes of soliciting more inputs

Thanks to Amin and others for discussions on IRC this evening.

Regards
Corwin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43847; Package emacs. (Sat, 10 Oct 2020 20:13:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Brett Gilio <brettg <at> gnu.org>
Cc: 43847 <at> debbugs.gnu.org, Corwin Brust <corwin <at> bru.st>,
 Amin Bandali <bandali <at> gnu.org>,
 Kévin Le Gouguec <kevin.legouguec <at> gmail.com>
Subject: Re: bug#43847: ERC - prevent yanking multiple lines into IRC
 (feature request) *patch*
Date: Sat, 10 Oct 2020 22:11:59 +0200
Brett Gilio <brettg <at> gnu.org> writes:

> Corwin Brust <corwin <at> bru.st> writes:
>> 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?

I think a new command, like `yank-trim-whitespace', might be nice.  I
have no idea where I'd put something like that in the global keymap,
which is why I've never proposed it...

But we could put it somewhere in the erc keymap for sure.

> After giving it more thought, perhaps a prefix arg is the correct way to
> go here. It would be enough that people would not experience a breaking
> change. Or, it could be such that ERC alerts in the echo buffer that you
> are about to send a multiline paste and ask if it should be sanitized?

That sounds nice...  doesn't erc already have an (optional) way of
warning against multi-line yanks?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43847; Package emacs. (Sat, 10 Oct 2020 20:24:02 GMT) Full text and rfc822 format available.

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

From: Brett Gilio <brettg <at> gnu.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 43847 <at> debbugs.gnu.org, Corwin Brust <corwin <at> bru.st>,
 Amin Bandali <bandali <at> gnu.org>,
 Kévin Le Gouguec <kevin.legouguec <at> gmail.com>
Subject: Re: bug#43847: ERC - prevent yanking multiple lines into IRC
 (feature request) *patch*
Date: Sat, 10 Oct 2020 15:22:55 -0500
Lars Ingebrigtsen <larsi <at> gnus.org> writes:
>
> That sounds nice...  doesn't erc already have an (optional) way of
> warning against multi-line yanks?

Perhaps that is what `erc-toggle-flood-control' is.
https://www.gnu.org/software/emacs/manual/html_mono/erc.html#Concept-Index

Brett Gilio




This bug report was last modified 3 years and 191 days ago.

Previous Next


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