Rework modeline init
First of all, if you add a list to the modeline which has a first element that's a normal symbol, the symbol is evaluated and the rest only if it turns out to be truthy. That allows one to use `eyebrowse-mode` to display the indicator only if the mode is active, so no more removing is necessary to stop displaying it. The other change makes sure that nothing, be it enabling the mode a second time non-interactively or loading a theme (see #29 for further details) can result in a duplicated indicator.
This commit is contained in:
10
eyebrowse.el
10
eyebrowse.el
@ -489,12 +489,10 @@ behaviour of `ranger`, a file manager."
|
||||
;; emacs and emacsclient
|
||||
(eyebrowse-init)
|
||||
(add-hook 'after-make-frame-functions 'eyebrowse-init)
|
||||
(setq mode-line-misc-info
|
||||
(-snoc mode-line-misc-info
|
||||
'(:eval (eyebrowse--update-mode-line)))))
|
||||
(remove-hook 'after-make-frame-functions 'eyebrowse-init)
|
||||
(setq mode-line-misc-info
|
||||
(remove '(:eval (eyebrowse--update-mode-line)) mode-line-misc-info))))
|
||||
(unless (assoc 'eyebrowse-mode mode-line-misc-info)
|
||||
(push '(eyebrowse-mode (:eval (eyebrowse--update-mode-line)))
|
||||
(cdr (last mode-line-misc-info)))))
|
||||
(remove-hook 'after-make-frame-functions 'eyebrowse-init)))
|
||||
|
||||
(provide 'eyebrowse)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user