From 6352524d320f6285db1e74e680cab401eb010403 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 26 Aug 2020 16:57:29 -0400 Subject: [PATCH] Allow def-modeline-var! to overwrite old segments --- modules/ui/modeline/+light.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/ui/modeline/+light.el b/modules/ui/modeline/+light.el index c9814c2ae..6d1eab924 100644 --- a/modules/ui/modeline/+light.el +++ b/modules/ui/modeline/+light.el @@ -152,13 +152,14 @@ LHS and RHS will accept." (lambda (&rest _) (set-modeline! name)))) (defmacro def-modeline-var! (name body &optional docstring &rest plist) - "TODO" + "Define a modeline segment variable." (unless (stringp docstring) (push docstring plist) (setq docstring nil)) `(progn - (,(if (plist-get plist :local) 'defvar-local 'defvar) - ,name ,body ,docstring) + (defvar ,name nil ,docstring) + ,@(if (plist-get plist :local) `((make-variable-buffer-local ',name))) + (setq-default ,name ,body) (put ',name 'risky-local-variable t)))