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: [Patch] rcirc-color: Allow recoloring nicks Date: Wed, 28 Sep 2022 23:06:41 +0200 Message-ID: <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="30307"; 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 07:38:42 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 1odmFu-0007jL-Ao for ged-emacs-devel@m.gmane-mx.org; Thu, 29 Sep 2022 07:38:42 +0200 Original-Received: from localhost ([::1]:45774 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odmFt-0001mn-5w for ged-emacs-devel@m.gmane-mx.org; Thu, 29 Sep 2022 01:38:41 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34112) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odeGX-0000LS-H4 for emacs-devel@gnu.org; Wed, 28 Sep 2022 17:06:49 -0400 Original-Received: from mail-ej1-x632.google.com ([2a00:1450:4864:20::632]:46661) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1odeGV-0004YR-B2 for emacs-devel@gnu.org; Wed, 28 Sep 2022 17:06:48 -0400 Original-Received: by mail-ej1-x632.google.com with SMTP id bj12so29600910ejb.13 for ; Wed, 28 Sep 2022 14:06:45 -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; bh=pdAOLIc+jU7b+YnHABPYgUcvox3KDY3XN5nPaIm3bRU=; b=p86VzfhSQHBlAKDlyZJGeQi6a0M6Mpp9v8T1+CG/io39VBZOpm0bqXHlOf8UDRdw/L th/FDX/kxIlocjfIxwTFtXHLqquu9+i4xi6Nv4PYibQWnFvTTNKS3mBx+Snrqtp3xSmI GHOvUyyJfY+I5f/vJquTQrAS3szVWubZcom5PEM2wMUWsWJJJ+Z+E7Fx/HrKbgaJC0Nb TtZFXcpo1k1rPTfk7GTNMRyhjU2lLfyoX9RJ1y/EIBQB9gR5VngN4m9W+HekrSZQS2iC r0dS17PIN1sJcJOkCV/UD3UX687kenZxjUY0vnw2UE6jCqIdyNuFEn9T/P3Sy7Gi2R7l URpA== 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; bh=pdAOLIc+jU7b+YnHABPYgUcvox3KDY3XN5nPaIm3bRU=; b=ceqmR+KNU5wiJ3EmDzK1zZynvM2GOlLBd6OLCETPQnNb1+uH3M6JENc1W1UfVWDKwu ffCCRY1I+4n5w8xcRJWXwTJoF4ELKVqZRbydTiu2MPlmzfGk1cQaRUeE+rRuhXm1taoP mHRqOz2EmkfQA761iBKfEiq7Ewc92QF8wDOXFJZS4y+D33CRDTZsrJH9Xzp6K6XQbxFZ GCAojKzhj7KuS05fEtVLS9Xs7vN0zLub6uCnyJdQUdZc1U9hIc8sBiDxYEZmFC+HU4T6 X5nYIEaAj/sEgD/C9vpLvb872tJPHTTAfGHUm9Y6rhEBw61hOp0KAAJzD4gkyhxmg8OX ljVA== X-Gm-Message-State: ACrzQf1vdKbNVjzDaSdKO6DspFbei0jG75AB1+aP9TUVu9tzu4KQnQLD WM3u9YEBiXLlSXIy2YrIi2yfkGkFbhw= X-Google-Smtp-Source: AMsMyM40eu/d+Pf9N1DzlzK2eu8k++cF7MMCjRABH6UaKX4wsjs9gCSeje/mtt/ujSx2TLsAJNe3Lg== X-Received: by 2002:a17:907:7ea1:b0:782:8016:f67b with SMTP id qb33-20020a1709077ea100b007828016f67bmr27096625ejc.188.1664399203669; Wed, 28 Sep 2022 14:06:43 -0700 (PDT) Original-Received: from thuna (eduroam-200.unibocconi.it. [90.147.70.200]) by smtp.gmail.com with ESMTPSA id s10-20020aa7c54a000000b0045723aa48ccsm4046950edr.93.2022.09.28.14.06.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Sep 2022 14:06:43 -0700 (PDT) Received-SPF: pass client-ip=2a00:1450:4864:20::632; envelope-from=thuna.cing@gmail.com; helo=mail-ej1-x632.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 01:33:50 -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:296442 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. I haven't tested the patch, but I can't see why it would fail. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-rcirc-color-Select-a-random-color-on-color-nick.patch Content-Description: The patch >From 8bd21515f31a5e3cfedce623d8ebc9907b82b2a5 Mon Sep 17 00:00:00 2001 From: Thuna Date: Wed, 28 Sep 2022 22:58:00 +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 | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/rcirc-color.el b/rcirc-color.el index 872d1d8298..0f6f2adea9 100644 --- a/rcirc-color.el +++ b/rcirc-color.el @@ -136,7 +136,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." @@ -151,9 +153,11 @@ 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 + (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 --=-=-=--