The Lambda Lab
/
projects
/
lurk.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
bbb819b
)
Added clickable contexts.
author
plugd
<plugd@thelambdalab.xyz>
Wed, 28 Jul 2021 16:49:59 +0000
(18:49 +0200)
committer
plugd
<plugd@thelambdalab.xyz>
Wed, 28 Jul 2021 16:49:59 +0000
(18:49 +0200)
lurk.el
patch
|
blob
|
history
diff --git
a/lurk.el
b/lurk.el
index
447f5f5
..
535b990
100644
(file)
--- a/
lurk.el
+++ b/
lurk.el
@@
-321,14
+321,13
@@
portion of the source component of the message, as LURK doesn't use this.")
(defun lurk-set-current-context (context)
(setq lurk-current-context context)
(lurk-highlight-context context)
(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
(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.")))
(lurk-display-error "No channels joined.")))
@@
-464,6
+463,17
@@
portion of the source component of the message, as LURK doesn't use this.")
(with-selected-window window
(recenter -1))))))
(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
(defun lurk-display-string (context prefix &rest strings)
(with-current-buffer "*lurk*"
(save-excursion
@@
-503,8
+513,10
@@
portion of the source component of the message, as LURK doesn't use this.")
context
(propertize
(pcase (lurk-get-context-type to)
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))
(_
(error "Unsupported context type")))
'face (lurk-get-context-facelist context))
@@
-517,7
+529,7
@@
portion of the source component of the message, as LURK doesn't use this.")
(lurk-display-string
context
(propertize
(lurk-display-string
context
(propertize
- (concat
context
" * " from)
+ (concat
(lurk-make-context-button context)
" * " from)
'face (lurk-get-context-facelist context))
action-text)))
'face (lurk-get-context-facelist context))
action-text)))