unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Corwin Brust <corwin@bru.st>
To: Noam Postavsky <npostavs@gmail.com>
Cc: 43847@debbugs.gnu.org
Subject: bug#43847: ERC - prevent yanking multiple lines into IRC (feature request) *patch*
Date: Wed, 7 Oct 2020 10:30:47 -0500	[thread overview]
Message-ID: <CAJf-WoRXFFBXA-mkGcv_-W6g2j3qt6fqS4YD20b8zwfmPuAR5Q@mail.gmail.com> (raw)
In-Reply-To: <85mu0yxdil.fsf@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 259 bytes --]

Goldarn.

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

Thanks so much Noam.

Corwin

[-- Attachment #2: erc-yank.patch --]
[-- Type: application/octet-stream, Size: 1237 bytes --]

diff -u "c:/emacs/share/emacs/27.1/lisp/erc/erc.el-27.1" "c:/emacs/share/emacs/27.1/lisp/erc/erc.el"
--- c:/emacs/share/emacs/27.1/lisp/erc/erc.el-27.1	2020-10-07 08:10:35.000000000 -0500
+++ c:/emacs/share/emacs/27.1/lisp/erc/erc.el	2020-10-07 08:19:36.205700600 -0500
@@ -1154,6 +1154,7 @@
     (define-key map "\C-m" 'erc-send-current-line)
     (define-key map "\C-a" 'erc-bol)
     (define-key map [home] 'erc-bol)
+    (define-key map "\C-y" 'erc-yank)
     (define-key map "\C-c\C-a" 'erc-bol)
     (define-key map "\C-c\C-b" 'erc-switch-to-buffer)
     (define-key map "\C-c\C-c" 'erc-toggle-interpret-controls)
@@ -4084,6 +4085,19 @@
         (setq erc-input-ring-index nil))
     (kill-line)))
 
+(defun erc-yank (&optional arg)
+  "Unfill then yank.  ARG is handled by `yank', which see."
+  (interactive)
+  (insert
+   (save-excursion
+     (with-temp-buffer
+       (yank arg)
+       (goto-char (point-min))
+       (let ((fill-column (point-max))
+	     (emacs-lisp-docstring-fill-column t))
+	 (fill-paragraph))
+       (buffer-string)))))
+
 (defun erc-complete-word-at-point ()
   (run-hook-with-args-until-success 'erc-complete-functions))
 

Diff finished.  Wed Oct  7 08:20:01 2020

  reply	other threads:[~2020-10-07 15:30 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-07 14:11 bug#43847: ERC - prevent yanking multiple lines into IRC (feature request) *patch* Corwin Brust
2020-10-07 15:27 ` Noam Postavsky
2020-10-07 15:30   ` Corwin Brust [this message]
2020-10-07 16:05     ` Noam Postavsky
2020-10-09  2:01       ` Corwin Brust
2020-10-10  5:00         ` Corwin Brust
2020-10-07 16:56 ` Brett Gilio
2020-10-09  1:32   ` Corwin Brust
2020-10-09  1:59     ` Corwin Brust
2020-10-09 14:32     ` Brett Gilio
2020-10-09  4:54 ` Lars Ingebrigtsen
2020-10-09  7:52   ` Kévin Le Gouguec
2020-10-09 15:41     ` Corwin Brust
2020-10-09 16:00       ` Brett Gilio
2020-10-10 20:11         ` Lars Ingebrigtsen
2020-10-10 20:22           ` Brett Gilio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJf-WoRXFFBXA-mkGcv_-W6g2j3qt6fqS4YD20b8zwfmPuAR5Q@mail.gmail.com \
    --to=corwin@bru.st \
    --cc=43847@debbugs.gnu.org \
    --cc=npostavs@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).