Subject: bug#43847: ERC - prevent yanking multiple lines into IRC (feature request) *patch*

From: Corwin Brust <[email-masked]>
Date: Thu, 8 Oct 2020 21:01:19 -0500

Many thanks, Noam.

On Wed, Oct 7, 2020 at 11:05 AM Noam Postavsky <[email-masked]> 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