Byte-compile mode-line segment :eval forms
Byte-compiled function calls are ~10% faster than evalling quoted forms.
This commit is contained in:
parent
1205db0f73
commit
55870458e6
1 changed files with 9 additions and 8 deletions
|
@ -23,14 +23,15 @@ keep them left and right aligned respectively."
|
|||
body)
|
||||
(macroexp-progn
|
||||
(if (not (keywordp (car rest)))
|
||||
`((defvar-local ,name nil ,docstring)
|
||||
(setq-default
|
||||
,name
|
||||
,(if (or (stringp (car rest))
|
||||
(memq (car (car-safe rest)) '(:eval :propertize)))
|
||||
(car rest)
|
||||
`(quote (:eval ,(macroexp-progn rest)))))
|
||||
(put ',name 'risky-local-variable t))
|
||||
(append `((defvar-local ,name nil ,docstring)
|
||||
(put ',name 'risky-local-variable t))
|
||||
(if (or (stringp (car rest))
|
||||
(memq (car (car-safe rest)) '(:eval :propertize)))
|
||||
`((setq-default ,name ,(car rest)))
|
||||
(let ((fn (intern (format "+modeline--%s" name))))
|
||||
`((fset ',fn (lambda () ,@rest))
|
||||
(byte-compile ',fn)
|
||||
(setq-default ,name (quote (:eval (,fn))))))))
|
||||
;; isolate body
|
||||
(setq body rest)
|
||||
(while (keywordp (car body))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue