summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtur Malabarba <artur@endlessparentheses.com>2019-03-20 12:28:35 -0300
committerArtur Malabarba <artur@endlessparentheses.com>2019-03-20 12:28:35 -0300
commit5839ee43b1f91d1d95d5ec4543e978424ce0649b (patch)
treede4f2f7e11a1786d374fe8b387b6521c9b3f165f
parent9355dc5378f18580d7542d6eb4f1038c3e211b08 (diff)
Move a lambda to a global function to reduce memory usage -- Fix #20
-rw-r--r--rich-minority.el14
1 files 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