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 11:35:47 +0200 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="000000000000cd758705cf15f82a" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3775"; mail-complaints-to="usenet@ciao.gmane.io" To: 51371@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Oct 24 11:38:05 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 1meZx6-0000mf-VF for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 24 Oct 2021 11:38:05 +0200 Original-Received: from localhost ([::1]:56290 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1meZx5-0000xG-Nd for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 24 Oct 2021 05:38:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46022) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1meZw6-0007Gy-AO for bug-gnu-emacs@gnu.org; Sun, 24 Oct 2021 05:37:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:54631) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1meZw6-00079Z-1b for bug-gnu-emacs@gnu.org; Sun, 24 Oct 2021 05:37:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1meZw5-0006d8-Rh for bug-gnu-emacs@gnu.org; Sun, 24 Oct 2021 05:37:01 -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 09:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 51371 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.163506817125411 (code B ref -1); Sun, 24 Oct 2021 09:37:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 24 Oct 2021 09:36:11 +0000 Original-Received: from localhost ([127.0.0.1]:37941 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1meZvG-0006bm-If for submit@debbugs.gnu.org; Sun, 24 Oct 2021 05:36:11 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:56056) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1meZvC-0006bc-Kb for submit@debbugs.gnu.org; Sun, 24 Oct 2021 05:36:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45896) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1meZvC-0006qQ-4j for bug-gnu-emacs@gnu.org; Sun, 24 Oct 2021 05:36:06 -0400 Original-Received: from mail-ua1-x92a.google.com ([2607:f8b0:4864:20::92a]:38541) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1meZv7-0006Vu-Ay for bug-gnu-emacs@gnu.org; Sun, 24 Oct 2021 05:36:05 -0400 Original-Received: by mail-ua1-x92a.google.com with SMTP id o26so2298366uab.5 for ; Sun, 24 Oct 2021 02:36:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=FYThYKl1EiJHL+lpxuyaSvuKEPL8K42WCXtqu3T8xpY=; b=E3OKIC9qe6JQAFlI2qwnxJ/lvqR2T3EbI7qJwlF8gMS7/HfTxvkMtLAQzU0WHQDeIM KPAhatgcZCZ4EupjirzUlOZY8pUvFTlr5Kvezq2MA1l7aFLF47kRyd/1/wQ78tg6Xa4J 7udhmLmDU5tjlv51B8V3JL8+ZeuyDHg59lHwPL7yjgJ3RUtTNu1juqaNLPebXPfs4YM8 jvsIIDc7uCN9KD3wji3MYefFiVEH7QW2oq7lvXvTt7uy4QWIIY1+AUGUki+8qFxejk+H tdMB4wMKL0absOiGtLDUfP+lpSJaS4EpcIoZFd8cHH+xRKDXqX3PpcmFe46h4O5l4S6f 7Q1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=FYThYKl1EiJHL+lpxuyaSvuKEPL8K42WCXtqu3T8xpY=; b=2HCBeLKJshRcWwnmAJyHq48OSfcfg+TjfYnpl3unrSNAE5xoOrReE51ljRZo+q9mx/ v4vwx75n8T9wMUHuSWY6FjY6QEUq/8K0NdadMKJacEnLls37YtNqcfuEA69S/SVr3yrK Dc7ooIG3YRXKCg0RkUOtZpYKoEYiUnTpYsH9FGcKfh5MeQvacVETZyhLs3ER+/hf0ZRE 0DMlWp68EFPN97etLUarqcOHevB3fa/GlEZd/nDP9VsBf8UaiDoh6rd2rW3/anOIX6nD wbgKQq6N6mp1Qoj+BO9C+S5l+RRWQ9ClUphYrhua5IUQTJcLG+e4FD/HMfx60SewDfAj 1sqw== X-Gm-Message-State: AOAM533M7ogbWjhGsJCOlTQkn/2ksJUWJi4aLvvuMsCuZN/A3eNHmU/9 znhnXeAg+abKKcCPoETZ949lIrVjVDNn8uz5AS/eilns92w81w== X-Google-Smtp-Source: ABdhPJyjpzOqn0QKHdLE74ICK9WtaE/7purX421NHpoCqcyLXEI5hSDj9AnvCebCo6VO/eH7lAfuqSy3ex7+INxgKiE= X-Received: by 2002:a9f:2429:: with SMTP id 38mr9799829uaq.109.1635068159025; Sun, 24 Oct 2021 02:35:59 -0700 (PDT) Received-SPF: pass client-ip=2607:f8b0:4864:20::92a; envelope-from=dalanicolai@gmail.com; helo=mail-ua1-x92a.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, HTML_MESSAGE=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:218083 Archived-At: --000000000000cd758705cf15f82a Content-Type: multipart/alternative; boundary="000000000000cd758405cf15f828" --000000000000cd758405cf15f828 Content-Type: text/plain; charset="UTF-8" Motivation for this patch is that I would like to use the following code snippet in https://elpa.gnu.org/packages/sketch-mode.html. ``` (let ((list-colors-sort 'hsv)) (list-colors-display (mapcar #'car shr-color-html-colors-alist) nil)) ``` 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. With this patch, I can offer a great sorted color selection menu, providing only colors supported by SVG. In GNU Emacs 28.0.50 (build 3, x86_64-pc-linux-gnu, GTK+ Version 3.24.30, cairo version 1.17.4) of 2021-09-06 built on daniel-fedora Repository revision: c4724add006e62b81f847937db56335a81bdcc74 Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12011000 System Description: Fedora 34 (Workstation Edition) Configured using: 'configure --with-mailutils --with-cairo --with-modules --with-pgtk --with-native-compilation' Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM GTK3 ZLIB Important settings: value of $LANG: en_US.UTF-8 value of $XMODIFIERS: @im=none locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t global-eldoc-mode: t eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t indent-tabs-mode: t transient-mark-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs rfc822 mml mml-sec epa derived epg rfc6068 epg-config gnus-util rmail rmail-loaddefs auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs password-cache json map text-property-search time-date subr-x seq byte-opt gv bytecomp byte-compile cconv mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils iso-transl tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice button loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote threads dbusbind inotify lcms2 dynamic-setting system-font-setting font-render-setting cairo move-toolbar gtk x-toolkit x multi-tty make-network-process native-compile emacs) Memory information: ((conses 16 67179 6847) (symbols 48 6625 0) (strings 32 19309 1709) (string-bytes 1 660631) (vectors 16 13095) (vector-slots 8 260900 12229) (floats 8 22 32) (intervals 56 225 0) (buffers 992 11)) --000000000000cd758405cf15f828 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Motivation for this = patch is that I would like to use the following code
<= br>
```
(let ((list-colors-sort 'hsv))
=C2=A0 (list-colors-display (mapcar #'car= shr-color-html-colors-alist)
```

