From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Thuna Newsgroups: gmane.emacs.devel Subject: Re: [Patch] rcirc-color: Allow recoloring nicks Date: Thu, 29 Sep 2022 14:14:34 +0200 Message-ID: <87sfkawf6d.fsf@gmail.com> References: <87wn9ntdi6.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12757"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Sep 29 17:56:29 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1odvtk-000349-0V for ged-emacs-devel@m.gmane-mx.org; Thu, 29 Sep 2022 17:56:28 +0200 Original-Received: from localhost ([::1]:44868 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odvth-0006Vt-Ks for ged-emacs-devel@m.gmane-mx.org; Thu, 29 Sep 2022 11:56:26 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56082) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odsRC-0007oo-Ix for emacs-devel@gnu.org; Thu, 29 Sep 2022 08:14:52 -0400 Original-Received: from mail-ej1-x629.google.com ([2a00:1450:4864:20::629]:42546) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1odsRA-00076o-TA for emacs-devel@gnu.org; Thu, 29 Sep 2022 08:14:46 -0400 Original-Received: by mail-ej1-x629.google.com with SMTP id sb3so2365787ejb.9 for ; Thu, 29 Sep 2022 05:14:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:to:from :from:to:cc:subject:date:message-id:reply-to; bh=QgrhivA92Bp4nY996U/A+wWpFZWQc38gUKsx0cefB2I=; b=K6uKQzEQYfINDaNDda6OV0wus2Hgc6i8h47HsC2vOwW0mXIn/+oLs1+lQE3JKHPotT kJZIx27DzE1E9i0v47v43Lz1QTNHCwUDeRsv9FMm34Xcl86eqWBw08ruWQ7yDcIbHeQr F3rxYil6en0cwfC0iOTRajqQrTArrsdHaWgNAntFuoj/LWh1xobqBYfrRg/Ob7MKgnzX 3l+iGaUYCRolz7Zfk+9/GOjc8AgSjo93s0Eyk3rTgfW4+AUujHqaqEayyk0bV8m1SnnT /HjAtMcMOeinm5a1kYPEidF4L1uqBusK568DyFqk+5a31lMv2y7qhX7ZO1RXzagAXYBM T0RQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=QgrhivA92Bp4nY996U/A+wWpFZWQc38gUKsx0cefB2I=; b=HyrGh73bdvfT6/+QyjtdReC2Q3WIt7WDYX22P2I60NEA0t6KYymDKP+dgCfBAjN77N ivTo6rfazUZDfCZ4PEok4UME1QiQyLOQh4UvI4fz7sv3RXR1oiqiQSYD+OfqEBdHl4a2 OQr6TJ7xhEXAqXCh/cQgGV8PdgRuCOCrl4uFS4U8l1LRZAEsfJhKFrMkxs04xqxgnx9A wCawG3KytJMTwQgApPf+wT2Y4aWR20I8fahd0AhsE0AYFWm0vvwZwI9E06peY3W1S09N SXbPi9Xr0Jn7BVfArlIGkKBmdhOXT9YriybbKKiH2Fesirtq8eXXsqZthntc41xmI9MM YmUw== X-Gm-Message-State: ACrzQf10exdlNAtHSRSGTsg4wRDuWkNW4ouq69ua9MtcDbVbfSD8/wEL 3YqFsCMBULzd/Vhsff5ImT1ig+d0egk= X-Google-Smtp-Source: AMsMyM7UtAH3ypc9cth39UJCu4Gc320D5qLzmnHQsp8BkDDCwkkK6yHv7mDjHa1RcmiHPRuuublCSw== X-Received: by 2002:a17:906:5d04:b0:722:f46c:b891 with SMTP id g4-20020a1709065d0400b00722f46cb891mr2566064ejt.4.1664453675954; Thu, 29 Sep 2022 05:14:35 -0700 (PDT) Original-Received: from thuna ([193.205.24.159]) by smtp.gmail.com with ESMTPSA id x2-20020a1709060ee200b0073dde62713asm3908768eji.89.2022.09.29.05.14.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Sep 2022 05:14:35 -0700 (PDT) In-Reply-To: <87wn9ntdi6.fsf@gmail.com> Received-SPF: pass client-ip=2a00:1450:4864:20::629; envelope-from=thuna.cing@gmail.com; helo=mail-ej1-x629.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Thu, 29 Sep 2022 11:53:29 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:296465 Archived-At: --=-=-= Content-Type: text/plain > I haven't tested the patch, but I can't see why it would fail. Alright, it did in fact fail. Here's the (hopefully) correct patch. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-rcirc-color-Select-a-random-color-on-color-nick.patch Content-Description: The *actual* patch >From 4462df8aa6c0f9986629d5fab7df43e502552ba3 Mon Sep 17 00:00:00 2001 From: Thuna 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))) (advice-add 'rcirc-handler-NICK :before #'rcirc-color--handler-NICK) (defun rcirc-color--handler-NICK (_process sender args _text) -- 2.35.1 --=-=-=--