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: Thu, 8 Oct 2020 21:01:19 -0500 [thread overview]
Message-ID: <CAJf-WoQqPZaWGtzUhLKWG0p=Hz1VfO8jRUwh+87G-tcFe3zRKg@mail.gmail.com> (raw)
In-Reply-To: <85k0w2xbrm.fsf@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1847 bytes --]
Many thanks, Noam.
On Wed, Oct 7, 2020 at 11:05 AM Noam Postavsky <npostavs@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
[-- Attachment #2: erc-yank_002_rm_save-excusrion-and-elsip-docstring-col.patch --]
[-- Type: application/octet-stream, Size: 1144 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-08 20:42:26.207684100 -0500
@@ -1155,6 +1155,7 @@
(define-key map "\C-a" 'erc-bol)
(define-key map [home] 'erc-bol)
(define-key map "\C-c\C-a" 'erc-bol)
+ (define-key map "\C-y" 'erc-yank)
(define-key map "\C-c\C-b" 'erc-switch-to-buffer)
(define-key map "\C-c\C-c" 'erc-toggle-interpret-controls)
(define-key map "\C-c\C-d" 'erc-input-action)
@@ -4084,6 +4085,16 @@
(setq erc-input-ring-index nil))
(kill-line)))
+(defun erc-yank (&optional arg)
+ "Unfill then yank. ARG is handled by `yank', which see."
+ (interactive)
+ (with-temp-buffer
+ (yank arg)
+ (goto-char (point-min))
+ (let ((fix-column (point-max)))
+ (fill-paragraph))
+ (buffer-string)))
+
(defun erc-complete-word-at-point ()
(run-hook-with-args-until-success 'erc-complete-functions))
Diff finished. Thu Oct 8 20:43:11 2020
next prev parent reply other threads:[~2020-10-09 2:01 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
2020-10-07 16:05 ` Noam Postavsky
2020-10-09 2:01 ` Corwin Brust [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAJf-WoQqPZaWGtzUhLKWG0p=Hz1VfO8jRUwh+87G-tcFe3zRKg@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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.