The snippet = passes colors form the shr-color-html-colors-alist variable
to list-colors-display. However, currently,= despite the docstring
sugge= sting to me something different, the list-colors-display function
=
only applies its sort functionality i= f no list is passes as argument.
I don't see a good reason for that limitation, because the limitat= ion is
set using a when cond= ition, 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 li= st, if given, to the sort functionality.
Adapting the docstring is not necessary as it already suggests tha= t the=C2=A0 sort functionality works in general.

With t= his patch, I can offer a great sorted color selection menu,
providing only colors supported by SVG.
=


In GNU Ema= cs 28.0.50 (build 3, x86_64-pc-linux-gnu, GTK+ Version 3.24.30, cairo versi= on 1.17.4)
=C2=A0of 2021-09-= 06 built on daniel-fedora
Re= pository revision: c4724add006e62b81f847937db56335a81bdcc74
Repository branch: master
Windowing system distributor 'The X.Org F= oundation', version 11.0.12011000
System Description: Fedora 34 (Workstation Edition)

Configured using:
=C2= =A0'configure --with-mailutils --with-cairo --with-modules --with-pgtk<= br>
=C2=A0--with-native-compilat= ion'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETT= INGS HARFBUZZ JPEG
JSON LCMS= 2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES
NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SEC= COMP SOUND THREADS TIFF
TOOL= KIT_SCROLL_BARS X11 XDBE XIM XPM GTK3 ZLIB

