(defun lurk-set-current-context (context)
(setq lurk-current-context context)
(lurk-highlight-context context)
+ (lurk-render-prompt)
(if lurk-zoomed
(lurk-zoom-in lurk-current-context)))
(defun lurk-cycle-contexts (&optional rev)
(if lurk-current-context
- (progn
- (lurk-set-current-context (lurk-get-next-context rev))
- (lurk-render-prompt))
+ (lurk-set-current-context (lurk-get-next-context rev))
(lurk-display-error "No channels joined.")))
(with-selected-window window
(recenter -1))))))
+(defun lurk-make-context-button (context &optional label)
+ (with-temp-buffer
+ (insert-text-button (or label context)
+ 'action #'lurk--context-button-action
+ 'follow-link t
+ 'help-echo "Switch context.")
+ (buffer-string)))
+
+(defun lurk--context-button-action (button)
+ (lurk-set-current-context (button-get button 'context)))
+
(defun lurk-display-string (context prefix &rest strings)
(with-current-buffer "*lurk*"
(save-excursion
context
(propertize
(pcase (lurk-get-context-type to)
- ('channel (concat to " <" from ">"))
- ('nick (concat "[" from " -> " to "]"))
+ ('channel (concat
+ (lurk-make-context-button to)
+ " <" from ">"))
+ ('nick (lurk-make-context-button context (concat "[" from " -> " to "]")))
(_
(error "Unsupported context type")))
'face (lurk-get-context-facelist context))
(lurk-display-string
context
(propertize
- (concat context " * " from)
+ (concat (lurk-make-context-button context) " * " from)
'face (lurk-get-context-facelist context))
action-text)))