emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/nano-modeline 0b47e73d04 18/26: Added possibility for d


From: ELPA Syncer
Subject: [elpa] externals/nano-modeline 0b47e73d04 18/26: Added possibility for dynamic buttons
Date: Fri, 2 Jun 2023 03:59:08 -0400 (EDT)

branch: externals/nano-modeline
commit 0b47e73d0447dd0354349cdd841077e78a0aefb5
Author: Nicolas P. Rougier <Nicolas.Rougier@inria.fr>
Commit: Nicolas P. Rougier <Nicolas.Rougier@inria.fr>

    Added possibility for dynamic buttons
---
 nano-modeline.el | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/nano-modeline.el b/nano-modeline.el
index d2612a794d..c784814cca 100644
--- a/nano-modeline.el
+++ b/nano-modeline.el
@@ -344,6 +344,9 @@ svg-lib is installed, result is a SVG button else, it is a 
text
 button."
 
   (let* ((label (plist-get button :label))
+         (label (if (functionp label)
+                    (funcall label)
+                  label))
          (state (plist-get button :state))
          (hook (plist-get button :hook))
          (window (get-buffer-window (current-buffer)))
@@ -384,9 +387,15 @@ other button states."
     (when (and active (boundp 'nano-modeline--buttons))
       (dolist (button nano-modeline--buttons)
         (unless (eq (plist-get button :state) 'inactive)
-          (if (string-equal (plist-get button :label) label)
+
+          (let* ((button-label (plist-get button :label))
+                 (button-label (if (functionp button-label)
+                                   (funcall button-label)
+                                 button-label)))
+          
+          (if (string-equal button-label label)
               (plist-put button :state state)
-            (plist-put button :state 'active)))))
+            (plist-put button :state 'active))))))
     (force-mode-line-update)))
 
 (defun nano-modeline-header (left &optional right default)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]