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.bugs Subject: bug#58165: [Patch] [GNU ELPA] rcirc-color: Allow recoloring nicks Date: Thu, 29 Sep 2022 16:58:21 +0200 Message-ID: <87mtaiw7le.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="21413"; mail-complaints-to="usenet@ciao.gmane.io" To: 58165@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Sep 29 17:29:27 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1odvTY-0005M3-FN for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 29 Sep 2022 17:29:24 +0200 Original-Received: from localhost ([::1]:52930 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odvTX-0007IB-Ew for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 29 Sep 2022 11:29:23 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43716) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odv0C-00081k-5G for bug-gnu-emacs@gnu.org; Thu, 29 Sep 2022 10:59:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:40197) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1odv0A-0001cz-QR for bug-gnu-emacs@gnu.org; Thu, 29 Sep 2022 10:59:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1odv0A-0007tm-Ks for bug-gnu-emacs@gnu.org; Thu, 29 Sep 2022 10:59:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Thuna Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 29 Sep 2022 14:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 58165 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.166446351830327 (code B ref -1); Thu, 29 Sep 2022 14:59:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 29 Sep 2022 14:58:38 +0000 Original-Received: from localhost ([127.0.0.1]:39275 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oduzm-0007t5-GD for submit@debbugs.gnu.org; Thu, 29 Sep 2022 10:58:38 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:46354) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oduzk-0007sx-O0 for submit@debbugs.gnu.org; Thu, 29 Sep 2022 10:58:37 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57170) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oduzc-0007P1-6S for bug-gnu-emacs@gnu.org; Thu, 29 Sep 2022 10:58:28 -0400 Original-Received: from mail-ej1-x631.google.com ([2a00:1450:4864:20::631]:40515) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oduza-0001ai-2F for bug-gnu-emacs@gnu.org; Thu, 29 Sep 2022 10:58:27 -0400 Original-Received: by mail-ej1-x631.google.com with SMTP id l14so3340877eja.7 for ; Thu, 29 Sep 2022 07:58:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:message-id:date:subject:to:from:from:to:cc:subject :date:message-id:reply-to; bh=qGH8LvobEWiXbU3fit5nt1tu4n2LYey5CyOxgPCF9bU=; b=W+AFTEtwvajSjR/iZvhmhnEnEuBCuMWoPDvSCrKG3VmoK5e3i8tnV1zN19hbep5S3I dh6eRiPC8d88KMG6Tj0yG6cDuMVDDHaqTn3Vu+OEucV5ssT7/cH8FJAnPGeKith0gXzV 4dWLfRxt2H2yBm5vbI8DbViuSmx1nnD3tcFLxPrx4e5oFXYePbRQMLiQ+kfw/ZuV0vWz jtSoKYzrBB740uyYDYkSkdRgwkwD+JgInSnZ6GVulZXsrGYML3PiaYCyxFXqGVs9HjWI GExXfHRcxkYy7pMXziFOxKdUBvqXBd0u0Yz5YWYMgB+Ketm86xNfxhBSfcAEipYxyr48 IcQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:subject:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=qGH8LvobEWiXbU3fit5nt1tu4n2LYey5CyOxgPCF9bU=; b=taoyfTtwoFky2jHCDb8v2KmQjwF+E56m1Ol8MilDnR8R8lNOaZBcSFgpgIjr5NYP42 E5fc0Iq5rofFN86gGhDYjDNT9gAcqKx4Ly3mJljbVtAs3+qhk8xTAz5mUUURhfsAhapy Cab3hHnEvLwiadxHuK5mzM4Xq5CudTQyNWYG6Qn5hgz0WfPZ4HOFmliyQ+VoRD/5Ior2 zm9gwL5LBL4K3aoN9utMBOIhM8VkRLDLHgkyacFLXlt0Lndal1tWDLNwdfIA0obLPEV4 A0DI/5A7YuAryqOtECACmSGz83LYhBDorGldeCCJ2K/1T2TkbKJt81+ZK0d688JyzI51 M+eQ== X-Gm-Message-State: ACrzQf1M1ru+M756T4z2QFeZGvKH/f57oV3qGJm2WsF8Q+rVlMn5PCXk N/sgmDHMQR5yJWsUVpWt5Cxl9vy2ANM= X-Google-Smtp-Source: AMsMyM5GMX9169lk/tJl20T5642hvq5O+O15bPMtncYC8iP21fl/SPgORhu+qhAUwAFGuRlzTWwHbw== X-Received: by 2002:a17:906:8b81:b0:77e:cd92:9d with SMTP id nr1-20020a1709068b8100b0077ecd92009dmr3030950ejc.484.1664463503303; Thu, 29 Sep 2022 07:58:23 -0700 (PDT) Original-Received: from thuna ([193.205.24.159]) by smtp.gmail.com with ESMTPSA id ez23-20020a1709070bd700b00780a26edfcesm4048971ejc.60.2022.09.29.07.58.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Sep 2022 07:58:22 -0700 (PDT) Received-SPF: pass client-ip=2a00:1450:4864:20::631; envelope-from=thuna.cing@gmail.com; helo=mail-ej1-x631.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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:243910 Archived-At: --=-=-= Content-Type: text/plain 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. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-rcirc-color-Select-a-random-color-on-color-nick.patch Content-Description: The 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 --=-=-=--