GNU bug report logs -
#58165
[Patch] [GNU ELPA] rcirc-color: Allow recoloring nicks
Previous Next
Reported by: Thuna <thuna.cing <at> gmail.com>
Date: Thu, 29 Sep 2022 14:59:02 UTC
Severity: normal
Tags: patch
Done: Philip Kaludercic <philipk <at> posteo.net>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 58165 in the body.
You can then email your comments to 58165 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#58165
; Package
emacs
.
(Thu, 29 Sep 2022 14:59:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Thuna <thuna.cing <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Thu, 29 Sep 2022 14:59:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
I think rcirc-color should allow a nick to be "recolored" with the
command `/color nick', instead of signalling an error as it does now.
This is useful, for example, when two similar nicks are assigned the
same color but there's no specific color you want to reassign to either
of them.
[0001-rcirc-color-Select-a-random-color-on-color-nick.patch (text/x-patch, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#58165
; Package
emacs
.
(Thu, 29 Sep 2022 21:03:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 58165 <at> debbugs.gnu.org (full text, mbox):
Thuna <thuna.cing <at> gmail.com> writes:
> I think rcirc-color should allow a nick to be "recolored" with the
> command `/color nick', instead of signalling an error as it does now.
>
> This is useful, for example, when two similar nicks are assigned the
> same color but there's no specific color you want to reassign to either
> of them.
>
>>From 4462df8aa6c0f9986629d5fab7df43e502552ba3 Mon Sep 17 00:00:00 2001
> From: Thuna <thuna.cing <at> gmail.com>
> Date: Thu, 29 Sep 2022 14:12:20 +0200
> Subject: [PATCH] rcirc-color: Select a random color on `/color nick'
>
> * rcirc-color.el: When `/color' is called with a nick but no color,
> choose a random color from `rcirc-colors' instead of signalling an
> error.
> ---
> rcirc-color.el | 13 +++++++++----
> 1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/rcirc-color.el b/rcirc-color.el
> index 2eff965267..7bcc46c91d 100644
> --- a/rcirc-color.el
> +++ b/rcirc-color.el
> @@ -134,7 +134,9 @@ NICK is the nick for which the new color ist set; if nil, all the
> nicks in `rcirc-color-mapping' are shown with their corresponding
> faces.
>
> -COLOR is the color to use as the new foreground-color.
> +COLOR is the color to use as the new foreground-color. If COLOR
> +is not supplied, a random color from `rcirc-colors' is used
> +instead.
>
> PROCESS and TARGET are the standard arguments for rcirc
> commands."
> @@ -149,9 +151,12 @@ commands."
> rcirc-color-mapping)
> (rcirc-print process (rcirc-nick process) "NOTICE" target
> (mapconcat 'identity names " ")))
> - (unless color
> - (error "Use what color?"))
> - (puthash nick (cons 'foreground-color color) rcirc-color-mapping)))
> + (puthash nick
> + (cons 'foreground-color
> + (or color
> + (elt rcirc-colors
> + (random (length rcirc-colors)))))
> + rcirc-color-mapping)))
While at it one could replace the `foreground-color', since (elisp)
Special Properties says:
• A cons cell of the form ‘(foreground-color . COLOR-NAME)’ or
‘(background-color . COLOR-NAME)’. This specifies the
foreground or background color, similar to ‘(:foreground
COLOR-NAME)’ or ‘(:background COLOR-NAME)’. This form is
supported for backward compatibility only, and should be
avoided.
Also, it would be nice to also reformat the code using a let* block.
Something like
(let* ((index (random (length rcirc-colors)))
(color (elt rcirc-colors index))
(face (cons 'foreground-color color)))
(puthash nick face rcirc-color-mapping))
> (advice-add 'rcirc-handler-NICK :before #'rcirc-color--handler-NICK)
> (defun rcirc-color--handler-NICK (_process sender args _text)
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#58165
; Package
emacs
.
(Fri, 30 Sep 2022 00:31:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 58165 <at> debbugs.gnu.org (full text, mbox):
> While at it one could replace the `foreground-color', since (elisp)
> Special Properties says:
>
> • A cons cell of the form ‘(foreground-color . COLOR-NAME)’ or
> ‘(background-color . COLOR-NAME)’. This specifies the
> foreground or background color, similar to ‘(:foreground
> COLOR-NAME)’ or ‘(:background COLOR-NAME)’. This form is
> supported for backward compatibility only, and should be
> avoided.
I avoided it on the off chance something would break, but I don't mind
either way.
> Also, it would be nice to also reformat the code using a let* block.
> Something like
>
> (let* ((index (random (length rcirc-colors)))
> (color (elt rcirc-colors index))
> (face (cons 'foreground-color color)))
> (puthash nick face rcirc-color-mapping))
Seems ok to me.
Reply sent
to
Philip Kaludercic <philipk <at> posteo.net>
:
You have taken responsibility.
(Fri, 30 Sep 2022 11:25:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Thuna <thuna.cing <at> gmail.com>
:
bug acknowledged by developer.
(Fri, 30 Sep 2022 11:25:02 GMT)
Full text and
rfc822 format available.
Message #16 received at 58165-done <at> debbugs.gnu.org (full text, mbox):
Thuna <thuna.cing <at> gmail.com> writes:
>> While at it one could replace the `foreground-color', since (elisp)
>> Special Properties says:
>>
>> • A cons cell of the form ‘(foreground-color . COLOR-NAME)’ or
>> ‘(background-color . COLOR-NAME)’. This specifies the
>> foreground or background color, similar to ‘(:foreground
>> COLOR-NAME)’ or ‘(:background COLOR-NAME)’. This form is
>> supported for backward compatibility only, and should be
>> avoided.
>
> I avoided it on the off chance something would break, but I don't mind
> either way.
I think I can do this.
>> Also, it would be nice to also reformat the code using a let* block.
>> Something like
>>
>> (let* ((index (random (length rcirc-colors)))
>> (color (elt rcirc-colors index))
>> (face (cons 'foreground-color color)))
>> (puthash nick face rcirc-color-mapping))
>
> Seems ok to me.
I'll pull your patch and make this change in a subsequent commit.
So thank you for the patch.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sat, 29 Oct 2022 11:24:07 GMT)
Full text and
rfc822 format available.
This bug report was last modified 2 years and 265 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.