Subject: bug#50094: 27.2; `M-x list-colors-display` fails with an error

From: Simon Katz <[email-masked]>
Date: Tue, 17 Aug 2021 14:57:25 +0100

`M-x list-colors-display` fails with an error.

I produced this bug report in Emacs 27.2.2 with no additional packages
loaded.

I also tried with Emacs 26.3, with the same result.

The error is caused by `(apply 'max color-values)` being called when
`color-values` is null.

Debugger backtrace follows:

Debugger entered--Lisp error: (wrong-number-of-arguments #<subr max> 0)
  max()
  apply(max nil)
  list-colors-print((("LightGreen") ("DarkRed") ("DarkMagenta")
("DarkCyan") ("DarkBlue") ("DarkGray" "DarkGrey") ("grey100") ("grey99")
("grey98") ("grey97") ("grey96") ("grey95") ("grey94") ("grey93")
("grey92") ("grey91") ("grey90") ("grey89") ("grey88") ("gray85") ("grey84"
"gray84") ("grey83" "gray83") ("grey82" "gray82") ("grey81" "gray81")
("grey80" "gray80") ("grey79" "gray79") ("grey78" "gray78") ("grey77"
"gray77") ("grey76" "gray76") ("grey75" "gray75") ("grey74" "gray74")
("grey73" "gray73") ("grey72" "gray72") ("grey71" "gray71") ("grey70"
"gray70") ("grey69" "gray69") ("grey68" "gray68") ("grey67" "gray67")
("grey66" "gray66") ("grey65" "gray65") ("grey64" "gray64") ("grey63"
"gray63") ("grey62" "gray62") ("grey61" "gray61") ("grey60" "gray60")
("grey59" "gray59") ("grey58" "gray58") ("grey57" "gray57") ("grey56"
"gray56") ("grey55" "gray55") ...) nil)
  list-colors-display()
  funcall-interactively(list-colors-display)
  call-interactively(list-colors-display record nil)
  command-execute(list-colors-display record)
  execute-extended-command(nil "list-colors-display" "list-colors-d")
  funcall-interactively(execute-extended-command nil "list-colors-display"
"list-colors-d")
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)

In GNU Emacs 27.2 (build 1, x86_64-apple-darwin18.7.0, NS appkit-1671.60
Version 10.14.6 (Build 18G95))
 of 2021-03-27 built on builder10-14.porkrind.org
Windowing system distributor 'Apple', version 10.3.1894
System Description:  Mac OS X 10.15.7

Recent messages:
Unable to load color "grey85" [2 times]
For information about GNU Emacs and the GNU system, type C-h C-a.
Unable to load color "grey85" [2 times]
Entering debugger...
Unable to load color "grey85" [6 times]
s-b is undefined
Mark activated
command-execute: Command attempted to use minibuffer while in minibuffer
Quit [5 times]
Quit
Configured using:
 'configure --with-ns '--enable-locallisppath=/Library/Application
 Support/Emacs/${version}/site-lisp:/Library/Application
 Support/Emacs/site-lisp' --with-modules'

Configured features:
NOTIFY KQUEUE ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES
THREADS JSON PDUMPER GMP

Important settings:
  value of $LANG: en_GB.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Debugger

Minor modes in effect:
  tooltip-mode: t
  global-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
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
format-spec rfc822 mml mml-sec epa derived epg epg-config gnus-util
rmail rmail-loaddefs text-property-search time-date mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail
rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils help-fns
radix-tree cl-print debug backtrace find-func color help-mode
nomis-start-plain package easymenu browse-url url-handlers url-parse
auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs
password-cache json subr-x map url-vars seq byte-opt gv bytecomp
byte-compile cconv cl-loaddefs cl-lib tooltip eldoc electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel term/ns-win ns-win
ucs-normalize mule-util term/common-win 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
timer select scroll-bar mouse jit-lock font-lock syntax facemenu
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 loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote threads kqueue cocoa ns
multi-tty make-network-process emacs)

Memory information:
((conses 16 66352 8907)
 (symbols 48 7697 1)
 (strings 32 21267 2138)
 (string-bytes 1 709606)
 (vectors 16 13608)
 (vector-slots 8 168118 11158)
 (floats 8 180 244)
 (intervals 56 542 4)
 (buffers 1000 14))