From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: dalanicolai Newsgroups: gmane.emacs.bugs Subject: bug#51371: 28.0.50; [PATCH] Make list-colors-display sorting support general Date: Sun, 24 Oct 2021 15:16:12 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="00000000000003cc3c05cf190d78" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18944"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 51371@debbugs.gnu.org To: Stefan Kangas Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Oct 24 15:17:23 2021 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 1medNK-0004fY-Tl for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 24 Oct 2021 15:17:23 +0200 Original-Received: from localhost ([::1]:52058 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1medNI-0006w3-Qe for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 24 Oct 2021 09:17:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49344) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1medN1-0006vv-RA for bug-gnu-emacs@gnu.org; Sun, 24 Oct 2021 09:17:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:54859) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1medN0-0007RE-MD for bug-gnu-emacs@gnu.org; Sun, 24 Oct 2021 09:17:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1medN0-0005zP-GI for bug-gnu-emacs@gnu.org; Sun, 24 Oct 2021 09:17:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: dalanicolai Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 24 Oct 2021 13:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51371 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 51371-submit@debbugs.gnu.org id=B51371.163508139121484 (code B ref 51371); Sun, 24 Oct 2021 13:17:02 +0000 Original-Received: (at 51371) by debbugs.gnu.org; 24 Oct 2021 13:16:31 +0000 Original-Received: from localhost ([127.0.0.1]:38172 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1medMU-0005a8-Fb for submit@debbugs.gnu.org; Sun, 24 Oct 2021 09:16:30 -0400 Original-Received: from mail-ua1-f41.google.com ([209.85.222.41]:42500) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1medMS-0005UH-D0 for 51371@debbugs.gnu.org; Sun, 24 Oct 2021 09:16:28 -0400 Original-Received: by mail-ua1-f41.google.com with SMTP id b4so4624509uaq.9 for <51371@debbugs.gnu.org>; Sun, 24 Oct 2021 06:16:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=NnL2z7lw1MIM9IH8GNlkzOqXFsq0MZ/Fv9TSc5AwiNc=; b=q3XmmwPXAo0MIOSlGtHrfiVy0puK8em1ylIf+AZHi5zRntCz+VLestYZ2uAzHvuHsa UqokUFWO1MKGf59liFw0caNhlSoxU5Yed3ke1yFiZGxv8FUa39RywfvWvna4Q6pWFrD0 A94dsWCJdO2doEYnitjED1AXlKDlyAXuqE+UD20HrwY+0+mmL9JRRvMZwkFJ+toHJaeb SLNVEQgI8eKQBDNzJZSFNKrc/h36IAodWFnKkYiJZoCDTFKxcAkyy57lC56hxmiB/a7R uqbktn1x5IVE09huoNPkXSqYx1MDtZQulz9dXhRN/C3esxJqnIDoWXqMR9Ba58r3fiCU +RqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=NnL2z7lw1MIM9IH8GNlkzOqXFsq0MZ/Fv9TSc5AwiNc=; b=V01PssN0gZVXuqVnsXmGW67GzWGIpwufOWRZ/VwlPhKSCT+L9rXh6je/yfRDmC8JeA 4OqRMOax47K3Qw3DO4CgbJXCQEvDKYQ0X3sUP2ZGAvI7TvHnlaCDcdLCk/eITAeDvRuu nDp88wzMaelh2mdrVdj9G3gI5J+9xnLb9I+1BfyLiygpH0AX/MbzH+JxLF1YwhIP393A z15ICyJesGv2sSN55IR4XqhZVNSx0TGO4CAIU/n8X/T8WfeVN+LlcTB6qk1pPYxs40HS uAdzpA6U7ZNl32hzp2qG4QxTvr7J1255Ydwmvgv6C7AsVzTSOL0Mt1L07ld2eDmceP5P gkoQ== X-Gm-Message-State: AOAM5304e1kvEChg+W9WFIZDICratwto5qDWLEA934W9FZjgKKIAUexb tvpCGOf3drgrLo/+oiNTBcUWWjCuL7uSwRgm+yw= X-Google-Smtp-Source: ABdhPJxeXkn2RLHnP8PQxmPvJoM9OItb/7bZjl5qy8pEYJBSqRnrrBQ0Ov4ceVDwowyuni1qUeMNofRyrqc9CEuMoB0= X-Received: by 2002:a05:6102:3ec3:: with SMTP id n3mr10041248vsv.48.1635081383036; Sun, 24 Oct 2021 06:16:23 -0700 (PDT) In-Reply-To: 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:218112 Archived-At: --00000000000003cc3c05cf190d78 Content-Type: text/plain; charset="UTF-8" (@stefan Did not notice it was a group message) Not really, I think. But if so then I guess we could just call it with list-colors-sort set to nil: ``` (let ((list-colors-sort 'nil)) (list-colors-display (mapcar #'car shr-color-html-colors-alist) nil)) ``` On Sun, 24 Oct 2021 at 14:47, Stefan Kangas wrote: > dalanicolai writes: > > > The snippet passes colors form the shr-color-html-colors-alist variable > > to list-colors-display. However, currently, despite the docstring > > suggesting to me something different, the list-colors-display function > > only applies its sort functionality if no list is passes as argument. > > I don't see a good reason for that limitation, because the limitation is > > set using a when condition, while the sort function works perfectly fine > > with custom color-lists (e.g. try the snippet above). > > > > So this patch simply removes the (when (null list)) condition, and > > passes the list, if given, to the sort functionality. > > Adapting the docstring is not necessary as it already suggests that the > sort functionality works in general. > > Is there any situation in which you wouldn't want the list sorted? > --00000000000003cc3c05cf190d78 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
(@stefan Did not notice it was a group message)
=

Not really, I think. But if so then I guess we cou= ld just call it with list-colors-sort set to nil:
```
(= let ((list-colors-sort 'nil))
=C2=A0 (list-colors-display (mapcar #&= #39;car shr-color-html-colors-alist)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0nil))
```



On Sun, 24 Oct 2021 at 14:47, Stefan Kang= as <stefan@marxist.se> wrote= :
dalanicolai &l= t;dalanicolai@gm= ail.com> writes:

> The snippet passes colors form the shr-color-html-colors-alist variabl= e
> to list-colors-display. However, currently, despite the docstring
> suggesting to me something different, the list-colors-display function=
> only applies its sort functionality if no list is passes as argument.<= br> > I don't see a good reason for that limitation, because the limitat= ion is
> set using a when condition, while the sort function works perfectly fi= ne
> with custom color-lists (e.g. try the snippet above).
>
> So this patch simply removes the (when (null list)) condition, and
> passes the list, if given, to the sort functionality.
> Adapting the docstring is not necessary as it already suggests that th= e=C2=A0 sort functionality works in general.

Is there any situation in which you wouldn't want the list sorted?
--00000000000003cc3c05cf190d78--