From 85e71a387dc514bc7de3e497408ff211b458a657 Mon Sep 17 00:00:00 2001 From: plugd Date: Sun, 26 May 2024 20:50:39 +0200 Subject: [PATCH] Added context buttons. --- murk.el | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/murk.el b/murk.el index 20d8b06..b438aa3 100644 --- a/murk.el +++ b/murk.el @@ -599,6 +599,23 @@ The head of this list is always the current context.") 'invisible context-atom))))))) (murk-scroll-windows-to-last-line)) +(defun murk-click-context (button) + (murk-switch-to-context (button-get button 'context)) + (murk-highlight-current-context) + (murk-render-prompt) + (if murk-zoomed + (murk-zoom-in (murk-current-context)))) + +(defun murk-make-context-button (context &optional string) + (with-temp-buffer + (let ((label (or string (murk-context->string context)))) + (insert-text-button label + 'action #'murk-click-context + 'context context + 'follow-link t + 'help-echo "Switch context")) + (buffer-string))) + (defun murk-display-message (network from to text) (let ((context (if (string-prefix-p "#" to) (murk-get-context network to) @@ -608,7 +625,9 @@ The head of this list is always the current context.") (propertize (if (murk-network-context-p context) (concat "[" from "->" to "]") - (concat (murk-context->string context) " <" from ">")) + (concat + (murk-make-context-button context) + " <" from ">")) 'face (murk-get-context-facelist context)) text))) -- 2.20.1