From: Eshel Yaron Date: Fri, 4 Oct 2024 19:21:30 +0000 (+0200) Subject: New user option 'kubed-list-mode-line-format' X-Git-Tag: v0.4.2~4 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=443edee160e9dcbef891afa14ae1925cb23c69b4;p=kubed.git New user option 'kubed-list-mode-line-format' * kubed.el (kubed-list-mode-line-format): New user option, extracted from... (kubed-define-resource): ...here. Use it in 'mode-name' of generated major modes. This allows users to customize the indicator we show in the mode line when update is in progress. * kubed.texi (Browse Resources): Document new user option. * NEWS.org: Announce it. --- diff --git a/NEWS.org b/NEWS.org index ea5b65d..93c17b8 100644 --- a/NEWS.org +++ b/NEWS.org @@ -10,6 +10,13 @@ for Kubernetes. For further details, see the Kubed manual: [[https://eshelyaron.com/sweep.html][https://eshelyaron.com/kubed.html]]. +* Version 0.4.2 in development + +** New user option 'kubed-list-mode-line-format' + +This user option lets you customize the indicator that Kubed shows in +the mode line of resource table buffers when update is in progress. + * Version 0.4.1 on 2024-09-23 ** New command and transient menu for scaling deployments diff --git a/kubed.el b/kubed.el index 03c99f5..92d4fca 100644 --- a/kubed.el +++ b/kubed.el @@ -1140,6 +1140,22 @@ prompt for CONTEXT as well." (when namespace (list "-n" namespace)) (when context (list "--context" context)))))) +(defcustom kubed-list-mode-line-format + '(:eval (cond + ((process-live-p + (alist-get 'process + (kubed--alist kubed-list-type + kubed-list-context + kubed-list-namespace))) + (propertize "[...]" 'help-echo "Updating...")) + (kubed-list-filter + (propertize + (concat "[" (mapconcat #'prin1-to-string kubed-list-filter " ") "]") + 'help-echo "Current filter")))) + "Mode line construct for indicating status of Kubernetes resources list." + :type 'sexp + :risky t) + ;;;###autoload (defmacro kubed-define-resource (resource &optional properties &rest commands) "Define Kubernetes RESOURCE with associated PROPERTIES and COMMANDS. @@ -1555,17 +1571,8 @@ a prefix argument \\[universal-argument], prompt for CONTEXT too." menu) (define-derived-mode ,mod-name kubed-list-mode - (list ,(format "Kubernetes %ss" (capitalize (symbol-name resource))) - (list '(:eval (if (process-live-p - (alist-get 'process - (kubed--alist kubed-list-type - kubed-list-context - kubed-list-namespace))) - (propertize "[...]" 'help-echo "Updating...") - (when kubed-list-filter - (propertize - (concat "[" (mapconcat #'prin1-to-string kubed-list-filter " ") "]") - 'help-echo "Current filter")))))) + '(,(format "Kubernetes %ss" (capitalize (symbol-name resource))) + kubed-list-mode-line-format) ,(format "Major mode for listing Kubernetes %S." plrl-var) :interactive nil (setq kubed-list-filter-history-variable diff --git a/kubed.texi b/kubed.texi index 34432b7..a52ad60 100644 --- a/kubed.texi +++ b/kubed.texi @@ -482,6 +482,12 @@ that @code{revert-buffer} only refreshes the list display, without fetching updated data from Kubernetes. You can still invoke @code{revert-buffer} with @kbd{C-x x g} or @kbd{M-x}, if you need it. +@vindex kubed-list-mode-line-format +Whenever Kubed is fetching data from Kubernetes to update a resources +list buffer, the mode line of that list buffer shows the @samp{[...]} +indicator. You can set user option @code{kubed-list-mode-line-format} +to customize this indicator. + @menu * List Filter:: @end menu