branch: externals/ivy commit 8b6fe6e1f5bd15a23f718212515927d1cfe9842c Author: Basil L. Contovounesios <ba...@contovou.net> Commit: Basil L. Contovounesios <ba...@contovou.net>
Refactor counsel--minor-candidates * counsel.el (counsel--minor-candidates): Precompute propertized format string. Use cl-mapcan. --- counsel.el | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/counsel.el b/counsel.el index a14345c5cd..7cf68c12b3 100644 --- a/counsel.el +++ b/counsel.el @@ -6856,22 +6856,19 @@ Additional actions: The alist element is cons of minor mode string with its lighter and minor mode symbol." - (delq nil - (mapcar - (lambda (mode) - (when (and (boundp mode) (commandp mode)) - (let ((lighter (cdr (assq mode minor-mode-alist)))) - (cons (concat - (if (symbol-value mode) "-" "+") - (symbol-name mode) - (propertize - (if lighter - (format " \"%s\"" - (format-mode-line (cons t lighter))) - "") - 'face 'font-lock-string-face)) - mode)))) - minor-mode-list))) + (cl-mapcan + (let ((suffix (propertize " \"%s\"" 'face 'font-lock-string-face))) + (lambda (mode) + (when (and (boundp mode) (commandp mode)) + (let ((lighter (cdr (assq mode minor-mode-alist)))) + (list (cons (concat + (if (symbol-value mode) "-" "+") + (symbol-name mode) + (and lighter + (format suffix + (format-mode-line (cons t lighter))))) + mode)))))) + minor-mode-list)) ;;;###autoload (defun counsel-minor ()