Optimize modeline rendering slightly

This commit is contained in:
Henrik Lissner 2017-06-17 11:40:21 +02:00
parent 414363fe38
commit a8df81b259
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -385,12 +385,13 @@ Example:
(defun ,sym () (defun ,sym ()
(let ((lhs (list ,@lhs-forms)) (let ((lhs (list ,@lhs-forms))
(rhs (list ,@rhs-forms))) (rhs (list ,@rhs-forms)))
(list lhs (let ((rhs-str (format-mode-line rhs)))
(propertize (list lhs
" " 'display (propertize
`((space :align-to (- (+ right right-fringe right-margin) " " 'display
,(+ 1 (string-width (format-mode-line rhs))))))) `((space :align-to (- (+ right right-fringe right-margin)
rhs))) ,(+ 1 (string-width rhs-str))))))
rhs-str))))
,(unless (bound-and-true-p byte-compile-current-file) ,(unless (bound-and-true-p byte-compile-current-file)
`(let (byte-compile-warnings) `(let (byte-compile-warnings)
(byte-compile #',sym)))))) (byte-compile #',sym))))))