aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Aranda2021-01-19 09:25:00 -0300
committerMauro Aranda2021-01-19 09:25:00 -0300
commitf2f06b020904e7d53af1e686a441887f24fb589c (patch)
treead5739e6ac195a075d580b7a11d6d11ae193323f
parent33ff86a20ab5a0b6a7ffe5056341334c4bcafca6 (diff)
downloademacs-f2f06b020904e7d53af1e686a441887f24fb589c.tar.gz
emacs-f2f06b020904e7d53af1e686a441887f24fb589c.zip
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)
-rw-r--r--lisp/facemenu.el11
1 files changed, 8 insertions, 3 deletions
diff --git a/lisp/facemenu.el b/lisp/facemenu.el
index 2609397b0d9..dc5f8f46aba 100644
--- a/lisp/facemenu.el
+++ b/lisp/facemenu.el
@@ -606,9 +606,14 @@ color. The function should accept a single argument, the color name."
606 606
607(defun list-colors-print (list &optional callback) 607(defun list-colors-print (list &optional callback)
608 (let ((callback-fn 608 (let ((callback-fn
609 (if callback 609 ;; Expect CALLBACK to be a function, but allow it to be a form that
610 `(lambda (button) 610 ;; evaluates to a function, for backward-compatibility. (Bug#45831)
611 (funcall ,callback (button-get button 'color-name)))))) 611 (cond ((functionp callback)
612 (lambda (button)
613 (funcall callback (button-get button 'color-name))))
614 (callback
615 `(lambda (button)
616 (funcall ,callback (button-get button 'color-name)))))))
612 (dolist (color list) 617 (dolist (color list)
613 (if (consp color) 618 (if (consp color)
614 (if (cdr color) 619 (if (cdr color)