branch: externals/rich-minority
commit 5839ee43b1f91d1d95d5ec4543e978424ce0649b
Author: Artur Malabarba <[email protected]>
Commit: Artur Malabarba <[email protected]>

    Move a lambda to a global function to reduce memory usage -- Fix #20
---
 rich-minority.el | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/rich-minority.el b/rich-minority.el
index 14f9832..2bf8189 100644
--- a/rich-minority.el
+++ b/rich-minority.el
@@ -187,18 +187,20 @@ if the mode line string is empty."
     (unless (string= mode-string "")
       (cons mode-string mode-symbol))))
 
+(defconst rm--help-echo-spacer
+  (propertize " " 'display '(space :align-to 15)))
+
+(defun rm--help-echo-descriptor (pair)
+  (format "   %s%s(%S)" (car pair) rm--help-echo-spacer (cdr pair)))
+
 ;;;###autoload
 (defun rm--mode-list-as-string-list ()
   "Return `minor-mode-list' as a simple list of strings."
   (let ((full-list (delq nil (mapcar #'rm-format-mode-line-entry
-                                     minor-mode-alist)))
-        (spacer (propertize " " 'display '(space :align-to 15))))
+                                     minor-mode-alist))))
     (setq rm--help-echo
           (format "Full list:\n%s\n\n%s"
-                  (mapconcat (lambda (pair)
-                               (format "   %s%s(%S)"
-                                       (car pair) spacer (cdr pair)))
-                             full-list "\n")
+                  (mapconcat rm--help-echo-descriptor full-list "\n")
                   rm--help-echo-bottom))
     (mapcar #'rm--propertize
             (rm--remove-hidden-modes

Reply via email to