mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-26 07:33:47 +00:00
Fix list-colors-print handling of callback arg
* lisp/facemenu.el (list-colors-print): Keeping backward-compatibility, don't fail when passed a closure object as CALLBACK. (Bug#45831)
This commit is contained in:
parent
33ff86a20a
commit
f2f06b0209
@ -606,9 +606,14 @@ color. The function should accept a single argument, the color name."
|
||||
|
||||
(defun list-colors-print (list &optional callback)
|
||||
(let ((callback-fn
|
||||
(if callback
|
||||
`(lambda (button)
|
||||
(funcall ,callback (button-get button 'color-name))))))
|
||||
;; Expect CALLBACK to be a function, but allow it to be a form that
|
||||
;; evaluates to a function, for backward-compatibility. (Bug#45831)
|
||||
(cond ((functionp callback)
|
||||
(lambda (button)
|
||||
(funcall callback (button-get button 'color-name))))
|
||||
(callback
|
||||
`(lambda (button)
|
||||
(funcall ,callback (button-get button 'color-name)))))))
|
||||
(dolist (color list)
|
||||
(if (consp color)
|
||||
(if (cdr color)
|
||||
|
Loading…
Reference in New Issue
Block a user