Important se= ttings:
=C2=A0 value of $LAN= G: en_US.UTF-8
=C2=A0 value = of $XMODIFIERS: @im=3Dnone
= =C2=A0 locale-coding-system: utf-8-unix

Major mode: Lis= p Interaction

Minor modes in effect:
=C2=A0 tooltip-mode: t
=C2=A0 global-eldoc-mode: t
=C2=A0 eldoc-mode: t
=C2=A0 electric-indent-mode: t
=C2=A0 mouse-wheel-mode: t
=C2=A0 tool-bar-mode: t
=C2=A0 menu-bar-mode: t
=C2=A0 file-name-shadow-mode: t
=C2=A0 global-font-lock-mode: t
=C2=A0 font-lock-mode: t
=C2=A0 blink-cursor-mode: t
=C2=A0 auto-composition-mode: t
=C2=A0 auto-encryption-mode: t
=C2=A0 auto-compression-mode: t
=C2=A0 line-number-mode: t
=C2=A0 indent-tabs-mode: t
=C2=A0 transient-mark-mode: t

Load-path shadows:
None f= ound.

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-load= defs
rfc822 mml mml-sec epa = derived epg rfc6068 epg-config gnus-util rmail
rmail-loaddefs auth-source cl-seq eieio eieio-core cl-ma= cs
eieio-loaddefs password-c= ache json map text-property-search time-date
subr-x seq byte-opt gv bytecomp byte-compile cconv mm-deco= de mm-bodies
mm-encode mail-= parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs
cl-lib sendmail rfc2047 rfc2045 ietf-drums mm= -util mail-prsvr mail-utils
= iso-transl tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/x-win x-win = term/common-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode elisp-mode lisp-mode= prog-mode register page tab-bar menu-bar
rfn-eshadow isearch easymenu timer select scroll-bar mouse ji= t-lock
font-lock syntax font= -core term/tty-colors frame minibuffer cl-generic
cham georgian utf-8-lang misc-lang vietnamese tibetan= thai tai-viet lao
korean ja= panese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese co= mposite charscript charprop
= case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice button loaddefs faces= cus-face macroexp files
win= dow text-properties overlay sha1 md5 base64 format env code-pages
=
mule custom widget hashtable-print-re= adable backquote threads dbusbind
inotify lcms2 dynamic-setting system-font-setting font-render-setting=
cairo move-toolbar gtk x-to= olkit x multi-tty make-network-process
native-compile emacs)

Memory information:
((conses 16 67179 6847)
=C2=A0(symbols 48 6625 0)
=C2=A0(strings 32 19309 1709)
=C2=A0(string-bytes 1 660631)
<= /div>
=C2=A0(vectors 16 13095)
=C2=A0(vector-slots 8 260900 12229)=
=C2=A0(floats 8 22 32)
<= /div>
=C2=A0(intervals 56 225 0)
=C2=A0(buffers 992 11))
=

--000000000000cd758405cf15f828-- --000000000000cd758705cf15f82a Content-Type: text/x-patch; charset="US-ASCII"; name="facemenu.patch" Content-Disposition: attachment; filename="facemenu.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_kv51cs0a0 ZGlmZiAtLWdpdCBhL2xpc3AvZmFjZW1lbnUuZWwgYi9saXNwL2ZhY2VtZW51LmVsCmluZGV4IDc0 MTdiYjEyMDMuLmQ0ZDY5NzUwNjEgMTAwNjQ0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